2007-05-30 21:56:52 +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.
|
2005-04-05 15:53:16 +00:00
|
|
|
*
|
|
|
|
* 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
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2005-04-05 15:53:16 +00:00
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2005-04-09 19:19:54 +00:00
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-04-05 15:53:16 +00:00
|
|
|
*
|
2006-02-11 10:11:37 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2005-04-05 15:53:16 +00:00
|
|
|
*
|
|
|
|
*/
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2005-04-05 18:08:02 +00:00
|
|
|
#ifndef GOB_GAME_H
|
|
|
|
#define GOB_GAME_H
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2009-07-05 11:26:23 +00:00
|
|
|
#include "gob/util.h"
|
|
|
|
|
2005-04-05 15:07:40 +00:00
|
|
|
namespace Gob {
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
class Script;
|
2009-06-24 21:49:37 +00:00
|
|
|
class Resources;
|
2009-06-25 10:55:01 +00:00
|
|
|
class Variables;
|
2009-06-22 10:13:37 +00:00
|
|
|
|
2009-06-25 15:29:19 +00:00
|
|
|
class Environments {
|
|
|
|
public:
|
|
|
|
static const uint8 kEnvironmentCount = 5;
|
|
|
|
|
|
|
|
Environments(GobEngine *vm);
|
|
|
|
~Environments();
|
|
|
|
|
|
|
|
void set(uint8 env);
|
|
|
|
void get(uint8 env) const;
|
|
|
|
|
|
|
|
const char *getTotFile(uint8 env) const;
|
|
|
|
|
|
|
|
bool has(Variables *variables, uint8 startEnv = 0, int16 except = -1) const;
|
|
|
|
bool has(Script *script , uint8 startEnv = 0, int16 except = -1) const;
|
|
|
|
bool has(Resources *resources, uint8 startEnv = 0, int16 except = -1) const;
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct Environment {
|
|
|
|
int16 cursorHotspotX;
|
|
|
|
int16 cursorHotspotY;
|
|
|
|
char curTotFile[14];
|
|
|
|
Variables *variables;
|
|
|
|
Script *script;
|
|
|
|
Resources *resources;
|
|
|
|
};
|
|
|
|
|
|
|
|
GobEngine *_vm;
|
|
|
|
|
|
|
|
Environment *_environments;
|
|
|
|
};
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
class Game {
|
|
|
|
public:
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-07-23 16:13:26 +00:00
|
|
|
#include "common/pack-start.h" // START STRUCT PACKING
|
2006-07-09 13:01:15 +00:00
|
|
|
|
2006-01-29 02:27:10 +00:00
|
|
|
struct Collision {
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 id;
|
2007-05-01 14:49:13 +00:00
|
|
|
uint16 left;
|
|
|
|
uint16 top;
|
|
|
|
uint16 right;
|
|
|
|
uint16 bottom;
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 flags;
|
|
|
|
int16 key;
|
2007-02-07 13:08:17 +00:00
|
|
|
uint16 funcEnter;
|
|
|
|
uint16 funcLeave;
|
2007-03-20 14:51:57 +00:00
|
|
|
uint16 funcSub;
|
2009-06-22 10:15:52 +00:00
|
|
|
Script *script;
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-29 02:27:10 +00:00
|
|
|
struct InputDesc {
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 fontIndex;
|
|
|
|
int16 backColor;
|
|
|
|
int16 frontColor;
|
2007-04-02 11:05:09 +00:00
|
|
|
byte *ptr;
|
2007-07-01 18:18:43 +00:00
|
|
|
} PACKED_STRUCT;
|
2006-05-29 18:24:52 +00:00
|
|
|
|
2006-07-23 16:13:26 +00:00
|
|
|
#include "common/pack-end.h" // END STRUCT PACKING
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
Collision *_collisionAreas;
|
2006-05-01 12:43:50 +00:00
|
|
|
Collision *_collStack[5];
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
Script *_script;
|
2009-06-24 21:49:37 +00:00
|
|
|
Resources *_resources;
|
2009-06-22 10:13:37 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
char _curTotFile[14];
|
|
|
|
char _totToLoad[20];
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
int32 _startTimeKey;
|
2009-07-05 11:26:23 +00:00
|
|
|
MouseButtons _mouseButtons;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2007-04-16 05:04:41 +00:00
|
|
|
bool _noScroll;
|
2007-05-30 10:20:21 +00:00
|
|
|
bool _preventScroll;
|
2007-04-17 09:40:10 +00:00
|
|
|
bool _scrollHandleMouse;
|
2007-04-16 05:04:41 +00:00
|
|
|
|
2008-12-17 13:07:56 +00:00
|
|
|
bool _noCd;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
Game(GobEngine *vm);
|
2006-05-31 08:44:14 +00:00
|
|
|
virtual ~Game();
|
2006-01-03 23:14:39 +00:00
|
|
|
|
|
|
|
void capturePush(int16 left, int16 top, int16 width, int16 height);
|
|
|
|
void capturePop(char doDraw);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void freeSoundSlot(int16 slot);
|
|
|
|
|
2007-04-13 07:48:26 +00:00
|
|
|
void evaluateScroll(int16 x, int16 y);
|
|
|
|
|
2007-07-30 15:53:38 +00:00
|
|
|
int16 checkKeys(int16 *pMousex = 0, int16 *pMouseY = 0,
|
2009-07-05 11:26:23 +00:00
|
|
|
MouseButtons *pButtons = 0, char handleMouse = 0);
|
2006-01-03 23:14:39 +00:00
|
|
|
void start(void);
|
2008-12-15 00:27:05 +00:00
|
|
|
|
|
|
|
virtual void totSub(int8 flags, const char *newTotFile);
|
|
|
|
virtual void switchTotSub(int16 index, int16 skipPlay);
|
2006-05-29 18:24:52 +00:00
|
|
|
|
2007-07-26 01:01:00 +00:00
|
|
|
void freeCollision(int16 id);
|
|
|
|
|
2006-04-18 09:59:18 +00:00
|
|
|
virtual void playTot(int16 skipPlay) = 0;
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2006-04-18 09:59:18 +00:00
|
|
|
virtual void clearCollisions(void) = 0;
|
2007-05-01 14:49:13 +00:00
|
|
|
virtual int16 addNewCollision(int16 id, uint16 left, uint16 top,
|
|
|
|
uint16 right, uint16 bottom, int16 flags, int16 key,
|
2008-12-14 21:21:18 +00:00
|
|
|
uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0) = 0;
|
2006-06-29 12:55:57 +00:00
|
|
|
virtual void collisionsBlock(void) = 0;
|
|
|
|
virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos,
|
2008-12-29 00:03:09 +00:00
|
|
|
InputDesc *inpDesc, int16 *collResId,
|
|
|
|
int16 *collIndex, bool mono = true) = 0;
|
2006-11-19 17:52:52 +00:00
|
|
|
virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height,
|
|
|
|
int16 backColor, int16 frontColor, char *str, int16 fontIndex,
|
2008-12-29 00:03:09 +00:00
|
|
|
char inpType, int16 *pTotTime, int16 *collResId,
|
|
|
|
int16 *collIndex, bool mono = true) = 0;
|
2007-04-02 11:05:09 +00:00
|
|
|
virtual int16 checkCollisions(byte handleMouse, int16 deltaTime,
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 *pResId, int16 *pResIndex) = 0;
|
2006-05-01 12:43:50 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
virtual void prepareStart(void) = 0;
|
2006-05-29 18:24:52 +00:00
|
|
|
|
2008-12-13 16:35:14 +00:00
|
|
|
virtual void pushCollisions(char all) = 0;
|
|
|
|
virtual void popCollisions(void) = 0;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
protected:
|
2006-01-07 22:28:54 +00:00
|
|
|
int16 _lastCollKey;
|
|
|
|
int16 _lastCollAreaIndex;
|
|
|
|
int16 _lastCollId;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
int16 _activeCollResId;
|
|
|
|
int16 _activeCollIndex;
|
2007-04-02 11:05:09 +00:00
|
|
|
byte _handleMouse;
|
2006-01-07 22:28:54 +00:00
|
|
|
char _forceHandleMouse;
|
2007-04-09 18:29:51 +00:00
|
|
|
uint32 _menuLevel;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
char _tempStr[256];
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
int16 _collStackSize;
|
2006-05-01 12:43:50 +00:00
|
|
|
int16 _collStackElemSizes[5];
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
char _shouldPushColls;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
|
|
|
// Capture
|
2007-03-20 14:51:57 +00:00
|
|
|
Common::Rect _captureStack[20];
|
|
|
|
int16 _captureCount;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
char _collStr[256];
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
// For totSub()
|
2009-06-25 10:55:01 +00:00
|
|
|
int8 _curEnvironment;
|
|
|
|
int8 _numEnvironments;
|
2009-06-25 15:29:19 +00:00
|
|
|
Environments *_environments;
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
GobEngine *_vm;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-12-14 21:21:18 +00:00
|
|
|
virtual int16 adjustKey(int16 key);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2006-05-01 12:43:50 +00:00
|
|
|
void collAreaSub(int16 index, int8 enter);
|
|
|
|
|
2008-12-14 02:09:03 +00:00
|
|
|
virtual void setCollisions(byte arg_0 = 1);
|
|
|
|
virtual void collSub(uint16 offset);
|
|
|
|
|
2006-06-29 12:55:57 +00:00
|
|
|
virtual int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex) = 0;
|
2009-06-25 15:29:19 +00:00
|
|
|
|
|
|
|
void clearUnusedEnvironment();
|
2006-01-03 23:14:39 +00:00
|
|
|
};
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-04-18 09:59:18 +00:00
|
|
|
class Game_v1 : public Game {
|
|
|
|
public:
|
|
|
|
virtual void playTot(int16 skipPlay);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2006-04-18 09:59:18 +00:00
|
|
|
virtual void clearCollisions(void);
|
2007-05-01 14:49:13 +00:00
|
|
|
virtual int16 addNewCollision(int16 id, uint16 left, uint16 top,
|
|
|
|
uint16 right, uint16 bottom, int16 flags, int16 key,
|
2008-12-14 21:21:18 +00:00
|
|
|
uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0);
|
2006-06-29 12:55:57 +00:00
|
|
|
virtual void collisionsBlock(void);
|
|
|
|
virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos,
|
2008-12-29 00:03:09 +00:00
|
|
|
InputDesc *inpDesc, int16 *collResId,
|
|
|
|
int16 *collIndex, bool mono = true);
|
2006-11-19 17:52:52 +00:00
|
|
|
virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height,
|
|
|
|
int16 backColor, int16 frontColor, char *str, int16 fontIndex,
|
2008-12-29 00:03:09 +00:00
|
|
|
char inpType, int16 *pTotTime, int16 *collResId,
|
|
|
|
int16 *collIndex, bool mono = true);
|
2007-04-02 11:05:09 +00:00
|
|
|
virtual int16 checkCollisions(byte handleMouse, int16 deltaTime,
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 *pResId, int16 *pResIndex);
|
|
|
|
|
2006-05-01 12:43:50 +00:00
|
|
|
virtual void prepareStart(void);
|
2006-04-18 09:59:18 +00:00
|
|
|
|
2008-12-13 16:35:14 +00:00
|
|
|
virtual void pushCollisions(char all);
|
|
|
|
virtual void popCollisions(void);
|
|
|
|
|
2006-04-18 09:59:18 +00:00
|
|
|
Game_v1(GobEngine *vm);
|
2007-04-25 19:31:23 +00:00
|
|
|
virtual ~Game_v1() {}
|
2006-05-01 12:43:50 +00:00
|
|
|
|
|
|
|
protected:
|
2006-06-29 12:55:57 +00:00
|
|
|
virtual int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex);
|
2006-04-18 09:59:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Game_v2 : public Game_v1 {
|
|
|
|
public:
|
|
|
|
virtual void playTot(int16 skipPlay);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2006-04-18 09:59:18 +00:00
|
|
|
virtual void clearCollisions(void);
|
2007-05-01 14:49:13 +00:00
|
|
|
virtual int16 addNewCollision(int16 id, uint16 left, uint16 top,
|
|
|
|
uint16 right, uint16 bottom, int16 flags, int16 key,
|
2008-12-14 21:21:18 +00:00
|
|
|
uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0);
|
2006-06-29 12:55:57 +00:00
|
|
|
virtual void collisionsBlock(void);
|
|
|
|
virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos,
|
2008-12-29 00:03:09 +00:00
|
|
|
InputDesc *inpDesc, int16 *collResId,
|
|
|
|
int16 *collIndex, bool mono = true);
|
2006-11-19 17:52:52 +00:00
|
|
|
virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height,
|
|
|
|
int16 backColor, int16 frontColor, char *str, int16 fontIndex,
|
2008-12-29 00:03:09 +00:00
|
|
|
char inpType, int16 *pTotTime, int16 *collResId,
|
|
|
|
int16 *collIndex, bool mono = true);
|
2007-04-02 11:05:09 +00:00
|
|
|
virtual int16 checkCollisions(byte handleMouse, int16 deltaTime,
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 *pResId, int16 *pResIndex);
|
|
|
|
|
2006-05-01 12:43:50 +00:00
|
|
|
virtual void prepareStart(void);
|
2006-04-18 09:59:18 +00:00
|
|
|
|
2008-12-13 16:35:14 +00:00
|
|
|
virtual void pushCollisions(char all);
|
|
|
|
virtual void popCollisions(void);
|
|
|
|
|
2006-04-18 09:59:18 +00:00
|
|
|
Game_v2(GobEngine *vm);
|
2007-04-25 19:31:23 +00:00
|
|
|
virtual ~Game_v2() {}
|
2006-05-01 12:43:50 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
struct CollLast {
|
|
|
|
int16 key;
|
|
|
|
int16 id;
|
|
|
|
int16 areaIndex;
|
|
|
|
};
|
|
|
|
|
|
|
|
CollLast _collLasts[5];
|
|
|
|
|
2006-06-29 12:55:57 +00:00
|
|
|
virtual int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex);
|
2006-04-18 09:59:18 +00:00
|
|
|
};
|
|
|
|
|
2008-12-13 16:35:14 +00:00
|
|
|
class Game_v6 : public Game_v2 {
|
|
|
|
public:
|
2008-12-15 00:27:05 +00:00
|
|
|
virtual void totSub(int8 flags, const char *newTotFile);
|
|
|
|
|
2008-12-13 16:35:14 +00:00
|
|
|
virtual int16 addNewCollision(int16 id, uint16 left, uint16 top,
|
|
|
|
uint16 right, uint16 bottom, int16 flags, int16 key,
|
2008-12-14 21:21:18 +00:00
|
|
|
uint16 funcEnter, uint16 funcLeave, uint16 funcSub = 0);
|
2008-12-13 16:35:14 +00:00
|
|
|
|
2008-12-17 13:07:56 +00:00
|
|
|
virtual void prepareStart(void);
|
|
|
|
|
2008-12-13 16:35:14 +00:00
|
|
|
virtual void pushCollisions(char all);
|
|
|
|
|
2008-12-14 02:09:03 +00:00
|
|
|
virtual int16 checkCollisions(byte handleMouse, int16 deltaTime,
|
|
|
|
int16 *pResId, int16 *pResIndex);
|
2008-12-14 21:21:18 +00:00
|
|
|
virtual void collisionsBlock(void);
|
2008-12-14 02:09:03 +00:00
|
|
|
|
2008-12-13 16:35:14 +00:00
|
|
|
Game_v6(GobEngine *vm);
|
|
|
|
virtual ~Game_v6() {}
|
2008-12-14 02:09:03 +00:00
|
|
|
|
|
|
|
protected:
|
2009-04-27 18:56:28 +00:00
|
|
|
uint32 _someTimeDly;
|
2008-12-14 02:09:03 +00:00
|
|
|
|
|
|
|
virtual void setCollisions(byte arg_0 = 1);
|
|
|
|
virtual void collSub(uint16 offset);
|
|
|
|
|
2008-12-14 21:21:18 +00:00
|
|
|
virtual int16 adjustKey(int16 key);
|
|
|
|
|
2008-12-15 01:45:16 +00:00
|
|
|
virtual int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex);
|
|
|
|
|
2009-04-27 18:56:28 +00:00
|
|
|
void collSubReenter();
|
2008-12-13 16:35:14 +00:00
|
|
|
};
|
|
|
|
|
2009-04-29 16:36:08 +00:00
|
|
|
class Game_Fascination : public Game_v2 {
|
|
|
|
public:
|
|
|
|
virtual int16 checkCollisions(byte handleMouse, int16 deltaTime,
|
|
|
|
int16 *pResId, int16 *pResIndex);
|
|
|
|
|
|
|
|
Game_Fascination(GobEngine *vm);
|
|
|
|
virtual ~Game_Fascination() {}
|
|
|
|
};
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
} // End of namespace Gob
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
#endif // GOB_GAME_H
|