aboutsummaryrefslogtreecommitdiff
path: root/gob/game.h
diff options
context:
space:
mode:
Diffstat (limited to 'gob/game.h')
-rw-r--r--gob/game.h269
1 files changed, 146 insertions, 123 deletions
diff --git a/gob/game.h b/gob/game.h
index 6f98b23da6..bc126463a1 100644
--- a/gob/game.h
+++ b/gob/game.h
@@ -26,139 +26,162 @@
namespace Gob {
-#pragma START_PACK_STRUCTS
-#define szGame_ExtItem (4 + 2 + 2 + 2)
-typedef struct Game_ExtItem {
- int32 offset; // offset from the table end
- uint16 size;
- int16 width; // width&0x7fff - width, width&0x8000 - pack flag
- int16 height; // not zero
-} GCC_PACK Game_ExtItem;
-
-#define szGame_ExtTable (2 + 1)
-typedef struct Game_ExtTable {
- int16 itemsCount;
- byte unknown;
- Game_ExtItem items[1];
-} GCC_PACK Game_ExtTable;
+class Game {
+public:
+#pragma START_PACK_STRUCTS
#define szGame_TotResItem (4 + 2 + 2 + 2)
-typedef struct Game_TotResItem {
- int32 offset; // if > 0, then offset from end of resource table.
- // If < 0, then -offset-1 is index in .IM file table
- int16 size;
- int16 width;
- int16 height;
-} GCC_PACK Game_TotResItem;
+ typedef struct Collision {
+ int16 id;
+ int16 left;
+ int16 top;
+ int16 right;
+ int16 bottom;
+ int16 flags;
+ int16 key;
+ int16 funcEnter;
+ int16 funcLeave;
+ } GCC_PACK Collision;
+
+ typedef struct TotResItem {
+ int32 offset; // if > 0, then offset from end of resource table.
+ // If < 0, then -offset-1 is index in .IM file table
+ int16 size;
+ int16 width;
+ int16 height;
+ } GCC_PACK TotResItem;
#define szGame_TotResTable (2 + 1)
-typedef struct Game_TotResTable {
- int16 itemsCount;
- byte unknown;
- Game_TotResItem items[1];
-} GCC_PACK Game_TotResTable;
+ typedef struct TotResTable {
+ int16 itemsCount;
+ byte unknown;
+ TotResItem items[1];
+ } GCC_PACK TotResTable;
+
+#define szGame_ExtItem (4 + 2 + 2 + 2)
+ typedef struct ExtItem {
+ int32 offset; // offset from the table end
+ uint16 size;
+ int16 width; // width&0x7fff - width, width&0x8000 - pack flag
+ int16 height; // not zero
+ } GCC_PACK ExtItem;
+
+#define szGame_ExtTable (2 + 1)
+ typedef struct ExtTable {
+ int16 itemsCount;
+ byte unknown;
+ ExtItem items[1];
+ } GCC_PACK ExtTable;
#define szGame_TotTextItem (2 + 2)
-typedef struct Game_TotTextItem {
- int16 offset;
- int16 size;
-} GCC_PACK Game_TotTextItem;
+ typedef struct TotTextItem {
+ int16 offset;
+ int16 size;
+ } GCC_PACK TotTextItem;
#define szGame_TotTextTable (2)
-typedef struct Game_TotTextTable {
- int16 itemsCount;
- Game_TotTextItem items[1];
-} GCC_PACK Game_TotTextTable;
-
-typedef struct Game_Collision {
- int16 id;
- int16 left;
- int16 top;
- int16 right;
- int16 bottom;
- int16 flags;
- int16 key;
- int16 funcEnter;
- int16 funcLeave;
-} GCC_PACK Game_Collision;
-
-typedef struct Game_InputDesc {
- int16 fontIndex;
- int16 backColor;
- int16 frontColor;
- char *ptr;
-} GCC_PACK Game_InputDesc;
+ typedef struct TotTextTable {
+ int16 itemsCount;
+ TotTextItem items[1];
+ } GCC_PACK TotTextTable;
+
+ typedef struct InputDesc {
+ int16 fontIndex;
+ int16 backColor;
+ int16 frontColor;
+ char *ptr;
+ } GCC_PACK InputDesc;
#pragma END_PACK_STRUCTS
-extern Game_Collision *game_collisionAreas;
-
-extern int16 game_lastCollKey;
-extern int16 game_lastCollAreaIndex;
-extern int16 game_lastCollId;
-
-extern int16 game_activeCollResId;
-extern int16 game_activeCollIndex;
-extern char game_handleMouse;
-extern char game_forceHandleMouse;
-
-extern char game_tempStr[256];
-
-extern Game_ExtTable *game_extTable;
-extern char *game_totFileData;
-extern Game_TotTextTable *game_totTextData;
-extern Game_TotResTable *game_totResourceTable;
-extern char *game_imFileData;
-extern int16 game_extHandle;
-extern char game_curExtFile[14];
-extern char game_curTotFile[14];
-extern char game_curImaFile[18];
-
-extern int16 game_collStackSize;
-extern Game_Collision *game_collStack[3];
-extern int16 game_collStackElemSizes[3];
-
-extern int16 game_mouseButtons;
-
-extern Snd_SoundDesc *game_soundSamples[20];
-
-extern char game_soundFromExt[20];
-extern char game_totToLoad[20];
-
-extern int32 game_startTimeKey;
-extern char game_shouldPushColls;
-
-// Functions
-
-char *game_loadExtData(int16 dataId, int16 *pResWidth, int16 *pResHeight);
-void game_clearCollisions(void);
-void game_addNewCollision(int16 val_0, int16 left, int16 top, int16 right, int16 bottom,
- int16 flags, int16 key, int16 val_E, int16 val_10);
-void game_freeCollision(int16 id);
-char *game_loadTotResource(int16 id);
-void game_capturePush(int16 left, int16 top, int16 width, int16 height);
-
-void game_capturePush(int16 left, int16 top, int16 width, int16 height);
-void game_capturePop(char doDraw);
-
-void game_loadSound(int16 slot, char *dataPtr);
-void game_interLoadSound(int16 slot);
-void game_freeSoundSlot(int16 slot);
-int16 game_checkKeys(int16 *pMousex, int16 *pMouseY, int16 *pButtons,
- char handleMouse);
-int16 game_checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId,
- int16 *pResIndex);
-int16 game_inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 backColor,
- int16 frontColor, char *str, int16 fontIndex, char inpType, int16 *pTotTime);
-int16 game_multiEdit(int16 time, int16 index, int16 *pCurPos,
- Game_InputDesc * inpDesc);
-int16 game_adjustKey(int16 key);
-void game_collisionsBlock(void);
-void game_prepareStart(void);
-void game_loadTotFile(char *path);
-void game_loadExtTable(void);
-void game_loadImFile(void);
-void game_playTot(int16 skipPlay);
-void game_start(void);
+ TotResTable *totResourceTable;
+ Collision *collisionAreas;
+ Collision *collStack[3];
+
+ TotTextTable *totTextData;
+
+ char curTotFile[14];
+ char curExtFile[14];
+
+ char *imFileData;
+ char *totFileData;
+
+ int16 extHandle;
+
+ Snd::SoundDesc *soundSamples[20];
+
+ char totToLoad[20];
+
+ int32 startTimeKey;
+ int16 mouseButtons;
+
+ Game(GobEngine *vm);
+
+ char *loadExtData(int16 dataId, int16 *pResWidth, int16 *pResHeight);
+ char *loadTotResource(int16 id);
+
+ void capturePush(int16 left, int16 top, int16 width, int16 height);
+
+ void capturePop(char doDraw);
+ void interLoadSound(int16 slot);
+ void freeSoundSlot(int16 slot);
+ int16 checkKeys(int16 *pMousex, int16 *pMouseY, int16 *pButtons,
+ char handleMouse);
+ int16 checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId,
+ int16 *pResIndex);
+ void clearCollisions(void);
+ void addNewCollision(int16 val_0, int16 left, int16 top, int16 right, int16 bottom,
+ int16 flags, int16 key, int16 val_E, int16 val_10);
+ void freeCollision(int16 id);
+
+ void loadSound(int16 slot, char *dataPtr);
+ int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 backColor,
+ int16 frontColor, char *str, int16 fontIndex, char inpType, int16 *pTotTime);
+ int16 multiEdit(int16 time, int16 index, int16 *pCurPos,
+ InputDesc * inpDesc);
+ int16 adjustKey(int16 key);
+ void collisionsBlock(void);
+ void prepareStart(void);
+ void loadTotFile(char *path);
+ void loadExtTable(void);
+ void loadImFile(void);
+ void playTot(int16 skipPlay);
+ void start(void);
+
+protected:
+
+ int16 lastCollKey;
+ int16 lastCollAreaIndex;
+ int16 lastCollId;
+
+ int16 activeCollResId;
+ int16 activeCollIndex;
+ char ghandleMouse;
+ char forceHandleMouse;
+
+ char tempStr[256];
+
+ ExtTable *extTable;
+ char curImaFile[18];
+
+ int16 collStackSize;
+ int16 collStackElemSizes[3];
+
+ char soundFromExt[20];
+
+ char shouldPushColls;
+
+ // Capture
+ static Common::Rect captureStack[20];
+ static int16 captureCount;
+
+ char collStr[256];
+
+ GobEngine *_vm;
+
+ void pushCollisions(char all);
+ void popCollisions(void);
+ int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex);
+};
} // End of namespace Gob