aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/kyra_v3.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra/kyra_v3.h')
-rw-r--r--engines/kyra/kyra_v3.h184
1 files changed, 154 insertions, 30 deletions
diff --git a/engines/kyra/kyra_v3.h b/engines/kyra/kyra_v3.h
index 6d476a066a..f9b5ea22b3 100644
--- a/engines/kyra/kyra_v3.h
+++ b/engines/kyra/kyra_v3.h
@@ -28,12 +28,14 @@
#include "kyra/kyra.h"
#include "kyra/screen_v3.h"
+#include "common/hashmap.h"
namespace Kyra {
class SoundDigital;
class Screen_v3;
class MainMenu;
+class WSAMovieV2;
class KyraEngine_v3 : public KyraEngine {
public:
@@ -52,9 +54,11 @@ private:
int init();
void preinit();
- void realInit();
+ void startup();
- void setupOpcodeTable() {}
+ void runStartupScript(int script, int unk1);
+
+ void setupOpcodeTable();
Screen_v3 *_screen;
SoundDigital *_soundDigital;
@@ -96,46 +100,166 @@ private:
// pathfinder
bool lineIsPassable(int, int) { return false; }
- // unknown
private:
- uint8 *_unkPage1;
- uint8 *_unkPage2;
-
- uint8 *_unkBuffer5;
- uint8 *_unkBuffer6;
- uint8 *_unkBuffer7;
- uint8 *_unkBuffer9;
-
- uint8 *_costpalData;
-
- uint8 *_unkWSAPtr;
-
- uint8 *_unkShapeTable[20];
-
// main menu
static const char *_mainMenuStrings[];
+ // animator
+ struct AnimObj {
+ uint16 index;
+ uint16 type;
+ bool enabled;
+ bool needRefresh;
+ uint16 unk8;
+ uint16 flags;
+ int16 xPos1, yPos1;
+ uint8 *shapePtr;
+ uint16 shapeIndex;
+ uint16 animNum;
+ uint16 shapeIndex3;
+ uint16 shapeIndex2;
+ int16 xPos2, yPos2;
+ int16 xPos3, yPos3;
+ int16 width, height;
+ int16 width2, height2;
+ AnimObj *nextObject;
+ };
+
+ AnimObj *_animObjects;
+ uint8 *_gamePlayBuffer;
+
+ void clearAnimObjects();
+
+ // interface
+ uint8 *_interface;
+ uint8 *_interfaceCommandLine;
+
+ void loadInterfaceShapes();
+ void loadInterface();
+
// translation stuff
uint8 *_scoreFile;
uint8 *_cCodeFile;
- uint8 *_scenesList;
-
- // interface?
- uint8 *_interfaceCPS1;
- uint8 *_interfaceCPS2;
-
- // shapes
- uint8 *_gameShapes[50];
-
- uint8 *_mouseSHPBuf;
+ uint8 *_scenesFile;
+ uint8 *_itemFile;
+ uint8 *_actorFile;
+ uint32 _actorFileSize;
// items
uint8 *_itemBuffer1;
uint8 *_itemBuffer2;
+
+ void initItems();
- uint8 *_itemList;
+ // shapes
+ typedef Common::HashMap<int, uint8*> ShapeMap;
+ ShapeMap _gameShapes;
+
+ void addShapeToPool(const uint8 *data, int realIndex, int shape);
+
+ void initMouseShapes();
+
+ int _malcolmShapes;
+ void loadMalcolmShapes(int newShapes);
+ void updateMalcolmShapes();
+
+ int _malcolmShapeXOffset, _malcolmShapeYOffset;
+
+ struct ShapeDesc {
+ uint8 width, height;
+ int8 xOffset, yOffset;
+ };
+ static const ShapeDesc _shapeDescs[];
+ static const int _shapeDescsSize;
+
+ // scene animation
+ struct SceneAnim {
+ uint16 flags;
+ int16 x, y;
+ int16 x2, y2;
+ int16 width, height;
+ uint16 unk10;
+ uint16 specialSize;
+ uint16 unk14;
+ uint16 shapeIndex;
+ uint16 wsaFlag;
+ char filename[13];
+ };
+
+ SceneAnim *_sceneAnims;
+ WSAMovieV2 *_sceneAnimMovie[16];
+ uint8 *_sceneShapes[20];
+
+ // voice
+ int _currentTalkFile;
+ void openTalkFile(int file);
+
+ // scene
+ struct SceneDesc {
+ char filename1[10];
+ char filename2[10];
+ uint16 exit1, exit2, exit3, exit4;
+ uint8 flags, sound;
+ };
+
+ SceneDesc *_sceneList;
+ uint16 _sceneExit1, _sceneExit2, _sceneExit3, _sceneExit4;
- void initItems();
+ // items
+ struct Item {
+ uint16 id;
+ uint16 sceneId;
+ int16 x, y;
+ uint16 unk8;
+ };
+
+ Item *_itemList;
+ uint16 _hiddenItems[100];
+
+ void resetItem(int index);
+ void resetItemList();
+
+ int findFreeItem();
+
+ // character
+ struct Character {
+ uint16 sceneId;
+ uint16 dlgIndex;
+ uint8 unk4;
+ uint8 facing;
+ uint16 animFrame;
+ //uint8 unk8, unk9;
+ uint32 walkspeed;
+ uint16 inventory[10];
+ int16 x1, y1;
+ int16 x2, y2;
+ int16 x3, y3;
+ };
+
+ Character _mainCharacter;
+
+ // unk
+ uint8 *_unkBuffer1040Bytes;
+ uint8 *_costPalBuffer;
+ uint8 *_screenBuffer;
+ uint8 *_gfxBackUpRect;
+ uint8 *_paletteOverlay;
+
+ void loadCostPal();
+ void loadShadowShape();
+ void loadExtrasShapes();
+
+ // opcodes
+ int o3_defineItem(ScriptState *script);
+ int o3_queryGameFlag(ScriptState *script);
+ int o3_resetGameFlag(ScriptState *script);
+ int o3_setGameFlag(ScriptState *script);
+ int o3_setSceneFilename(ScriptState *script);
+ int o3_getRand(ScriptState *script);
+ int o3_defineScene(ScriptState *script);
+ int o3_setHiddenItemsEntry(ScriptState *script);
+ int o3_getHiddenItemsEntry(ScriptState *script);
+ int o3_dummy(ScriptState *script);
// resource specific
private:
@@ -145,7 +269,7 @@ private:
int getMaxFileSize(const char *file);
char *appendLanguage(char *buf, int lang, int bufSize);
- bool loadLanguageFile(const char *file, uint8 *&buffer);
+ int loadLanguageFile(const char *file, uint8 *&buffer);
};
} // end of namespace Kyra