2012-04-29 23:27:12 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
2012-05-14 05:43:50 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This code is based on original Tony Tough source code
|
|
|
|
*
|
|
|
|
* Copyright (c) 1997-2003 Nayma Software
|
|
|
|
*/
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
#ifndef TONY_GAME_H
|
|
|
|
#define TONY_GAME_H
|
|
|
|
|
|
|
|
#include "tony/adv.h"
|
|
|
|
#include "tony/gfxcore.h"
|
|
|
|
#include "tony/input.h"
|
|
|
|
#include "tony/loc.h"
|
|
|
|
#include "tony/utils.h"
|
|
|
|
|
|
|
|
namespace Tony {
|
|
|
|
|
2012-05-14 19:29:27 +00:00
|
|
|
#define INIT_GFX16_FROMRAW(dwRes, buf16) \
|
|
|
|
raw = new RMResRaw(dwRes); \
|
|
|
|
assert(raw->IsValid()); \
|
|
|
|
assert((buf16) == NULL); \
|
|
|
|
(buf16) = new RMGfxSourceBuffer16(false); \
|
2012-06-05 06:39:55 +00:00
|
|
|
(buf16)->init(*raw,raw->Width(),raw->Height()); \
|
2012-05-01 13:00:03 +00:00
|
|
|
delete raw;
|
|
|
|
|
2012-05-14 19:29:27 +00:00
|
|
|
#define INIT_GFX8_FROMRAW(raw, dwRes, buf8) \
|
|
|
|
raw = new RMResRaw(dwRes); \
|
|
|
|
assert(raw->IsValid()); \
|
|
|
|
assert((buf8) == NULL); \
|
|
|
|
(buf8) = new RMGfxSourceBuffer8RLEByte(); \
|
2012-06-05 06:39:55 +00:00
|
|
|
(buf8)->init(*raw, raw->Width(), raw->Height(), true); \
|
2012-05-01 13:00:03 +00:00
|
|
|
delete raw;
|
|
|
|
|
|
|
|
|
2012-04-29 23:27:12 +00:00
|
|
|
class RMPointer : public RMGfxTask {
|
|
|
|
private:
|
2012-06-05 23:37:06 +00:00
|
|
|
RMGfxSourceBuffer8 *_pointer[16];
|
|
|
|
RMPoint _hotspot[16];
|
|
|
|
RMPoint _pos;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-05 23:37:06 +00:00
|
|
|
RMItem *_specialPointer[16];
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-05 23:37:06 +00:00
|
|
|
int _nCurPointer;
|
|
|
|
int _nCurSpecialPointer;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-05 23:37:06 +00:00
|
|
|
RMGfxSourceBuffer8 *_nCurCustomPointer;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
enum POINTER {
|
|
|
|
PTR_NONE = 0,
|
|
|
|
PTR_FRECCIASU,
|
|
|
|
PTR_FRECCIAGIU,
|
|
|
|
PTR_FRECCIASINISTRA,
|
|
|
|
PTR_FRECCIADESTRA,
|
|
|
|
PTR_FRECCIAMAPPA,
|
|
|
|
PTR_CUSTOM
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
// Constructor & destructor
|
2012-05-14 19:29:27 +00:00
|
|
|
RMPointer();
|
2012-04-29 23:27:12 +00:00
|
|
|
virtual ~RMPointer();
|
|
|
|
|
|
|
|
// Initialisation
|
2012-06-05 23:37:06 +00:00
|
|
|
void init(void);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
// Deinitialisation
|
2012-06-05 23:37:06 +00:00
|
|
|
void close(void);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
// Process a frame
|
2012-06-05 23:37:06 +00:00
|
|
|
void doFrame(RMGfxTargetBuffer *bigBuf);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
// Overloading of priorities
|
2012-06-05 16:51:20 +00:00
|
|
|
int priority();
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
// Overloading draw method
|
2012-06-05 06:39:55 +00:00
|
|
|
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
|
2012-05-14 19:29:27 +00:00
|
|
|
|
2012-04-29 23:27:12 +00:00
|
|
|
// Sets the current co-ordinates
|
2012-06-05 23:37:06 +00:00
|
|
|
void setCoord(const RMPoint &pt) {
|
|
|
|
_pos = pt;
|
2012-05-14 19:29:27 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
// Overloading of the method to see if rising from the list
|
2012-06-05 16:51:20 +00:00
|
|
|
virtual void removeThis(CORO_PARAM, bool &result);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
// Sets a new action as current
|
2012-06-05 23:37:06 +00:00
|
|
|
void setAction(RMTonyAction action) {
|
|
|
|
_nCurPointer = action;
|
2012-05-14 19:29:27 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
// Sets a new pointer
|
2012-06-05 23:37:06 +00:00
|
|
|
void setSpecialPointer(POINTER ptr) {
|
|
|
|
_nCurSpecialPointer = ptr;
|
|
|
|
if (_nCurSpecialPointer && _nCurSpecialPointer != PTR_CUSTOM)
|
2012-06-07 05:58:01 +00:00
|
|
|
_specialPointer[ptr - 1]->setPattern(1);
|
2012-05-14 19:29:27 +00:00
|
|
|
}
|
2012-06-05 23:37:06 +00:00
|
|
|
POINTER getSpecialPointer(void) {
|
|
|
|
return (POINTER)_nCurSpecialPointer;
|
2012-04-29 23:27:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Set the new custom pointer
|
2012-06-05 23:37:06 +00:00
|
|
|
void setCustomPointer(RMGfxSourceBuffer8 *ptr) {
|
|
|
|
_nCurCustomPointer = ptr;
|
2012-05-14 19:29:27 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
// Return the current action to be applied according to the pointer
|
2012-06-05 23:37:06 +00:00
|
|
|
int curAction(void);
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class RMOptionButton: public RMGfxTaskSetPrior {
|
|
|
|
public:
|
2012-06-05 23:37:06 +00:00
|
|
|
RMRect _rect;
|
|
|
|
RMGfxSourceBuffer16 *_buf;
|
|
|
|
bool _bActive;
|
|
|
|
bool _bHasGfx;
|
|
|
|
bool _bDoubleState;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
RMOptionButton(uint32 dwRes, RMPoint pt, bool bDoubleState = false);
|
2012-05-12 14:43:02 +00:00
|
|
|
RMOptionButton(const RMRect &pt);
|
2012-04-29 23:27:12 +00:00
|
|
|
virtual ~RMOptionButton();
|
|
|
|
|
2012-06-05 23:37:06 +00:00
|
|
|
bool doFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick);
|
2012-06-05 06:39:55 +00:00
|
|
|
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
|
2012-06-05 23:37:06 +00:00
|
|
|
void addToList(RMGfxTargetBuffer &bigBuf);
|
|
|
|
bool isActive() {
|
|
|
|
return _bActive;
|
2012-05-14 19:29:27 +00:00
|
|
|
}
|
2012-06-05 23:37:06 +00:00
|
|
|
void setActiveState(bool bState) {
|
|
|
|
_bActive = bState;
|
2012-05-14 19:29:27 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class RMOptionSlide : public RMGfxTaskSetPrior {
|
|
|
|
private:
|
2012-06-05 23:37:06 +00:00
|
|
|
RMOptionButton *_PushLeft;
|
|
|
|
RMOptionButton *_PushRight;
|
|
|
|
RMGfxSourceBuffer16 *_SliderCenter;
|
|
|
|
RMGfxSourceBuffer16 *_SliderLeft;
|
|
|
|
RMGfxSourceBuffer16 *_SliderRight;
|
|
|
|
RMGfxSourceBuffer16 *_SliderSingle;
|
|
|
|
int _nSlideSize;
|
|
|
|
RMPoint _pos;
|
|
|
|
int _nValue;
|
|
|
|
int _nMax;
|
|
|
|
int _nStep;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
2012-05-12 14:43:02 +00:00
|
|
|
RMOptionSlide(const RMPoint &pt, int m_nRange = 100, int m_nStartValue = 0, int slideSize = 300);
|
2012-04-29 23:27:12 +00:00
|
|
|
virtual ~RMOptionSlide();
|
|
|
|
|
2012-06-05 23:37:06 +00:00
|
|
|
bool doFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick);
|
2012-06-05 06:39:55 +00:00
|
|
|
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
|
2012-06-05 23:37:06 +00:00
|
|
|
void addToList(RMGfxTargetBuffer &bigBuf);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-06-05 23:37:06 +00:00
|
|
|
int getValue() {
|
|
|
|
return _nValue;
|
2012-05-14 19:29:27 +00:00
|
|
|
}
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class RMOptionScreen : public RMGfxWoodyBuffer {
|
|
|
|
private:
|
2012-06-05 23:37:06 +00:00
|
|
|
RMGfxSourceBuffer16 *_menu;
|
|
|
|
RMGfxSourceBuffer16 *_QuitConfirm;
|
|
|
|
RMGfxSourceBuffer16 *_HideLoadSave;
|
|
|
|
RMOptionButton *_ButtonQuitYes;
|
|
|
|
RMOptionButton *_ButtonQuitNo;
|
|
|
|
RMOptionButton *_ButtonExit;
|
|
|
|
RMOptionButton *_ButtonQuit;
|
|
|
|
RMOptionButton *_ButtonLoad;
|
|
|
|
RMOptionButton *_ButtonSave;
|
|
|
|
RMOptionButton *_ButtonGameMenu;
|
|
|
|
RMOptionButton *_ButtonGfxMenu;
|
|
|
|
RMOptionButton *_ButtonSoundMenu;
|
|
|
|
RMGfxSourceBuffer8 *_SaveEasy;
|
|
|
|
RMGfxSourceBuffer8 *_SaveHard;
|
|
|
|
RMGfxSourceBuffer16 *_curThumb[6];
|
|
|
|
RMString _curThumbName[6];
|
|
|
|
byte _curThumbDiff[6];
|
|
|
|
RMOptionButton *_ButtonSave_States[6];
|
|
|
|
RMOptionButton *_ButtonSave_ArrowLeft;
|
|
|
|
RMOptionButton *_ButtonSave_ArrowRight;
|
|
|
|
RMOptionButton *_ButtonGfx_Tips;
|
|
|
|
|
|
|
|
RMOptionButton *_ButtonSound_DubbingOn;
|
|
|
|
RMOptionButton *_ButtonSound_MusicOn;
|
|
|
|
RMOptionButton *_ButtonSound_SFXOn;
|
|
|
|
|
|
|
|
RMOptionSlide *_SlideTonySpeed;
|
|
|
|
RMOptionSlide *_SlideTextSpeed;
|
|
|
|
|
|
|
|
|
|
|
|
int _statePos;
|
|
|
|
bool _bEditSaveName;
|
|
|
|
int _nEditPos;
|
|
|
|
char _EditName[256];
|
2012-05-14 19:29:27 +00:00
|
|
|
|
2012-04-29 23:27:12 +00:00
|
|
|
union {
|
2012-06-05 23:37:06 +00:00
|
|
|
RMOptionButton *_ButtonGame_Lock;
|
|
|
|
RMOptionButton *_ButtonGfx_Anni30;
|
|
|
|
RMOptionSlide *_SliderSound_Music;
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
union {
|
2012-06-05 23:37:06 +00:00
|
|
|
RMOptionButton *_ButtonGame_TimerizedText;
|
|
|
|
RMOptionButton *_ButtonGfx_AntiAlias;
|
|
|
|
RMOptionSlide *_SliderSound_SFX;
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
union {
|
2012-06-05 23:37:06 +00:00
|
|
|
RMOptionButton *_ButtonGame_Scrolling;
|
|
|
|
RMOptionButton *_ButtonGfx_Sottotitoli;
|
|
|
|
RMOptionSlide *_SliderSound_Dubbing;
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
union {
|
2012-06-05 23:37:06 +00:00
|
|
|
RMOptionButton *_ButtonGame_InterUp;
|
|
|
|
RMOptionButton *_ButtonGfx_Trans;
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
2012-06-05 23:37:06 +00:00
|
|
|
int _FadeStep;
|
|
|
|
bool _bExit;
|
|
|
|
bool _bQuitConfirm;
|
|
|
|
int _FadeY;
|
|
|
|
int _FadeTime;
|
|
|
|
bool _bLoadMenuOnly;
|
|
|
|
bool _bNoLoadSave;
|
|
|
|
bool _bAlterGfx;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
enum STATE {
|
2012-05-14 19:29:27 +00:00
|
|
|
MENUGAME,
|
|
|
|
MENUGFX,
|
|
|
|
MENUSOUND,
|
|
|
|
MENULOAD,
|
2012-06-02 06:59:58 +00:00
|
|
|
MENUSAVE,
|
|
|
|
MENUNONE
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
2012-06-05 23:37:06 +00:00
|
|
|
STATE _nState;
|
|
|
|
STATE _nLastState;
|
2012-04-29 23:27:12 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
RMOptionScreen();
|
|
|
|
virtual ~RMOptionScreen();
|
|
|
|
|
2012-06-05 23:37:06 +00:00
|
|
|
void init(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool &result);
|
|
|
|
void initLoadMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool bAlternateGfx, bool &result);
|
|
|
|
void initSaveMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool bAlternateGfx, bool &result);
|
|
|
|
void initNoLoadSave(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool &result);
|
|
|
|
void reInit(RMGfxTargetBuffer &bigBuf);
|
|
|
|
bool close();
|
|
|
|
bool isClosing();
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 05:28:48 +00:00
|
|
|
// Overloaded methods
|
2012-06-05 16:51:20 +00:00
|
|
|
virtual int priority();
|
2012-06-05 06:39:55 +00:00
|
|
|
virtual void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
|
2012-06-05 16:51:20 +00:00
|
|
|
virtual void removeThis(CORO_PARAM, bool &result);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 05:28:48 +00:00
|
|
|
// Polling for the option screen
|
2012-06-05 23:37:06 +00:00
|
|
|
void doFrame(CORO_PARAM, RMInput *m_input);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-14 12:39:24 +00:00
|
|
|
// Retrieves a savegame's thumbnail, description, and difficulty level
|
2012-06-05 23:37:06 +00:00
|
|
|
static bool loadThumbnailFromSaveState(int numState, byte *lpDestBuf, RMString &name, byte &diff);
|
2012-05-14 12:39:24 +00:00
|
|
|
|
2012-04-29 23:27:12 +00:00
|
|
|
protected:
|
|
|
|
|
2012-05-20 06:03:09 +00:00
|
|
|
// Initialisation and state change
|
2012-06-05 23:37:06 +00:00
|
|
|
void initState(CORO_PARAM);
|
|
|
|
void closeState(void);
|
|
|
|
void changeState(CORO_PARAM, STATE newState);
|
2012-04-29 23:27:12 +00:00
|
|
|
|
2012-05-20 06:03:09 +00:00
|
|
|
// Repaint the options menu
|
2012-06-05 23:37:06 +00:00
|
|
|
void refreshAll(CORO_PARAM);
|
|
|
|
void refreshThumbnails(void);
|
2012-04-29 23:27:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Tony
|
|
|
|
|
|
|
|
#endif
|