2005-04-05 15:53:16 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2004 Ivan Dubrov
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2004-2006 The ScummVM project
|
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
|
|
|
|
* 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
|
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
|
|
|
|
2007-01-25 15:17:46 +00:00
|
|
|
#include "sound/mods/infogrames.h"
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2005-04-05 15:07:40 +00:00
|
|
|
#include "gob/sound.h"
|
|
|
|
|
|
|
|
namespace Gob {
|
|
|
|
|
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;
|
2006-07-21 21:25:17 +00:00
|
|
|
};
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-04-18 09:59:18 +00:00
|
|
|
#define szGame_TotResItem (4 + 2 + 2 + 2)
|
2006-01-29 02:27:10 +00:00
|
|
|
struct TotResItem {
|
2006-01-03 23:14:39 +00:00
|
|
|
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;
|
2006-07-21 21:25:17 +00:00
|
|
|
};
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
#define szGame_TotResTable (2 + 1)
|
2006-01-29 02:27:10 +00:00
|
|
|
struct TotResTable {
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 itemsCount;
|
|
|
|
byte unknown;
|
2006-06-13 08:10:54 +00:00
|
|
|
TotResItem *items;
|
2007-04-02 11:05:09 +00:00
|
|
|
byte *dataPtr;
|
2006-07-21 21:25:17 +00:00
|
|
|
};
|
2006-01-03 23:14:39 +00:00
|
|
|
|
|
|
|
#define szGame_ExtItem (4 + 2 + 2 + 2)
|
2006-01-29 02:27:10 +00:00
|
|
|
struct ExtItem {
|
2006-01-03 23:14:39 +00:00
|
|
|
int32 offset; // offset from the table end
|
|
|
|
uint16 size;
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 width; // width & 0x7FFF: width, width & 0x8000: pack flag
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 height; // not zero
|
2006-07-21 21:25:17 +00:00
|
|
|
};
|
2006-01-03 23:14:39 +00:00
|
|
|
|
|
|
|
#define szGame_ExtTable (2 + 1)
|
2006-01-29 02:27:10 +00:00
|
|
|
struct ExtTable {
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 itemsCount;
|
|
|
|
byte unknown;
|
2006-01-29 02:27:10 +00:00
|
|
|
ExtItem* items;
|
2006-07-21 21:25:17 +00:00
|
|
|
};
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
#define szGame_TotTextItem (2 + 2)
|
2006-01-29 02:27:10 +00:00
|
|
|
struct TotTextItem {
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 offset;
|
|
|
|
int16 size;
|
2006-07-21 21:25:17 +00:00
|
|
|
};
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
#define szGame_TotTextTable (2)
|
2006-01-29 02:27:10 +00:00
|
|
|
struct TotTextTable {
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 itemsCount;
|
2006-06-13 08:10:54 +00:00
|
|
|
TotTextItem *items;
|
2007-04-02 11:05:09 +00:00
|
|
|
byte *dataPtr;
|
2006-07-21 21:25:17 +00:00
|
|
|
};
|
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;
|
2006-07-21 21:25:17 +00:00
|
|
|
};
|
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
|
|
|
TotResTable *_totResourceTable;
|
|
|
|
Collision *_collisionAreas;
|
2006-05-01 12:43:50 +00:00
|
|
|
Collision *_collStack[5];
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2007-02-12 14:37:27 +00:00
|
|
|
bool _foundTotLoc;
|
2006-01-07 22:28:54 +00:00
|
|
|
TotTextTable *_totTextData;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
char _curTotFile[14];
|
|
|
|
char _curExtFile[14];
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2007-04-02 11:05:09 +00:00
|
|
|
byte *_imFileData;
|
|
|
|
byte *_totFileData;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
int16 _extHandle;
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
SoundDesc _soundSamples[60];
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2007-01-25 15:17:46 +00:00
|
|
|
Audio::Infogrames::Instruments *_infIns;
|
|
|
|
Audio::Infogrames *_infogrames;
|
2007-01-25 14:18:12 +00:00
|
|
|
Audio::SoundHandle _infHandle;
|
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
char _totToLoad[20];
|
2006-01-03 23:14:39 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
int32 _startTimeKey;
|
|
|
|
int16 _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
|
|
|
|
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
|
|
|
|
2007-04-02 11:05:09 +00:00
|
|
|
byte *loadExtData(int16 dataId, int16 *pResWidth, int16 *pResHeight, uint32 *dataSize = 0);
|
|
|
|
byte *loadTotResource(int16 id, int16 *dataSize = 0);
|
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-02-05 14:08:50 +00:00
|
|
|
int16 checkKeys(int16 *pMousex, int16 *pMouseY, int16 *pButtons, char handleMouse);
|
2006-01-03 23:14:39 +00:00
|
|
|
void start(void);
|
2007-04-02 11:05:09 +00:00
|
|
|
void totSub(int8 flags, const char *newTotFile);
|
2006-05-11 19:43:30 +00:00
|
|
|
void switchTotSub(int16 index, int16 skipPlay);
|
2006-05-29 18:24:52 +00:00
|
|
|
|
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,
|
|
|
|
uint16 funcEnter, uint16 funcLeave) = 0;
|
2006-06-29 12:55:57 +00:00
|
|
|
virtual void collisionsBlock(void) = 0;
|
|
|
|
virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos,
|
2007-03-20 14:51:57 +00:00
|
|
|
InputDesc *inpDesc, int16 *collResId, int16 *collIndex) = 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,
|
|
|
|
char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex) = 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
|
|
|
|
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
|
|
|
ExtTable *_extTable;
|
|
|
|
char _curImaFile[18];
|
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()
|
|
|
|
int8 _backupedCount;
|
|
|
|
int8 _curBackupPos;
|
2007-04-02 11:05:09 +00:00
|
|
|
int16 _cursorHotspotXArray[5];
|
|
|
|
int16 _cursorHotspotYArray[5];
|
2007-03-20 14:51:57 +00:00
|
|
|
TotTextTable *_totTextDataArray[5];
|
2007-04-02 11:05:09 +00:00
|
|
|
byte *_totFileDataArray[5];
|
2007-03-20 14:51:57 +00:00
|
|
|
TotResTable *_totResourceTableArray[5];
|
|
|
|
ExtTable *_extTableArray[5];
|
|
|
|
int16 _extHandleArray[5];
|
2007-04-02 11:05:09 +00:00
|
|
|
byte *_imFileDataArray[5];
|
|
|
|
byte *_variablesArray[5];
|
2007-03-20 14:51:57 +00:00
|
|
|
char _curTotFileArray[5][14];
|
|
|
|
byte *_variablesSizesArray[5];
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
GobEngine *_vm;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 adjustKey(int16 key);
|
|
|
|
|
2007-04-02 11:05:09 +00:00
|
|
|
byte *loadLocTexts(void);
|
|
|
|
int32 loadTotFile(const char *path);
|
2007-03-20 14:51:57 +00:00
|
|
|
void loadExtTable(void);
|
|
|
|
void loadImFile(void);
|
|
|
|
|
2006-05-01 12:43:50 +00:00
|
|
|
void setCollisions(void);
|
2007-03-20 14:51:57 +00:00
|
|
|
void freeCollision(int16 id);
|
2007-02-07 13:08:17 +00:00
|
|
|
void collSub(uint16 offset);
|
2006-05-01 12:43:50 +00:00
|
|
|
void collAreaSub(int16 index, int8 enter);
|
|
|
|
int16 openLocTextFile(char *locTextFile, int language);
|
|
|
|
|
|
|
|
virtual void pushCollisions(char all) = 0;
|
|
|
|
virtual void popCollisions(void) = 0;
|
2006-06-29 12:55:57 +00:00
|
|
|
virtual int16 checkMousePoint(int16 all, int16 *resId, int16 *resIndex) = 0;
|
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,
|
|
|
|
uint16 funcEnter, uint16 funcLeave);
|
2006-06-29 12:55:57 +00:00
|
|
|
virtual void collisionsBlock(void);
|
|
|
|
virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos,
|
2007-03-20 14:51:57 +00:00
|
|
|
InputDesc *inpDesc, int16 *collResId, int16 *collIndex);
|
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,
|
|
|
|
char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex);
|
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
|
|
|
|
|
|
|
Game_v1(GobEngine *vm);
|
2007-04-25 19:31:23 +00:00
|
|
|
virtual ~Game_v1() {}
|
2006-05-01 12:43:50 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void pushCollisions(char all);
|
|
|
|
virtual void popCollisions(void);
|
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,
|
|
|
|
uint16 funcEnter, uint16 funcLeave);
|
2006-06-29 12:55:57 +00:00
|
|
|
virtual void collisionsBlock(void);
|
|
|
|
virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos,
|
2007-03-20 14:51:57 +00:00
|
|
|
InputDesc *inpDesc, int16 *collResId, int16 *collIndex);
|
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,
|
|
|
|
char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex);
|
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
|
|
|
|
|
|
|
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];
|
|
|
|
|
|
|
|
virtual void pushCollisions(char all);
|
|
|
|
virtual void popCollisions(void);
|
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
|
|
|
};
|
|
|
|
|
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
|