1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340
|
/* 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.
*
*/
/*
* This code is based on original Tony Tough source code
*
* Copyright (c) 1997-2003 Nayma Software
*/
#ifndef TONY_GAME_H
#define TONY_GAME_H
#include "tony/gfxcore.h"
#include "tony/input.h"
#include "tony/loc.h"
#include "tony/utils.h"
namespace Tony {
#define INIT_GFX16_FROMRAW(dwRes, buf16) \
raw = new RMResRaw(dwRes); \
assert(raw->isValid()); \
assert((buf16) == NULL); \
(buf16) = new RMGfxSourceBuffer16(false); \
(buf16)->init(*raw, raw->width(), raw->height()); \
delete raw;
#define INIT_GFX8_FROMRAW(raw, dwRes, buf8) \
raw = new RMResRaw(dwRes); \
assert(raw->isValid()); \
assert((buf8) == NULL); \
(buf8) = new RMGfxSourceBuffer8RLEByte(); \
(buf8)->init(*raw, raw->width(), raw->height(), true); \
delete raw;
// X & Y dimensions of the adventure
#define RM_SX 640
#define RM_SY 480
// X & Y dimensions of bigbuf
#define RM_BBX (RM_SX)
#define RM_BBY (RM_SY)
// Skipping X & Y
#define RM_SKIPY ((RM_BBY - RM_SY) / 2)
#define RM_SKIPX 0
// Tony's actions
enum RMTonyAction {
TA_GOTO = 0,
TA_TAKE,
TA_USE,
TA_EXAMINE,
TA_TALK,
TA_PERORATE,
TA_COMBINE = 10,
TA_RECEIVECOMBINE,
TA_COMBINEGIVE,
TA_RECEIVECOMBINEGIVE
};
// Global Functions
void mainEnableGUI();
void mainDisableGUI();
// Classes
class RMPointer {
public:
enum PointerType {
PTR_NONE = 0,
PTR_ARROWUP,
PTR_ARROWDOWN,
PTR_ARROWLEFT,
PTR_ARROWRIGHT,
PTR_ARROWMAP,
PTR_CUSTOM
};
private:
RMGfxSourceBuffer8 *_pointer[16];
RMPoint _hotspot[16];
RMPoint _cursorHotspot;
RMItem *_specialPointer[16];
int _nCurPointer;
int _nCurSpecialPointer;
RMGfxSourceBuffer8 *_nCurCustomPointer;
public:
/**
* Constructor & destructor
*/
RMPointer();
virtual ~RMPointer();
/**
* Initialization
*/
void init();
/**
* Deinitialization
*/
void close();
/**
* Process a frame
*/
void doFrame();
/**
* draw method
*/
void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim);
/**
* Sets a new action as current
*/
void setAction(RMTonyAction action);
/**
* Sets a new pointer
*/
void setSpecialPointer(PointerType ptr);
PointerType getSpecialPointer();
/**
* Set the new custom pointer
*/
void setCustomPointer(RMGfxSourceBuffer8 *ptr);
/**
* Return the current action to be applied according to the pointer
*/
int curAction();
/**
* Update the cursor
*/
void updateCursor();
/**
* Show the cursor
*/
void showCursor();
/**
* Hide the cursor
*/
void hideCursor();
};
class RMOptionButton: public RMGfxTaskSetPrior {
public:
RMRect _rect;
RMGfxSourceBuffer16 *_buf;
bool _bActive;
bool _bHasGfx;
bool _bDoubleState;
public:
RMOptionButton(uint32 dwRes, RMPoint pt, bool bDoubleState = false);
RMOptionButton(const RMRect &pt);
~RMOptionButton() override;
bool doFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick);
void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) override;
void addToList(RMGfxTargetBuffer &bigBuf);
bool isActive();
void setActiveState(bool bState);
};
class RMOptionSlide : public RMGfxTaskSetPrior {
private:
RMOptionButton *_pushLeft;
RMOptionButton *_pushRight;
RMGfxSourceBuffer16 *_sliderCenter;
RMGfxSourceBuffer16 *_sliderLeft;
RMGfxSourceBuffer16 *_sliderRight;
RMGfxSourceBuffer16 *_sliderSingle;
int _nSlideSize;
RMPoint _pos;
int _nValue;
int _nMax;
int _nStep;
public:
RMOptionSlide(const RMPoint &pt, int m_nRange = 100, int m_nStartValue = 0, int slideSize = 300);
~RMOptionSlide() override;
bool doFrame(const RMPoint &mousePos, bool bLeftClick, bool bRightClick);
void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) override;
void addToList(RMGfxTargetBuffer &bigBuf);
int getValue();
};
class RMOptionScreen : public RMGfxWoodyBuffer {
private:
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];
Common::String _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];
union {
RMOptionButton *_buttonGame_Lock;
RMOptionButton *_buttonGfx_Anni30;
RMOptionSlide *_sliderSound_Music;
};
union {
RMOptionButton *_buttonGame_TimerizedText;
RMOptionButton *_buttonGfx_AntiAlias;
RMOptionSlide *_sliderSound_SFX;
};
union {
RMOptionButton *_buttonGame_Scrolling;
RMOptionButton *_buttonGfx_Sottotitoli;
RMOptionSlide *_sliderSound_Dubbing;
};
union {
RMOptionButton *_buttonGame_InterUp;
RMOptionButton *_buttonGfx_Trans;
};
int _fadeStep;
bool _bExit;
bool _bQuitConfirm;
int _fadeY;
int _fadeTime;
bool _bLoadMenuOnly;
bool _bNoLoadSave;
bool _bAlterGfx;
enum OptionScreenState {
MENUGAME,
MENUGFX,
MENUSOUND,
MENULOAD,
MENUSAVE,
MENUNONE
};
OptionScreenState _nState;
OptionScreenState _nLastState;
public:
RMOptionScreen();
~RMOptionScreen() override;
using RMGfxWoodyBuffer::init;
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();
// Overloaded methods
int priority() override;
void draw(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMGfxPrimitive *prim) override;
void removeThis(CORO_PARAM, bool &result) override;
/**
* Polling for the option screen
*/
void doFrame(CORO_PARAM, RMInput *m_input);
/**
* Retrieves a savegame's thumbnail, description, and difficulty level
*/
static bool loadThumbnailFromSaveState(int numState, byte *lpDestBuf, Common::String &name, byte &diff);
protected:
// Initialization and state change
void initState(CORO_PARAM);
void closeState();
void changeState(CORO_PARAM, OptionScreenState newState);
// Repaint the options menu
void refreshAll(CORO_PARAM);
void refreshThumbnails();
};
} // End of namespace Tony
#endif
|