aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
authorSven Hesse2007-02-05 14:08:50 +0000
committerSven Hesse2007-02-05 14:08:50 +0000
commit7f26069f6924b0d450b6592755ba6ab40d507a9c (patch)
tree856d6bfc6b2d7fdd71f74d215b21d814959a8276 /engines/gob
parent710105d1c1ab5ec00477dc098ac9bb8f09c6b13c (diff)
downloadscummvm-rg350-7f26069f6924b0d450b6592755ba6ab40d507a9c.tar.gz
scummvm-rg350-7f26069f6924b0d450b6592755ba6ab40d507a9c.tar.bz2
scummvm-rg350-7f26069f6924b0d450b6592755ba6ab40d507a9c.zip
- Moved struct Mult_Data from Mult_v2 to Mult and merged Mult::_multData, Mult::_multData2 and some of the loose variables in Mult
- Added some missing MD5s/game versions (#1652352) svn-id: r25393
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/detection.cpp74
-rw-r--r--engines/gob/game.cpp31
-rw-r--r--engines/gob/game.h7
-rw-r--r--engines/gob/game_v1.cpp30
-rw-r--r--engines/gob/game_v2.cpp30
-rw-r--r--engines/gob/inter_v2.cpp4
-rw-r--r--engines/gob/mult.cpp39
-rw-r--r--engines/gob/mult.h151
-rw-r--r--engines/gob/mult_v1.cpp294
-rw-r--r--engines/gob/mult_v2.cpp528
10 files changed, 575 insertions, 613 deletions
diff --git a/engines/gob/detection.cpp b/engines/gob/detection.cpp
index e65416cc61..1ac2e69d7d 100644
--- a/engines/gob/detection.cpp
+++ b/engines/gob/detection.cpp
@@ -151,6 +151,17 @@ static const GOBGameDescription gameDescriptions[] = {
"gob1cd",
"v1.02",
AD_ENTRY1("intro.stk", "8bd873137b6831c896ee8ad217a6a398"),
+ DE_DEU,
+ kPlatformPC,
+ },
+ GF_GOB1 | GF_CD,
+ "intro"
+ },
+ { // CD 1.02 version. Multilingual
+ {
+ "gob1cd",
+ "v1.02",
+ AD_ENTRY1("intro.stk", "8bd873137b6831c896ee8ad217a6a398"),
FR_FRA,
kPlatformPC,
},
@@ -201,12 +212,56 @@ static const GOBGameDescription gameDescriptions[] = {
GF_GOB1,
"intro"
},
- {
+ { // Supplied by paul66 in bug report #1652352
{
"gob1",
"",
AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
- UNK_LANG,
+ EN_ANY,
+ kPlatformMacintosh,
+ },
+ GF_GOB1,
+ "intro"
+ },
+ { // Supplied by paul66 in bug report #1652352
+ {
+ "gob1",
+ "",
+ AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
+ DE_DEU,
+ kPlatformMacintosh,
+ },
+ GF_GOB1,
+ "intro"
+ },
+ { // Supplied by paul66 in bug report #1652352
+ {
+ "gob1",
+ "",
+ AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
+ FR_FRA,
+ kPlatformMacintosh,
+ },
+ GF_GOB1,
+ "intro"
+ },
+ { // Supplied by paul66 in bug report #1652352
+ {
+ "gob1",
+ "",
+ AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
+ IT_ITA,
+ kPlatformMacintosh,
+ },
+ GF_GOB1,
+ "intro"
+ },
+ { // Supplied by paul66 in bug report #1652352
+ {
+ "gob1",
+ "",
+ AD_ENTRY1("intro.stk", "00a42a7d2d22e6b6ab1b8c673c4ed267"),
+ ES_ESP,
kPlatformMacintosh,
},
GF_GOB1,
@@ -487,6 +542,17 @@ static const GOBGameDescription gameDescriptions[] = {
GF_GOB2,
"intro"
},
+ { // Supplied by paul66 in bug report #1652352
+ {
+ "gob3",
+ "",
+ AD_ENTRY1("intro.stk", "f6d225b25a180606fa5dbe6405c97380"),
+ DE_DEU,
+ kPlatformPC,
+ },
+ GF_GOB2,
+ "intro"
+ },
{
{
"gob3",
@@ -542,12 +608,12 @@ static const GOBGameDescription gameDescriptions[] = {
GF_GOB2,
"intro"
},
- {
+ { // Supplied by paul66 in bug report #1652352
{
"gob3cd",
"v1.02",
AD_ENTRY1("intro.stk", "c3e9132ea9dc0fb866b6d60dcda10261"),
- UNK_LANG,
+ DE_DEU,
kPlatformPC,
},
GF_GOB2,
diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp
index 3d4d01d46d..87e1eef48b 100644
--- a/engines/gob/game.cpp
+++ b/engines/gob/game.cpp
@@ -377,6 +377,37 @@ void Game::freeSoundSlot(int16 slot) {
_soundSamples[slot] = 0;
}
+int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY, int16 *pButtons, char handleMouse) {
+ _vm->_util->processInput();
+
+ if (_vm->_mult->_multData && (_vm->_global->_inter_variables != 0) &&
+ (VAR(58) != 0)) {
+ if (_vm->_mult->_multData->frameStart != (int)VAR(58) - 1)
+ _vm->_mult->_multData->frameStart++;
+ else
+ _vm->_mult->_multData->frameStart = 0;
+
+ _vm->_mult->playMult(_vm->_mult->_multData->frameStart + VAR(57),
+ _vm->_mult->_multData->frameStart + VAR(57), 1, handleMouse);
+ }
+
+ if (_vm->_inter->_soundEndTimeKey != 0
+ && _vm->_util->getTimeKey() >= _vm->_inter->_soundEndTimeKey) {
+ _vm->_snd->stopSound(_vm->_inter->_soundStopVal);
+ _vm->_inter->_soundEndTimeKey = 0;
+ }
+
+ if (_vm->_global->_useMouse == 0)
+ error("checkKeys: Can't work without mouse!");
+
+ _vm->_util->getMouseState(pMouseX, pMouseY, pButtons);
+
+ if (*pButtons == 3)
+ *pButtons = 0;
+
+ return _vm->_util->checkKey();
+}
+
int16 Game::adjustKey(int16 key) {
if (key <= 0x60 || key >= 0x7b)
return key;
diff --git a/engines/gob/game.h b/engines/gob/game.h
index e29d2d4f5a..70a5807f4e 100644
--- a/engines/gob/game.h
+++ b/engines/gob/game.h
@@ -202,6 +202,7 @@ public:
void freeCollision(int16 id);
void loadSound(int16 slot, char *dataPtr, uint32 dataSize = 4294967295U);
+ int16 checkKeys(int16 *pMousex, int16 *pMouseY, int16 *pButtons, char handleMouse);
int16 adjustKey(int16 key);
int32 loadTotFile(char *path);
void loadExtTable(void);
@@ -236,8 +237,6 @@ public:
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;
- virtual int16 checkKeys(int16 *pMousex, int16 *pMouseY, int16 *pButtons,
- char handleMouse) = 0;
virtual int16 checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId,
int16 *pResIndex) = 0;
virtual void prepareStart(void) = 0;
@@ -296,8 +295,6 @@ public:
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);
- virtual int16 checkKeys(int16 *pMousex, int16 *pMouseY, int16 *pButtons,
- char handleMouse);
virtual int16 checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId,
int16 *pResIndex);
virtual void prepareStart(void);
@@ -323,8 +320,6 @@ public:
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);
- virtual int16 checkKeys(int16 *pMousex, int16 *pMouseY, int16 *pButtons,
- char handleMouse);
virtual int16 checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId,
int16 *pResIndex);
virtual void prepareStart(void);
diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp
index a25e02244f..2ae9406c26 100644
--- a/engines/gob/game_v1.cpp
+++ b/engines/gob/game_v1.cpp
@@ -335,36 +335,6 @@ void Game_v1::popCollisions(void) {
delete[] _collStack[_collStackSize];
}
-int16 Game_v1::checkKeys(int16 *pMouseX, int16 *pMouseY, int16 *pButtons, char handleMouse) {
- _vm->_util->processInput();
-
- if (VAR(58) != 0) {
- if (_vm->_mult->_frameStart != (int)VAR(58) - 1)
- _vm->_mult->_frameStart++;
- else
- _vm->_mult->_frameStart = 0;
-
- _vm->_mult->playMult(_vm->_mult->_frameStart + VAR(57), _vm->_mult->_frameStart + VAR(57), 1,
- handleMouse);
- }
-
- if (_vm->_inter->_soundEndTimeKey != 0
- && _vm->_util->getTimeKey() >= _vm->_inter->_soundEndTimeKey) {
- _vm->_snd->stopSound(_vm->_inter->_soundStopVal);
- _vm->_inter->_soundEndTimeKey = 0;
- }
-
- if (_vm->_global->_useMouse == 0)
- error("checkKeys: Can't work without mouse!");
-
- _vm->_util->getMouseState(pMouseX, pMouseY, pButtons);
-
- if (*pButtons == 3)
- *pButtons = 0;
-
- return _vm->_util->checkKey();
-}
-
int16 Game_v1::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId,
int16 *pResIndex) {
char *savedIP;
diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp
index fef153a5c6..1b6cd1f123 100644
--- a/engines/gob/game_v2.cpp
+++ b/engines/gob/game_v2.cpp
@@ -402,36 +402,6 @@ void Game_v2::popCollisions(void) {
delete[] _collStack[_collStackSize];
}
-int16 Game_v2::checkKeys(int16 *pMouseX, int16 *pMouseY, int16 *pButtons, char handleMouse) {
- _vm->_util->processInput();
-
- if ((_vm->_global->_inter_variables != 0) && (VAR(58) != 0)) {
- if (_vm->_mult->_frameStart != (int)VAR(58) - 1)
- _vm->_mult->_frameStart++;
- else
- _vm->_mult->_frameStart = 0;
-
- _vm->_mult->playMult(_vm->_mult->_frameStart + VAR(57),
- _vm->_mult->_frameStart + VAR(57), 1, handleMouse);
- }
-
- if (_vm->_inter->_soundEndTimeKey != 0
- && _vm->_util->getTimeKey() >= _vm->_inter->_soundEndTimeKey) {
- _vm->_snd->stopSound(_vm->_inter->_soundStopVal);
- _vm->_inter->_soundEndTimeKey = 0;
- }
-
- if (_vm->_global->_useMouse == 0)
- error("checkKeys: Can't work without mouse!");
-
- _vm->_util->getMouseState(pMouseX, pMouseY, pButtons);
-
- if (*pButtons == 3)
- *pButtons = 0;
-
- return _vm->_util->checkKey();
-}
-
int16 Game_v2::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId,
int16 *pResIndex) {
int16 resIndex;
diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp
index b0efea4ea3..a262680f8f 100644
--- a/engines/gob/inter_v2.cpp
+++ b/engines/gob/inter_v2.cpp
@@ -1869,8 +1869,6 @@ void Inter_v2::o2_initMult(void) {
if (_vm->_mult->_objects == 0) {
_vm->_mult->_renderData2 = new Mult::Mult_Object*[_vm->_mult->_objCount];
memset(_vm->_mult->_renderData2, 0, _vm->_mult->_objCount * sizeof(Mult::Mult_Object*));
-/* _vm->_mult->_renderData = new int16[_vm->_mult->_objCount * 9];
- memset(_vm->_mult->_renderData, 0, _vm->_mult->_objCount * 9 * sizeof(int16));*/
if (_vm->_inter->_terminate)
return;
_vm->_mult->_orderArray = new int8[_vm->_mult->_objCount];
@@ -1881,8 +1879,6 @@ void Inter_v2::o2_initMult(void) {
for (i = 0; i < _vm->_mult->_objCount; i++) {
_vm->_mult->_objects[i].pPosX = (int32 *)(_vm->_global->_inter_variables + i * 4 + (posXVar / 4) * 4);
_vm->_mult->_objects[i].pPosY = (int32 *)(_vm->_global->_inter_variables + i * 4 + (posYVar / 4) * 4);
-// if ((i == 0) || (i == 1))
-// warning("=> Goblin %d: %d %d %d %d %d (%d) (%d)", i, i * 4 + (posXVar / 4) * 4, i + (posXVar / 4), i * 4 + (posYVar / 4) * 4, i + (posYVar / 4), animDataVar + i * 4 * _vm->_global->_inter_animDataSize, (animDataVar + i * 4 * _vm->_global->_inter_animDataSize) / 4, _vm->_global->_inter_animDataSize);
_vm->_mult->_objects[i].pAnimData =
(Mult::Mult_AnimData *) (_vm->_global->_inter_variables + animDataVar +
i * 4 * _vm->_global->_inter_animDataSize);
diff --git a/engines/gob/mult.cpp b/engines/gob/mult.cpp
index 710fa7bfc5..b3650e423d 100644
--- a/engines/gob/mult.cpp
+++ b/engines/gob/mult.cpp
@@ -41,16 +41,17 @@
namespace Gob {
Mult::Mult(GobEngine *vm) : _vm(vm) {
+ int i;
+
+ _multData = 0;
_objects = 0;
_renderData = 0;
_renderData2 = 0;
_objCount = 0;
_underAnimSurf = 0;
- _multData = 0;
_frame = 0;
_doPalSubst = 0;
_counter = 0;
- _frameRate = 0;
_animArrayX = 0;
_animArrayY = 0;
@@ -58,28 +59,7 @@ Mult::Mult(GobEngine *vm) : _vm(vm) {
_index = 0;
- _staticKeysCount = 0;
- _staticKeys = 0;
- int i;
- for (i = 0; i < 10; i++)
- _staticIndices[i] = 0;
-
- for (i = 0; i < 4; i++) {
- _animKeys[i] = 0;
- _animKeysCount[i] = 0;
- }
- _animLayer = 0;
- for (i = 0; i < 10; i++)
- _animIndices[i] = 0;
-
- _textKeysCount = 0;
- _textKeys = 0;
-
- _frameStart = 0;
-
_palKeyIndex = 0;
- _palKeysCount = 0;
- _palKeys = 0;
_oldPalette = 0;
_palAnimKey = 0;
for (i = 0; i < 256; i++) {
@@ -94,23 +74,12 @@ Mult::Mult(GobEngine *vm) : _vm(vm) {
_palAnimBlue[i] = 0;
}
- _palFadeKeys = 0;
- _palFadeKeysCount = 0;
_palFadingRed = 0;
_palFadingGreen = 0;
_palFadingBlue = 0;
_animDataAllocated = 0;
- for (i = 0; i < 10; i++) {
- _staticLoaded[i] = 0;
- _animLoaded[i] = 0;
- }
- _sndSlotsCount = 0;
-
- _sndKeysCount = 0;
- _sndKeys = 0;
-
for (i = 0; i < 5; i++)
for (int j = 0; j < 16; j++) {
_fadePal[i][j].red = 0;
@@ -159,7 +128,7 @@ void Mult::zeroMultData(void) {
}
void Mult::checkFreeMult(void) {
- if (_multData != 0)
+ if (_multData)
freeMultKeys();
}
diff --git a/engines/gob/mult.h b/engines/gob/mult.h
index 35bd424aa9..3912e53f51 100644
--- a/engines/gob/mult.h
+++ b/engines/gob/mult.h
@@ -163,21 +163,72 @@ public:
int16 field_E;
};
+ struct Mult_Data {
+ int16 palFadeKeysCount;
+ Mult_PalFadeKey *palFadeKeys;
+
+ int16 palKeysCount;
+ Mult_PalKey *palKeys;
+
+ int16 staticKeysCount;
+ Mult_StaticKey *staticKeys;
+ int16 staticIndices[10];
+ int16 staticLoaded[10];
+ int8 staticCount;
+
+ int16 animKeysCount[4];
+ Mult_AnimKey *animKeys[4];
+ int16 animIndices[10];
+ int8 animCount;
+
+ int16 animLoaded[10];
+ int16 animKeysFrames[4];
+ int16 animKeysStartFrames[4];
+ int16 animKeysStopFrames[4];
+ int16 animKeysIndices[4][4];
+ int8 animDirection;
+
+ int16 textKeysCount;
+ Mult_TextKey *textKeys;
+
+ int16 sndKeysCount;
+ Mult_SndKey *sndKeys;
+
+ int16 sndSlotsCount;
+ int16 sndSlot[60];
+ int16 frameRate;
+
+ Video::Color fadePal[5][16];
+ int16 field_124[4][4];
+ int16 palAnimIndices[4]; // Not sure here
+ int16 frameStart;
+
+ int16 field_17F[4][4];
+
+ int16 someKeysCount[4];
+ Mult_SomeKey *someKeys[4];
+ int16 someKeysIndices[4];
+ char *somepointer09; // ?
+ char *somepointer10; // ?
+ char *execPtr;
+ };
+
#include "common/pack-end.h" // END STRUCT PACKING
// Globals
+ Mult_Data *_multData;
+ Mult_Data *_multDatas[8];
+
Mult_Object *_objects;
int16 *_renderData;
Mult_Object **_renderData2;
int16 _objCount;
Video::SurfaceDesc *_underAnimSurf;
- char *_multData;
int16 _frame;
char _doPalSubst;
int16 _counter;
- int16 _frameRate;
int32 *_animArrayX;
int32 *_animArrayY;
@@ -185,29 +236,9 @@ public:
Mult_AnimData *_animArrayData;
int16 _index;
-
- // Static keys
- int16 _staticKeysCount;
- Mult_StaticKey *_staticKeys;
- int16 _staticIndices[10];
-
- // Anim keys
- Mult_AnimKey *_animKeys[4];
- int16 _animKeysCount[4];
- int16 _animLayer;
- int16 _animIndices[10];
-
- // Text keys
- int16 _textKeysCount;
- Mult_TextKey *_textKeys;
-
- int16 _frameStart;
-
- // Palette keys
int16 _palKeyIndex;
- int16 _palKeysCount;
- Mult_PalKey *_palKeys;
Video::Color *_oldPalette;
+
Video::Color _palAnimPalette[256];
int16 _palAnimKey;
int16 _palAnimIndices[4];
@@ -215,26 +246,13 @@ public:
int16 _palAnimGreen[4];
int16 _palAnimBlue[4];
- // Palette fading
- Mult_PalFadeKey *_palFadeKeys;
- int16 _palFadeKeysCount;
char _palFadingRed;
char _palFadingGreen;
char _palFadingBlue;
char _animDataAllocated;
- int16 _staticLoaded[10];
- int16 _animLoaded[10];
- int16 _sndSlotsCount;
-
- // Sound keys
- int16 _sndKeysCount;
- Mult_SndKey *_sndKeys;
-
int8 *_orderArray;
- int8 _staticCount;
- int8 _animCount;
void zeroMultData(void);
void checkFreeMult(void);
@@ -296,67 +314,6 @@ protected:
class Mult_v2 : public Mult_v1 {
public:
-
-#include "common/pack-start.h" // START STRUCT PACKING
-
- struct Mult_Data {
- int16 palFadeKeysCount;
- Mult_PalFadeKey *palFadeKeys;
-
- int16 palKeysCount;
- Mult_PalKey *palKeys;
-
- int16 staticKeysCount;
- Mult_StaticKey *staticKeys;
- int8 staticCount;
- int16 staticIndices[10];
- int16 staticLoaded[10];
-
- int16 animKeysCount[4];
- Mult_AnimKey *animKeys[4];
- int8 animCount;
- int16 animIndices[10];
- int16 animLoaded[10];
- int16 animKeysFrames[4];
- int16 animKeysStartFrames[4];
- int16 animKeysStopFrames[4];
- int16 animKeysIndices[4][4];
- int8 animDirection;
-
- int16 textKeysCount;
- Mult_TextKey *textKeys;
-
- int16 sndKeysCount;
- Mult_SndKey *sndKeys;
-
- int16 sndSlotsCount;
- int16 sndSlot[60];
- int16 frameRate;
-
- Video::Color fadePal[5][16];
- int16 field_124[4][4];
- int16 palAnimIndices[4]; // Not sure here
- // TODO: Use this one instead of _frameStart
- int16 frameStart;
-
- int16 field_17F[4][4];
-
- int16 someKeysCount[4];
- Mult_SomeKey *someKeys[4];
- int16 someKeysIndices[4];
- char *somepointer09; // ?
- char *somepointer10; // ?
- char *execPtr;
- };
-
-#include "common/pack-end.h" // END STRUCT PACKING
-
- Mult_Data *_multData2; // TODO: This'll be _multData once every function using it
- // in GOB2 is done
- // TODO: Maybe changing Mult_v1::_multData to struct Mult_Data as well?
- // Could help minimizing code dup...
- Mult_Data *_multDatas[8];
-
Mult_v2(GobEngine *vm);
virtual ~Mult_v2();
diff --git a/engines/gob/mult_v1.cpp b/engines/gob/mult_v1.cpp
index 2d5da914ff..40ed42dfce 100644
--- a/engines/gob/mult_v1.cpp
+++ b/engines/gob/mult_v1.cpp
@@ -43,54 +43,58 @@ Mult_v1::Mult_v1(GobEngine *vm) : Mult(vm) {
void Mult_v1::loadMult(int16 resId) {
int16 palIndex;
int16 i, j;
+ char *extData;
- _sndSlotsCount = 0;
- _frameStart = 0;
- _multData = _vm->_game->loadExtData(resId, 0, 0);
- Common::MemoryReadStream data((byte *) _multData, 4294967295U);
+ _multData = new Mult_Data;
+ memset(_multData, 0, sizeof(Mult_Data));
- _staticCount = data.readSByte() + 1;
- _animCount = data.readSByte() + 1;
+ _multData->sndSlotsCount = 0;
+ _multData->frameStart = 0;
+ extData = _vm->_game->loadExtData(resId, 0, 0);
+ Common::MemoryReadStream data((byte *) extData, 4294967295U);
- for (i = 0; i < _staticCount; i++, data.seek(14, SEEK_CUR)) {
- _staticIndices[i] = _vm->_scenery->loadStatic(1);
+ _multData->staticCount = data.readSByte() + 1;
+ _multData->animCount = data.readSByte() + 1;
- if (_staticIndices[i] >= 100) {
- _staticIndices[i] -= 100;
- _staticLoaded[i] = 1;
+ for (i = 0; i < _multData->staticCount; i++, data.seek(14, SEEK_CUR)) {
+ _multData->staticIndices[i] = _vm->_scenery->loadStatic(1);
+
+ if (_multData->staticIndices[i] >= 100) {
+ _multData->staticIndices[i] -= 100;
+ _multData->staticLoaded[i] = 1;
} else {
- _staticLoaded[i] = 0;
+ _multData->staticLoaded[i] = 0;
}
}
- for (i = 0; i < _animCount; i++, data.seek(14, SEEK_CUR)) {
- _animIndices[i] = _vm->_scenery->loadAnim(1);
+ for (i = 0; i < _multData->animCount; i++, data.seek(14, SEEK_CUR)) {
+ _multData->animIndices[i] = _vm->_scenery->loadAnim(1);
- if (_animIndices[i] >= 100) {
- _animIndices[i] -= 100;
- _animLoaded[i] = 1;
+ if (_multData->animIndices[i] >= 100) {
+ _multData->animIndices[i] -= 100;
+ _multData->animLoaded[i] = 1;
} else {
- _animLoaded[i] = 0;
+ _multData->animLoaded[i] = 0;
}
}
- _frameRate = data.readSint16LE();
- _staticKeysCount = data.readSint16LE();
- _staticKeys = new Mult_StaticKey[_staticKeysCount];
- for (i = 0; i < _staticKeysCount; i++) {
- _staticKeys[i].frame = data.readSint16LE();
- _staticKeys[i].layer = data.readSint16LE();
+ _multData->frameRate = data.readSint16LE();
+ _multData->staticKeysCount = data.readSint16LE();
+ _multData->staticKeys = new Mult_StaticKey[_multData->staticKeysCount];
+ for (i = 0; i < _multData->staticKeysCount; i++) {
+ _multData->staticKeys[i].frame = data.readSint16LE();
+ _multData->staticKeys[i].layer = data.readSint16LE();
}
for (j = 0; j < 4; j++) {
- _animKeysCount[j] = data.readSint16LE();
- _animKeys[j] = new Mult_AnimKey[_animKeysCount[j]];
- for (i = 0; i < _animKeysCount[j]; i++) {
- _animKeys[j][i].frame = data.readSint16LE();
- _animKeys[j][i].layer = data.readSint16LE();
- _animKeys[j][i].posX = data.readSint16LE();
- _animKeys[j][i].posY = data.readSint16LE();
- _animKeys[j][i].order = data.readSint16LE();
+ _multData->animKeysCount[j] = data.readSint16LE();
+ _multData->animKeys[j] = new Mult_AnimKey[_multData->animKeysCount[j]];
+ for (i = 0; i < _multData->animKeysCount[j]; i++) {
+ _multData->animKeys[j][i].frame = data.readSint16LE();
+ _multData->animKeys[j][i].layer = data.readSint16LE();
+ _multData->animKeys[j][i].posX = data.readSint16LE();
+ _multData->animKeys[j][i].posY = data.readSint16LE();
+ _multData->animKeys[j][i].order = data.readSint16LE();
}
}
@@ -102,71 +106,71 @@ void Mult_v1::loadMult(int16 resId) {
}
}
- _palFadeKeysCount = data.readSint16LE();
- _palFadeKeys = new Mult_PalFadeKey[_palFadeKeysCount];
- for (i = 0; i < _palFadeKeysCount; i++) {
- _palFadeKeys[i].frame = data.readSint16LE();
- _palFadeKeys[i].fade = data.readSint16LE();
- _palFadeKeys[i].palIndex = data.readSint16LE();
- _palFadeKeys[i].flag = data.readSByte();
+ _multData->palFadeKeysCount = data.readSint16LE();
+ _multData->palFadeKeys = new Mult_PalFadeKey[_multData->palFadeKeysCount];
+ for (i = 0; i < _multData->palFadeKeysCount; i++) {
+ _multData->palFadeKeys[i].frame = data.readSint16LE();
+ _multData->palFadeKeys[i].fade = data.readSint16LE();
+ _multData->palFadeKeys[i].palIndex = data.readSint16LE();
+ _multData->palFadeKeys[i].flag = data.readSByte();
}
- _palKeysCount = data.readSint16LE();
- _palKeys = new Mult_PalKey[_palKeysCount];
- for (i = 0; i < _palKeysCount; i++) {
- _palKeys[i].frame = data.readSint16LE();
- _palKeys[i].cmd = data.readSint16LE();
- _palKeys[i].rates[0] = data.readSint16LE();
- _palKeys[i].rates[1] = data.readSint16LE();
- _palKeys[i].rates[2] = data.readSint16LE();
- _palKeys[i].rates[3] = data.readSint16LE();
- _palKeys[i].unknown0 = data.readSint16LE();
- _palKeys[i].unknown1 = data.readSint16LE();
- data.read(_palKeys[i].subst, 64);
+ _multData->palKeysCount = data.readSint16LE();
+ _multData->palKeys = new Mult_PalKey[_multData->palKeysCount];
+ for (i = 0; i < _multData->palKeysCount; i++) {
+ _multData->palKeys[i].frame = data.readSint16LE();
+ _multData->palKeys[i].cmd = data.readSint16LE();
+ _multData->palKeys[i].rates[0] = data.readSint16LE();
+ _multData->palKeys[i].rates[1] = data.readSint16LE();
+ _multData->palKeys[i].rates[2] = data.readSint16LE();
+ _multData->palKeys[i].rates[3] = data.readSint16LE();
+ _multData->palKeys[i].unknown0 = data.readSint16LE();
+ _multData->palKeys[i].unknown1 = data.readSint16LE();
+ data.read(_multData->palKeys[i].subst, 64);
}
- _textKeysCount = data.readSint16LE();
- _textKeys = new Mult_TextKey[_textKeysCount];
- for (i = 0; i < _textKeysCount; i++) {
- _textKeys[i].frame = data.readSint16LE();
- _textKeys[i].cmd = data.readSint16LE();
+ _multData->textKeysCount = data.readSint16LE();
+ _multData->textKeys = new Mult_TextKey[_multData->textKeysCount];
+ for (i = 0; i < _multData->textKeysCount; i++) {
+ _multData->textKeys[i].frame = data.readSint16LE();
+ _multData->textKeys[i].cmd = data.readSint16LE();
for (int k = 0; k < 9; ++k)
- _textKeys[i].unknown0[k] = data.readSint16LE();
- _textKeys[i].index = data.readSint16LE();
- _textKeys[i].unknown1[0] = data.readSint16LE();
- _textKeys[i].unknown1[1] = data.readSint16LE();
+ _multData->textKeys[i].unknown0[k] = data.readSint16LE();
+ _multData->textKeys[i].index = data.readSint16LE();
+ _multData->textKeys[i].unknown1[0] = data.readSint16LE();
+ _multData->textKeys[i].unknown1[1] = data.readSint16LE();
}
- _sndKeysCount = data.readSint16LE();
- _sndKeys = new Mult_SndKey[_sndKeysCount];
- for (i = 0; i < _sndKeysCount; i++) {
- _sndKeys[i].frame = data.readSint16LE();
- _sndKeys[i].cmd = data.readSint16LE();
- _sndKeys[i].freq = data.readSint16LE();
- _sndKeys[i].fadeLength = data.readSint16LE();
- _sndKeys[i].repCount = data.readSint16LE();
- _sndKeys[i].soundIndex = -1;
- _sndKeys[i].resId = -1;
+ _multData->sndKeysCount = data.readSint16LE();
+ _multData->sndKeys = new Mult_SndKey[_multData->sndKeysCount];
+ for (i = 0; i < _multData->sndKeysCount; i++) {
+ _multData->sndKeys[i].frame = data.readSint16LE();
+ _multData->sndKeys[i].cmd = data.readSint16LE();
+ _multData->sndKeys[i].freq = data.readSint16LE();
+ _multData->sndKeys[i].fadeLength = data.readSint16LE();
+ _multData->sndKeys[i].repCount = data.readSint16LE();
+ _multData->sndKeys[i].soundIndex = -1;
+ _multData->sndKeys[i].resId = -1;
data.seek(26, SEEK_CUR);
- switch (_sndKeys[i].cmd) {
+ switch (_multData->sndKeys[i].cmd) {
case 1:
case 4:
- _sndKeys[i].resId = READ_LE_UINT16(_vm->_global->_inter_execPtr);
+ _multData->sndKeys[i].resId = READ_LE_UINT16(_vm->_global->_inter_execPtr);
for (j = 0; j < i; j++) {
- if (_sndKeys[i].resId ==
- _sndKeys[j].resId) {
- _sndKeys[i].soundIndex =
- _sndKeys[j].soundIndex;
+ if (_multData->sndKeys[i].resId ==
+ _multData->sndKeys[j].resId) {
+ _multData->sndKeys[i].soundIndex =
+ _multData->sndKeys[j].soundIndex;
_vm->_global->_inter_execPtr += 2;
break;
}
}
if (i == j) {
- _vm->_inter->loadSound(19 - _sndSlotsCount);
- _sndKeys[i].soundIndex =
- 19 - _sndSlotsCount;
- _sndSlotsCount++;
+ _vm->_inter->loadSound(19 - _multData->sndSlotsCount);
+ _multData->sndKeys[i].soundIndex =
+ 19 - _multData->sndSlotsCount;
+ _multData->sndSlotsCount++;
}
break;
@@ -175,7 +179,7 @@ void Mult_v1::loadMult(int16 resId) {
break;
case 5:
- _vm->_global->_inter_execPtr += _sndKeys[i].freq * 2;
+ _vm->_global->_inter_execPtr += _multData->sndKeys[i].freq * 2;
break;
}
}
@@ -211,10 +215,11 @@ void Mult_v1::playMult(int16 startFrame, int16 endFrame, char checkEscape,
_palFadingBlue = 0;
_oldPalette = _vm->_global->_pPaletteDesc->vgaPal;
- memcpy((char *)_palAnimPalette, (char *)_vm->_global->_pPaletteDesc->vgaPal, 768);
+ memcpy((char *)_palAnimPalette,
+ (char *)_vm->_global->_pPaletteDesc->vgaPal, 768);
if (_vm->_anim->_animSurf == 0) {
- _vm->_util->setFrameRate(_frameRate);
+ _vm->_util->setFrameRate(_multData->frameRate);
_vm->_anim->_areaTop = 0;
_vm->_anim->_areaLeft = 0;
_vm->_anim->_areaWidth = 320;
@@ -331,27 +336,29 @@ void Mult_v1::playMult(int16 startFrame, int16 endFrame, char checkEscape,
WRITE_VAR(57, (uint32)-1);
} else
- WRITE_VAR(57, _frame - 1 - _frameStart);
+ WRITE_VAR(57, _frame - 1 - _multData->frameStart);
}
char Mult_v1::drawStatics(char stop) {
- if (_staticKeys[_staticKeysCount - 1].frame > _frame)
+ if (_multData->staticKeys[_multData->staticKeysCount - 1].frame > _frame)
stop = 0;
- for (_counter = 0; _counter < _staticKeysCount;
+ for (_counter = 0; _counter < _multData->staticKeysCount;
_counter++) {
- if (_staticKeys[_counter].frame != _frame
- || _staticKeys[_counter].layer == -1)
+ if (_multData->staticKeys[_counter].frame != _frame
+ || _multData->staticKeys[_counter].layer == -1)
continue;
- for (_vm->_scenery->_curStatic = 0, _vm->_scenery->_curStaticLayer = _staticKeys[_counter].layer;
- _vm->_scenery->_curStaticLayer >= _vm->_scenery->_statics[_staticIndices[_vm->_scenery->_curStatic]].layersCount;
- _vm->_scenery->_curStatic++) {
+ _vm->_scenery->_curStaticLayer = _multData->staticKeys[_counter].layer;
+ for (_vm->_scenery->_curStatic = 0;
+ _vm->_scenery->_curStaticLayer >=
+ _vm->_scenery->_statics[_multData->staticIndices[_vm->_scenery->_curStatic]].layersCount;
+ _vm->_scenery->_curStatic++) {
_vm->_scenery->_curStaticLayer -=
- _vm->_scenery->_statics[_staticIndices[_vm->_scenery->_curStatic]].layersCount;
+ _vm->_scenery->_statics[_multData->staticIndices[_vm->_scenery->_curStatic]].layersCount;
}
- _vm->_scenery->_curStatic = _staticIndices[_vm->_scenery->_curStatic];
+ _vm->_scenery->_curStatic = _multData->staticIndices[_vm->_scenery->_curStatic];
_vm->_scenery->renderStatic(_vm->_scenery->_curStatic, _vm->_scenery->_curStaticLayer);
_vm->_video->drawSprite(_vm->_draw->_backSurface, _vm->_anim->_animSurf,
0, 0, 319, 199, 0, 0, 0);
@@ -366,8 +373,8 @@ char Mult_v1::drawAnims(char stop) {
int16 count;
for (_index = 0; _index < 4; _index++) {
- for (_counter = 0; _counter < _animKeysCount[_index]; _counter++) {
- key = &_animKeys[_index][_counter];
+ for (_counter = 0; _counter < _multData->animKeysCount[_index]; _counter++) {
+ key = &_multData->animKeys[_index][_counter];
animObj = &_objects[_index];
if (key->frame != _frame)
continue;
@@ -386,15 +393,17 @@ char Mult_v1::drawAnims(char stop) {
animObj->tick = 0;
animObj->pAnimData->layer = key->layer;
- count = _vm->_scenery->_animations[_animIndices[0]].layersCount;
+ count =
+ _vm->_scenery->_animations[_multData->animIndices[0]].layersCount;
i = 0;
while (animObj->pAnimData->layer >= count) {
animObj->pAnimData->layer -= count;
i++;
- count = _vm->_scenery->_animations[_animIndices[i]].layersCount;
+ count =
+ _vm->_scenery->_animations[_multData->animIndices[i]].layersCount;
}
- animObj->pAnimData->animation = _animIndices[i];
+ animObj->pAnimData->animation = _multData->animIndices[i];
} else {
animObj->pAnimData->isStatic = 1;
}
@@ -407,20 +416,21 @@ void Mult_v1::drawText(char *pStop, char *pStopNoClear) {
char *savedIP;
int16 cmd;
- for (_index = 0; _index < _textKeysCount; _index++) {
- if (_textKeys[_index].frame != _frame)
+ for (_index = 0; _index < _multData->textKeysCount; _index++) {
+ if (_multData->textKeys[_index].frame != _frame)
continue;
- cmd = _textKeys[_index].cmd;
+ cmd = _multData->textKeys[_index].cmd;
if (cmd == 0) {
*pStop = 0;
} else if (cmd == 1) {
*pStopNoClear = 1;
- _frameStart = 0;
+ _multData->frameStart = 0;
} else if (cmd == 3) {
*pStop = 0;
savedIP = _vm->_global->_inter_execPtr;
- _vm->_global->_inter_execPtr = (char *)(&_textKeys[_index].index);
+ _vm->_global->_inter_execPtr =
+ (char *)(&_multData->textKeys[_index].index);
_vm->_global->_inter_execPtr = savedIP;
}
}
@@ -430,16 +440,17 @@ char Mult_v1::prepPalAnim(char stop) {
_palKeyIndex = -1;
do {
_palKeyIndex++;
- if (_palKeyIndex >= _palKeysCount)
+ if (_palKeyIndex >= _multData->palKeysCount)
return stop;
- } while (_palKeys[_palKeyIndex].frame != _frame);
+ } while (_multData->palKeys[_palKeyIndex].frame != _frame);
- if (_palKeys[_palKeyIndex].cmd == -1) {
+ if (_multData->palKeys[_palKeyIndex].cmd == -1) {
stop = 0;
_doPalSubst = 0;
_vm->_global->_pPaletteDesc->vgaPal = _oldPalette;
- memcpy((char *)_palAnimPalette, (char *)_vm->_global->_pPaletteDesc->vgaPal, 768);
+ memcpy((char *)_palAnimPalette,
+ (char *)_vm->_global->_pPaletteDesc->vgaPal, 768);
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
} else {
@@ -467,7 +478,7 @@ void Mult_v1::doPalAnim(void) {
return;
for (_index = 0; _index < 4; _index++) {
- palKey = &_palKeys[_palAnimKey];
+ palKey = &_multData->palKeys[_palAnimKey];
if ((_frame % palKey->rates[_index]) != 0)
continue;
@@ -491,9 +502,12 @@ void Mult_v1::doPalAnim(void) {
off = palKey->subst[(_palAnimIndices[_index] + 1) % 16][_index] - 1;
off2 = palKey->subst[_palAnimIndices[_index]][_index] - 1;
- _vm->_global->_pPaletteDesc->vgaPal[off2].red = _vm->_global->_pPaletteDesc->vgaPal[off].red;
- _vm->_global->_pPaletteDesc->vgaPal[off2].green = _vm->_global->_pPaletteDesc->vgaPal[off].green;
- _vm->_global->_pPaletteDesc->vgaPal[off2].blue = _vm->_global->_pPaletteDesc->vgaPal[off].blue;
+ _vm->_global->_pPaletteDesc->vgaPal[off2].red =
+ _vm->_global->_pPaletteDesc->vgaPal[off].red;
+ _vm->_global->_pPaletteDesc->vgaPal[off2].green =
+ _vm->_global->_pPaletteDesc->vgaPal[off].green;
+ _vm->_global->_pPaletteDesc->vgaPal[off2].blue =
+ _vm->_global->_pPaletteDesc->vgaPal[off].blue;
}
_palAnimIndices[_index] = (_palAnimIndices[_index] + 1) % 16;
@@ -518,7 +532,8 @@ void Mult_v1::doPalAnim(void) {
palPtr = _vm->_global->_pPaletteDesc->vgaPal;
for (_counter = 0; _counter < 16; _counter++) {
- _vm->_video->setPalElem(_counter, palPtr->red, palPtr->green, palPtr->blue, 0, 0x13);
+ _vm->_video->setPalElem(_counter, palPtr->red, palPtr->green,
+ palPtr->blue, 0, 0x13);
palPtr++;
}
@@ -537,8 +552,8 @@ void Mult_v1::doPalAnim(void) {
char Mult_v1::doFadeAnim(char stop) {
Mult_PalFadeKey *fadeKey;
- for (_index = 0; _index < _palFadeKeysCount; _index++) {
- fadeKey = &_palFadeKeys[_index];
+ for (_index = 0; _index < _multData->palFadeKeysCount; _index++) {
+ fadeKey = &_multData->palFadeKeys[_index];
if (fadeKey->frame != _frame)
continue;
@@ -579,8 +594,8 @@ char Mult_v1::doFadeAnim(char stop) {
char Mult_v1::doSoundAnim(char stop, int16 frame) {
Mult_SndKey *sndKey;
- for (_index = 0; _index < _sndKeysCount; _index++) {
- sndKey = &_sndKeys[_index];
+ for (_index = 0; _index < _multData->sndKeysCount; _index++) {
+ sndKey = &_multData->sndKeys[_index];
if (sndKey->frame != frame)
continue;
@@ -588,14 +603,14 @@ char Mult_v1::doSoundAnim(char stop, int16 frame) {
if (sndKey->cmd == 1) {
_vm->_snd->stopSound(0);
stop = 0;
- playSound(_vm->_game->_soundSamples[sndKey->soundIndex], sndKey->repCount,
- sndKey->freq, sndKey->fadeLength);
+ playSound(_vm->_game->_soundSamples[sndKey->soundIndex],
+ sndKey->repCount, sndKey->freq, sndKey->fadeLength);
} else if (sndKey->cmd == 4) {
_vm->_snd->stopSound(0);
stop = 0;
- playSound(_vm->_game->_soundSamples[sndKey->soundIndex], sndKey->repCount,
- sndKey->freq, sndKey->fadeLength);
+ playSound(_vm->_game->_soundSamples[sndKey->soundIndex],
+ sndKey->repCount, sndKey->freq, sndKey->fadeLength);
}
} else {
if (_vm->_snd->_playingSound)
@@ -837,7 +852,8 @@ void Mult_v1::animate(void) {
} else {
pAnimData->frame++;
if (pAnimData->frame >=
- _vm->_scenery->_animations[(int)pAnimData->animation].layers[pAnimData->layer].framesCount) {
+ _vm->_scenery->_animations[(int)pAnimData->animation].
+ layers[pAnimData->layer].framesCount) {
switch (pAnimData->animType) {
case 0:
pAnimData->frame = 0;
@@ -890,7 +906,8 @@ void Mult_v1::animate(void) {
}
void Mult_v1::freeMult(void) {
- _vm->_video->freeSurfDesc(_vm->_anim->_animSurf);
+ if ((_vm->_anim->_animSurf != 0) && (_vm->_draw->_spritesArray[22] != 0))
+ _vm->_video->freeSurfDesc(_vm->_anim->_animSurf);
delete[] _objects;
delete[] _renderData;
@@ -911,35 +928,31 @@ void Mult_v1::playSound(Snd::SoundDesc * soundDesc, int16 repCount, int16 freq,
void Mult_v1::freeMultKeys(void) {
int i;
- delete[] _multData;
+ for (i = 0; i < _multData->staticCount; i++) {
- for (i = 0; i < _staticCount; i++) {
-
- if (_staticLoaded[i] != 0)
- _vm->_scenery->freeStatic(_staticIndices[i]);
+ if (_multData->staticLoaded[i] != 0)
+ _vm->_scenery->freeStatic(_multData->staticIndices[i]);
}
- for (i = 0; i < _animCount; i++) {
- if (_animLoaded[i] != 0)
- _vm->_scenery->freeAnim(_animIndices[i]);
+ for (i = 0; i < _multData->animCount; i++) {
+ if (_multData->animLoaded[i] != 0)
+ _vm->_scenery->freeAnim(_multData->animIndices[i]);
}
- delete[] _staticKeys;
+ delete[] _multData->staticKeys;
for (i = 0; i < 4; i++)
- delete[] _animKeys[i];
+ delete[] _multData->animKeys[i];
- delete[] _palFadeKeys;
- delete[] _palKeys;
- delete[] _textKeys;
+ delete[] _multData->palFadeKeys;
+ delete[] _multData->palKeys;
+ delete[] _multData->textKeys;
- for (i = 0; i < _sndSlotsCount; i++) {
+ for (i = 0; i < _multData->sndSlotsCount; i++) {
_vm->_game->freeSoundSlot(19 - i);
}
- delete[] _sndKeys;
-
- _multData = 0;
+ delete[] _multData->sndKeys;
if (_animDataAllocated != 0) {
delete[] _objects;
@@ -963,6 +976,9 @@ void Mult_v1::freeMultKeys(void) {
_animDataAllocated = 0;
}
+
+ delete _multData;
+ _multData = 0;
}
} // End of namespace Gob
diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp
index 89d08b7f03..539b4fa41d 100644
--- a/engines/gob/mult_v2.cpp
+++ b/engines/gob/mult_v2.cpp
@@ -44,8 +44,7 @@ Mult_v2::Mult_v2(GobEngine *vm) : Mult_v1(vm) {
int i;
_renderData2 = 0;
- _multData2 = 0;
- _frameStart = 0; // Temporarily to sync _frameStart and _multData2->frameStart
+ _multData = 0;
for (i = 0; i < 8; i++) _multDatas[i] = 0;
}
@@ -54,7 +53,7 @@ Mult_v2::~Mult_v2() {
freeMultKeys();
for (i = 0; i < 8; i++) {
- _multData2 = _multDatas[i];
+ _multData = _multDatas[i];
freeMultKeys();
}
@@ -76,29 +75,27 @@ void Mult_v2::loadMult(int16 resId) {
index = (resId & 0x8000) ? *_vm->_global->_inter_execPtr++ : 0;
- _multData2 = new Mult_Data;
- _frameStart = 0; // Temporarily to sync _frameStart and _multData2->frameStart
- memset(_multData2, 0, sizeof(Mult_Data));
+ _multData = new Mult_Data;
+ memset(_multData, 0, sizeof(Mult_Data));
- _multDatas[index] = _multData2;
+ _multDatas[index] = _multData;
for (i = 0; i < 10; i++) {
- _multData2->staticLoaded[i] = 0;
- _multData2->animLoaded[i] = 0;
+ _multData->staticLoaded[i] = 0;
+ _multData->animLoaded[i] = 0;
}
for (i = 0; i < 4; i++)
- _multData2->field_124[0][i] = i;
+ _multData->field_124[0][i] = i;
- _multData2->sndSlotsCount = 0;
- _multData2->frameStart = 0;
- _frameStart = 0;
+ _multData->sndSlotsCount = 0;
+ _multData->frameStart = 0;
extData = _vm->_game->loadExtData(resId, 0, 0);
Common::MemoryReadStream data((byte *) extData, 4294967295U);
- _multData2->staticCount = staticCount = data.readSByte();
- _multData2->animCount = animCount = data.readSByte();
+ _multData->staticCount = staticCount = data.readSByte();
+ _multData->animCount = animCount = data.readSByte();
staticCount++;
animCount++;
@@ -107,125 +104,125 @@ void Mult_v2::loadMult(int16 resId) {
debugC(7, kDebugGraphics, "statics: %u, anims: %u, hb: %u", staticCount, animCount, hbstaticCount);
for (i = 0; i < staticCount; i++, data.seek(14, SEEK_CUR)) {
- _multData2->staticIndices[i] = _vm->_scenery->loadStatic(1);
+ _multData->staticIndices[i] = _vm->_scenery->loadStatic(1);
- if (_multData2->staticIndices[i] >= 100) {
- _multData2->staticIndices[i] -= 100;
- _multData2->staticLoaded[i] = 1;
+ if (_multData->staticIndices[i] >= 100) {
+ _multData->staticIndices[i] -= 100;
+ _multData->staticLoaded[i] = 1;
} else
- _multData2->staticLoaded[i] = 0;
+ _multData->staticLoaded[i] = 0;
}
for (i = 0; i < animCount; i++, data.seek(14, SEEK_CUR)) {
- _multData2->animIndices[i] = _vm->_scenery->loadAnim(1);
+ _multData->animIndices[i] = _vm->_scenery->loadAnim(1);
- if (_multData2->animIndices[i] >= 100) {
- _multData2->animIndices[i] -= 100;
- _multData2->animLoaded[i] = 1;
+ if (_multData->animIndices[i] >= 100) {
+ _multData->animIndices[i] -= 100;
+ _multData->animLoaded[i] = 1;
} else
- _multData2->animLoaded[i] = 0;
+ _multData->animLoaded[i] = 0;
}
- _multData2->frameRate = data.readSint16LE();
- _multData2->staticKeysCount = data.readSint16LE();
- _multData2->staticKeys = new Mult_StaticKey[_multData2->staticKeysCount];
- for (i = 0; i < _multData2->staticKeysCount; i++) {
- _multData2->staticKeys[i].frame = data.readSint16LE();
- _multData2->staticKeys[i].layer = data.readSint16LE();
+ _multData->frameRate = data.readSint16LE();
+ _multData->staticKeysCount = data.readSint16LE();
+ _multData->staticKeys = new Mult_StaticKey[_multData->staticKeysCount];
+ for (i = 0; i < _multData->staticKeysCount; i++) {
+ _multData->staticKeys[i].frame = data.readSint16LE();
+ _multData->staticKeys[i].layer = data.readSint16LE();
}
for (i = 0; i < 4; i++) {
- _multData2->someKeysCount[i] = 0;
- _multData2->someKeys[i] = 0;
- _multData2->someKeysIndices[i] = -1;
+ _multData->someKeysCount[i] = 0;
+ _multData->someKeys[i] = 0;
+ _multData->someKeysIndices[i] = -1;
for (j = 0; j < 4; j++) {
- _multData2->animKeysIndices[i][j] = 0;
- _multData2->field_17F[i][j] = 0;
+ _multData->animKeysIndices[i][j] = 0;
+ _multData->field_17F[i][j] = 0;
}
- _multData2->animKeysFrames[i] = -1;
- _multData2->animKeysCount[i] = data.readSint16LE();
- _multData2->animKeys[i] = new Mult_AnimKey[_multData2->animKeysCount[i]];
- for (j = 0; j < _multData2->animKeysCount[i]; j++) {
- _multData2->animKeys[i][j].frame = data.readSint16LE();
- _multData2->animKeys[i][j].layer = data.readSint16LE();
- _multData2->animKeys[i][j].posX = data.readSint16LE();
- _multData2->animKeys[i][j].posY = data.readSint16LE();
- _multData2->animKeys[i][j].order = data.readSint16LE();
+ _multData->animKeysFrames[i] = -1;
+ _multData->animKeysCount[i] = data.readSint16LE();
+ _multData->animKeys[i] = new Mult_AnimKey[_multData->animKeysCount[i]];
+ for (j = 0; j < _multData->animKeysCount[i]; j++) {
+ _multData->animKeys[i][j].frame = data.readSint16LE();
+ _multData->animKeys[i][j].layer = data.readSint16LE();
+ _multData->animKeys[i][j].posX = data.readSint16LE();
+ _multData->animKeys[i][j].posY = data.readSint16LE();
+ _multData->animKeys[i][j].order = data.readSint16LE();
}
}
for (palIndex = 0; palIndex < 5; palIndex++) {
for (i = 0; i < 16; i++) {
- _multData2->fadePal[palIndex][i].red = data.readByte();
- _multData2->fadePal[palIndex][i].green = data.readByte();
- _multData2->fadePal[palIndex][i].blue = data.readByte();
+ _multData->fadePal[palIndex][i].red = data.readByte();
+ _multData->fadePal[palIndex][i].green = data.readByte();
+ _multData->fadePal[palIndex][i].blue = data.readByte();
}
}
- _multData2->palFadeKeysCount = data.readSint16LE();
- _multData2->palFadeKeys = new Mult_PalFadeKey[_multData2->palFadeKeysCount];
- for (i = 0; i < _multData2->palFadeKeysCount; i++) {
- _multData2->palFadeKeys[i].frame = data.readSint16LE();
- _multData2->palFadeKeys[i].fade = data.readSint16LE();
- _multData2->palFadeKeys[i].palIndex = data.readSint16LE();
- _multData2->palFadeKeys[i].flag = data.readSByte();
+ _multData->palFadeKeysCount = data.readSint16LE();
+ _multData->palFadeKeys = new Mult_PalFadeKey[_multData->palFadeKeysCount];
+ for (i = 0; i < _multData->palFadeKeysCount; i++) {
+ _multData->palFadeKeys[i].frame = data.readSint16LE();
+ _multData->palFadeKeys[i].fade = data.readSint16LE();
+ _multData->palFadeKeys[i].palIndex = data.readSint16LE();
+ _multData->palFadeKeys[i].flag = data.readSByte();
}
- _multData2->palKeysCount = data.readSint16LE();
- _multData2->palKeys = new Mult_PalKey[_multData2->palKeysCount];
- for (i = 0; i < _multData2->palKeysCount; i++) {
- _multData2->palKeys[i].frame = data.readSint16LE();
- _multData2->palKeys[i].cmd = data.readSint16LE();
- _multData2->palKeys[i].rates[0] = data.readSint16LE();
- _multData2->palKeys[i].rates[1] = data.readSint16LE();
- _multData2->palKeys[i].rates[2] = data.readSint16LE();
- _multData2->palKeys[i].rates[3] = data.readSint16LE();
- _multData2->palKeys[i].unknown0 = data.readSint16LE();
- _multData2->palKeys[i].unknown1 = data.readSint16LE();
- data.read(_multData2->palKeys[i].subst, 64);
+ _multData->palKeysCount = data.readSint16LE();
+ _multData->palKeys = new Mult_PalKey[_multData->palKeysCount];
+ for (i = 0; i < _multData->palKeysCount; i++) {
+ _multData->palKeys[i].frame = data.readSint16LE();
+ _multData->palKeys[i].cmd = data.readSint16LE();
+ _multData->palKeys[i].rates[0] = data.readSint16LE();
+ _multData->palKeys[i].rates[1] = data.readSint16LE();
+ _multData->palKeys[i].rates[2] = data.readSint16LE();
+ _multData->palKeys[i].rates[3] = data.readSint16LE();
+ _multData->palKeys[i].unknown0 = data.readSint16LE();
+ _multData->palKeys[i].unknown1 = data.readSint16LE();
+ data.read(_multData->palKeys[i].subst, 64);
}
- _multData2->textKeysCount = data.readSint16LE();
- _multData2->textKeys = new Mult_TextKey[_multData2->textKeysCount];
- for (i = 0; i < _multData2->textKeysCount; i++) {
- _multData2->textKeys[i].frame = data.readSint16LE();
- _multData2->textKeys[i].cmd = data.readSint16LE();
+ _multData->textKeysCount = data.readSint16LE();
+ _multData->textKeys = new Mult_TextKey[_multData->textKeysCount];
+ for (i = 0; i < _multData->textKeysCount; i++) {
+ _multData->textKeys[i].frame = data.readSint16LE();
+ _multData->textKeys[i].cmd = data.readSint16LE();
if (!hbstaticCount)
data.seek(24, SEEK_CUR);
}
- _multData2->sndKeysCount = data.readSint16LE();
- warning("SoundKeyCount: %d", _multData2->sndKeysCount);
- _multData2->sndKeys = new Mult_SndKey[_multData2->sndKeysCount];
- for (i = 0; i < _multData2->sndKeysCount; i++) {
- _multData2->sndKeys[i].frame = data.readSint16LE();
- _multData2->sndKeys[i].cmd = data.readSint16LE();
- _multData2->sndKeys[i].freq = data.readSint16LE();
- _multData2->sndKeys[i].fadeLength = data.readSint16LE();
- _multData2->sndKeys[i].repCount = data.readSint16LE();
- _multData2->sndKeys[i].soundIndex = -1;
- _multData2->sndKeys[i].resId = -1;
+ _multData->sndKeysCount = data.readSint16LE();
+ warning("SoundKeyCount: %d", _multData->sndKeysCount);
+ _multData->sndKeys = new Mult_SndKey[_multData->sndKeysCount];
+ for (i = 0; i < _multData->sndKeysCount; i++) {
+ _multData->sndKeys[i].frame = data.readSint16LE();
+ _multData->sndKeys[i].cmd = data.readSint16LE();
+ _multData->sndKeys[i].freq = data.readSint16LE();
+ _multData->sndKeys[i].fadeLength = data.readSint16LE();
+ _multData->sndKeys[i].repCount = data.readSint16LE();
+ _multData->sndKeys[i].soundIndex = -1;
+ _multData->sndKeys[i].resId = -1;
data.seek(2, SEEK_CUR);
if (!hbstaticCount)
data.seek(24, SEEK_CUR);
- switch (_multData2->sndKeys[i].cmd) {
+ switch (_multData->sndKeys[i].cmd) {
case 1:
case 4:
- _multData2->sndKeys[i].resId = READ_LE_UINT16(_vm->_global->_inter_execPtr);
+ _multData->sndKeys[i].resId = READ_LE_UINT16(_vm->_global->_inter_execPtr);
for (j = 0; j < i; j++) { // loc_7071
- if (_multData2->sndKeys[j].resId == _multData2->sndKeys[i].resId) {
- _multData2->sndKeys[i].soundIndex = _multData2->sndKeys[j].soundIndex;
+ if (_multData->sndKeys[j].resId == _multData->sndKeys[i].resId) {
+ _multData->sndKeys[i].soundIndex = _multData->sndKeys[j].soundIndex;
_vm->_global->_inter_execPtr += 2;
break;
}
}
if (i == j) {
- _multData2->sndSlot[_multData2->sndSlotsCount] = _vm->_inter->loadSound(1);
- _multData2->sndKeys[i].soundIndex = _multData2->sndSlot[_multData2->sndSlotsCount] & 0x7FFF;
- _multData2->sndSlotsCount++;
+ _multData->sndSlot[_multData->sndSlotsCount] = _vm->_inter->loadSound(1);
+ _multData->sndKeys[i].soundIndex = _multData->sndSlot[_multData->sndSlotsCount] & 0x7FFF;
+ _multData->sndSlotsCount++;
}
break;
case 3:
@@ -234,37 +231,37 @@ void Mult_v2::loadMult(int16 resId) {
}
}
- _multData2->somepointer09 = 0;
- _multData2->somepointer10 = 0;
+ _multData->somepointer09 = 0;
+ _multData->somepointer10 = 0;
if (hbstaticCount) {
warning("GOB2 Stub! Mult_Data.somepointer09, Mult_Data.somepointer10");
size = _vm->_inter->load16();
- _multData2->execPtr = _vm->_global->_inter_execPtr;
+ _multData->execPtr = _vm->_global->_inter_execPtr;
_vm->_global->_inter_execPtr += size * 2;
if (_vm->_game->_totFileData[0x29] >= 51) {
size = data.readSint16LE();
- _multData2->somepointer10 = new char[size * 20];
- // According to the original asm, these bytes are written into _multData2->somepointer09!
- data.read(_multData2->somepointer10, size * 20);
+ _multData->somepointer10 = new char[size * 20];
+ // According to the original asm, these bytes are written into _multData->somepointer09!
+ data.read(_multData->somepointer10, size * 20);
size = _vm->_inter->load16();
if (size > 0) {
- _multData2->somepointer09 = new char[size * 14];
- memcpy(_multData2->somepointer09, _vm->_global->_inter_execPtr, size * 14);
+ _multData->somepointer09 = new char[size * 14];
+ memcpy(_multData->somepointer09, _vm->_global->_inter_execPtr, size * 14);
_vm->_global->_inter_execPtr += size * 14;
data.seek(2, SEEK_CUR);
for (i = 0; i < 4; i++) {
- _multData2->someKeysCount[i] = data.readSint16LE();
- _multData2->someKeys[i] = new Mult_SomeKey[_multData2->someKeysCount[i]];
- for (j = 0; j < _multData2->someKeysCount[i]; j++) {
- _multData2->someKeys[i][j].frame = data.readSint16LE();
- _multData2->someKeys[i][j].field_2 = data.readSint16LE();
- _multData2->someKeys[i][j].field_4 = data.readSint16LE();
- _multData2->someKeys[i][j].field_6 = data.readSint16LE();
- _multData2->someKeys[i][j].field_8 = data.readSint16LE();
- _multData2->someKeys[i][j].field_A = data.readSint16LE();
- _multData2->someKeys[i][j].field_C = data.readSint16LE();
- _multData2->someKeys[i][j].field_E = data.readSint16LE();
+ _multData->someKeysCount[i] = data.readSint16LE();
+ _multData->someKeys[i] = new Mult_SomeKey[_multData->someKeysCount[i]];
+ for (j = 0; j < _multData->someKeysCount[i]; j++) {
+ _multData->someKeys[i][j].frame = data.readSint16LE();
+ _multData->someKeys[i][j].field_2 = data.readSint16LE();
+ _multData->someKeys[i][j].field_4 = data.readSint16LE();
+ _multData->someKeys[i][j].field_6 = data.readSint16LE();
+ _multData->someKeys[i][j].field_8 = data.readSint16LE();
+ _multData->someKeys[i][j].field_A = data.readSint16LE();
+ _multData->someKeys[i][j].field_C = data.readSint16LE();
+ _multData->someKeys[i][j].field_E = data.readSint16LE();
}
}
}
@@ -279,8 +276,7 @@ void Mult_v2::setMultData(uint16 multindex) {
error("Multindex out of range");
debugC(4, kDebugGameFlow, "Switching to mult %d", multindex);
- _multData2 = _multDatas[multindex];
- _frameStart = _multData2->frameStart; // Temporarily to sync _frameStart and _multData2->frameStart
+ _multData = _multDatas[multindex];
}
void Mult_v2::multSub(uint16 multindex) {
@@ -298,10 +294,9 @@ void Mult_v2::multSub(uint16 multindex) {
error("Multindex out of range");
debugC(4, kDebugGameFlow, "Sub mult %d", multindex);
- _multData2 = _multDatas[multindex];
- _frameStart = _multData2->frameStart; // Temporarily to sync _frameStart and _multData2->frameStart
+ _multData = _multDatas[multindex];
- if (_multData2 == 0) {
+ if (_multData == 0) {
_vm->_parse->parseValExpr();
_vm->_parse->parseValExpr();
_vm->_parse->parseValExpr();
@@ -320,78 +315,78 @@ void Mult_v2::multSub(uint16 multindex) {
if (flags & 0x400) {
flags = 0x400;
- _multData2->animDirection = -1;
+ _multData->animDirection = -1;
} else {
- _multData2->animDirection = 1;
+ _multData->animDirection = 1;
flags &= 0x7F;
}
- _multData2->field_124[index][0] = flags;
+ _multData->field_124[index][0] = flags;
for (i = 1; i < 4; i++)
- _multData2->field_124[index][i] = _vm->_parse->parseValExpr();
+ _multData->field_124[index][i] = _vm->_parse->parseValExpr();
expr = _vm->_parse->parseValExpr();
- _multData2->animKeysFrames[index] = expr;
- _multData2->animKeysStartFrames[index] = expr;
+ _multData->animKeysFrames[index] = expr;
+ _multData->animKeysStartFrames[index] = expr;
WRITE_VAR(18 + index, expr);
if (expr == -1) {
if (_objects)
for (i = 0; i < 4; i++)
- if ((_multData2->field_124[index][i] != -1) && (_multData2->field_124[index][i] != 1024))
- _objects[_multData2->field_124[index][i]].pAnimData->animType =
- _objects[_multData2->field_124[index][i]].pAnimData->field_17;
+ if ((_multData->field_124[index][i] != -1) && (_multData->field_124[index][i] != 1024))
+ _objects[_multData->field_124[index][i]].pAnimData->animType =
+ _objects[_multData->field_124[index][i]].pAnimData->field_17;
} else {
- if (_multData2->animDirection == 1) {
- _multData2->animKeysStopFrames[index] = 32000;
- for (i = 0; i < _multData2->textKeysCount; i++) {
- textFrame = _multData2->textKeys[i].frame;
- if ((textFrame > _multData2->animKeysStartFrames[index]) &&
- (textFrame < _multData2->animKeysStopFrames[index])) {
- _multData2->animKeysStopFrames[index] = textFrame;
+ if (_multData->animDirection == 1) {
+ _multData->animKeysStopFrames[index] = 32000;
+ for (i = 0; i < _multData->textKeysCount; i++) {
+ textFrame = _multData->textKeys[i].frame;
+ if ((textFrame > _multData->animKeysStartFrames[index]) &&
+ (textFrame < _multData->animKeysStopFrames[index])) {
+ _multData->animKeysStopFrames[index] = textFrame;
}
}
} else {
- _multData2->animKeysStopFrames[index] = 0;
- for (i = 0; i < _multData2->textKeysCount; i++) {
- textFrame = _multData2->textKeys[i].frame;
- if ((textFrame < _multData2->animKeysStartFrames[index]) &&
- (textFrame > _multData2->animKeysStopFrames[index])) {
- _multData2->animKeysStopFrames[index] = textFrame;
+ _multData->animKeysStopFrames[index] = 0;
+ for (i = 0; i < _multData->textKeysCount; i++) {
+ textFrame = _multData->textKeys[i].frame;
+ if ((textFrame < _multData->animKeysStartFrames[index]) &&
+ (textFrame > _multData->animKeysStopFrames[index])) {
+ _multData->animKeysStopFrames[index] = textFrame;
}
}
}
if (_objects) {
for (i = 0; i < 4; i++) {
- if ((_multData2->field_124[index][i] != -1) && (_multData2->field_124[index][i] != 1024))
- _objects[_multData2->field_124[index][i]].pAnimData->field_17 =
- _objects[_multData2->field_124[index][i]].pAnimData->animType;
+ if ((_multData->field_124[index][i] != -1) && (_multData->field_124[index][i] != 1024))
+ _objects[_multData->field_124[index][i]].pAnimData->field_17 =
+ _objects[_multData->field_124[index][i]].pAnimData->animType;
}
}
for (i = 0; i < 4; i++) {
- _multData2->animKeysIndices[index][i] = 0;
- for (j = 0; j < _multData2->animKeysCount[i]; j++) {
- if (_multData2->animKeys[i][j].frame == _multData2->animKeysStartFrames[index])
- _multData2->animKeysIndices[index][i] = j;
+ _multData->animKeysIndices[index][i] = 0;
+ for (j = 0; j < _multData->animKeysCount[i]; j++) {
+ if (_multData->animKeys[i][j].frame == _multData->animKeysStartFrames[index])
+ _multData->animKeysIndices[index][i] = j;
}
}
- if (_multData2->animDirection == -1) { // loc_60CF
+ if (_multData->animDirection == -1) { // loc_60CF
warning("Mult_v2::multSub(), someKeys and someKeysIndices");
}
for (i = 0; i < 4; i++) {
- _multData2->field_17F[index][i] = 0;
- for (j = 0; j < _multData2->someKeysCount[i]; j++) {
- if (_multData2->animDirection == 1) {
- if (_multData2->someKeys[i][j].frame >= _multData2->animKeysStartFrames[index]) {
- _multData2->field_17F[index][i] = j;
+ _multData->field_17F[index][i] = 0;
+ for (j = 0; j < _multData->someKeysCount[i]; j++) {
+ if (_multData->animDirection == 1) {
+ if (_multData->someKeys[i][j].frame >= _multData->animKeysStartFrames[index]) {
+ _multData->field_17F[index][i] = j;
break;
}
} else {
- if (_multData2->someKeys[i][j].frame >= _multData2->animKeysStopFrames[index]) {
- _multData2->field_17F[index][i] = j;
+ if (_multData->someKeys[i][j].frame >= _multData->animKeysStopFrames[index]) {
+ _multData->field_17F[index][i] = j;
break;
}
}
@@ -407,7 +402,7 @@ void Mult_v2::playMult(int16 startFrame, int16 endFrame, char checkEscape,
Mult_Object *multObj;
Mult_AnimData *animData;
- if (_multData2 == 0)
+ if (_multData == 0)
return;
stopNoClear = 0;
@@ -425,7 +420,7 @@ void Mult_v2::playMult(int16 startFrame, int16 endFrame, char checkEscape,
// memcpy((char *)_palAnimPalette, (char *)_vm->_global->_pPaletteDesc->vgaPal, 768);
if (_vm->_anim->_animSurf == 0) {
- _vm->_util->setFrameRate(_multData2->frameRate);
+ _vm->_util->setFrameRate(_multData->frameRate);
_vm->_anim->_areaTop = 0;
_vm->_anim->_areaLeft = 0;
_vm->_anim->_areaWidth = _vm->_video->_surfWidth;
@@ -489,7 +484,7 @@ void Mult_v2::playMult(int16 startFrame, int16 endFrame, char checkEscape,
_animDataAllocated = 1;
for (_counter = 0; _counter < _objCount; _counter++) {
- _multData2->palAnimIndices[_counter] = _counter;
+ _multData->palAnimIndices[_counter] = _counter;
}
_animDataAllocated = 1;
@@ -569,37 +564,37 @@ void Mult_v2::playMult(int16 startFrame, int16 endFrame, char checkEscape,
WRITE_VAR(57, (uint32)-1);
} else
- WRITE_VAR(57, _frame - 1 - _multData2->frameStart);
+ WRITE_VAR(57, _frame - 1 - _multData->frameStart);
}
char Mult_v2::drawStatics(char stop) {
int i;
- if (_multData2->staticKeys[_multData2->staticKeysCount - 1].frame > _frame)
+ if (_multData->staticKeys[_multData->staticKeysCount - 1].frame > _frame)
stop = 0;
- for (_counter = 0; _counter < _multData2->staticKeysCount; _counter++) {
- if (_multData2->staticKeys[_counter].frame != _frame
- || _multData2->staticKeys[_counter].layer == -1)
+ for (_counter = 0; _counter < _multData->staticKeysCount; _counter++) {
+ if (_multData->staticKeys[_counter].frame != _frame
+ || _multData->staticKeys[_counter].layer == -1)
continue;
// loc_4FA8
- if (_multData2->staticKeys[_counter].layer >= 0) {
+ if (_multData->staticKeys[_counter].layer >= 0) {
_vm->_scenery->_curStatic = 0;
- _vm->_scenery->_curStaticLayer = _multData2->staticKeys[_counter].layer;
+ _vm->_scenery->_curStaticLayer = _multData->staticKeys[_counter].layer;
i = 0;
- while (_vm->_scenery->_statics[_multData2->staticIndices[i]].layersCount <= _vm->_scenery->_curStaticLayer) {
+ while (_vm->_scenery->_statics[_multData->staticIndices[i]].layersCount <= _vm->_scenery->_curStaticLayer) {
_vm->_scenery->_curStaticLayer -=
- _vm->_scenery->_statics[_multData2->staticIndices[i]].layersCount;
+ _vm->_scenery->_statics[_multData->staticIndices[i]].layersCount;
i++;
_vm->_scenery->_curStatic++;
}
- _vm->_scenery->_curStatic = _multData2->staticIndices[_vm->_scenery->_curStatic];
+ _vm->_scenery->_curStatic = _multData->staticIndices[_vm->_scenery->_curStatic];
_vm->_scenery->renderStatic(_vm->_scenery->_curStatic, _vm->_scenery->_curStaticLayer);
} else {
_vm->_draw->_spriteLeft =
- READ_LE_UINT16(_multData2->execPtr + ((-_multData2->staticKeys[_counter].layer - 2) * 2));
+ READ_LE_UINT16(_multData->execPtr + ((-_multData->staticKeys[_counter].layer - 2) * 2));
_vm->_draw->_destSpriteX = 0;
_vm->_draw->_destSpriteY = 0;
_vm->_draw->_destSurface = 21;
@@ -628,14 +623,14 @@ char Mult_v2::drawAnims(char stop) { // loc_50D5
int16 count;
for (i = 0; i < 4; i++) {
- if (_multData2->animKeys[i][_multData2->animKeysCount[i] - 1].frame > _frame)
+ if (_multData->animKeys[i][_multData->animKeysCount[i] - 1].frame > _frame)
stop = 0;
}
for (_index = 0; _index < 4; _index++) {
- for (_counter = 0; _counter < _multData2->animKeysCount[_index]; _counter++) {
- key = &_multData2->animKeys[_index][_counter];
- animObj = &_objects[_multData2->field_124[0][_index]];
+ for (_counter = 0; _counter < _multData->animKeysCount[_index]; _counter++) {
+ key = &_multData->animKeys[_index][_counter];
+ animObj = &_objects[_multData->field_124[0][_index]];
if (key->frame != _frame)
continue;
@@ -653,15 +648,15 @@ char Mult_v2::drawAnims(char stop) { // loc_50D5
animObj->tick = 0;
animObj->pAnimData->layer = key->layer;
- count = _vm->_scenery->_animations[_multData2->animIndices[0]].layersCount;
+ count = _vm->_scenery->_animations[_multData->animIndices[0]].layersCount;
i = 0;
while (animObj->pAnimData->layer >= count) {
animObj->pAnimData->layer -= count;
i++;
- count = _vm->_scenery->_animations[_multData2->animIndices[i]].layersCount;
+ count = _vm->_scenery->_animations[_multData->animIndices[i]].layersCount;
}
- animObj->pAnimData->animation = _multData2->animIndices[i];
+ animObj->pAnimData->animation = _multData->animIndices[i];
} else {
animObj->pAnimData->isStatic = 1;
}
@@ -675,21 +670,20 @@ void Mult_v2::drawText(char *pStop, char *pStopNoClear) {
char *savedIP;
int16 cmd;
- for (_index = 0; _index < _multData2->textKeysCount; _index++) {
- if (_multData2->textKeys[_index].frame != _frame)
+ for (_index = 0; _index < _multData->textKeysCount; _index++) {
+ if (_multData->textKeys[_index].frame != _frame)
continue;
- cmd = _multData2->textKeys[_index].cmd;
+ cmd = _multData->textKeys[_index].cmd;
if (cmd == 0) {
*pStop = 0;
} else if (cmd == 1) {
*pStopNoClear = 1;
- _multData2->frameStart = 0;
- _frameStart = 0;
+ _multData->frameStart = 0;
} else if (cmd == 3) {
*pStop = 0;
savedIP = _vm->_global->_inter_execPtr;
- _vm->_global->_inter_execPtr = (char *)(&_multData2->textKeys[_index].index);
+ _vm->_global->_inter_execPtr = (char *)(&_multData->textKeys[_index].index);
_vm->_global->_inter_execPtr = savedIP;
}
}
@@ -699,11 +693,11 @@ char Mult_v2::prepPalAnim(char stop) {
_palKeyIndex = -1;
do {
_palKeyIndex++;
- if (_palKeyIndex >= _multData2->palKeysCount)
+ if (_palKeyIndex >= _multData->palKeysCount)
return stop;
- } while (_multData2->palKeys[_palKeyIndex].frame != _frame);
+ } while (_multData->palKeys[_palKeyIndex].frame != _frame);
- if (_multData2->palKeys[_palKeyIndex].cmd == -1) {
+ if (_multData->palKeys[_palKeyIndex].cmd == -1) {
stop = 0;
_doPalSubst = 0;
_vm->_global->_pPaletteDesc->vgaPal = _oldPalette;
@@ -716,10 +710,10 @@ char Mult_v2::prepPalAnim(char stop) {
_doPalSubst = 1;
_palAnimKey = _palKeyIndex;
- _multData2->palAnimIndices[0] = 0;
- _multData2->palAnimIndices[1] = 0;
- _multData2->palAnimIndices[2] = 0;
- _multData2->palAnimIndices[3] = 0;
+ _multData->palAnimIndices[0] = 0;
+ _multData->palAnimIndices[1] = 0;
+ _multData->palAnimIndices[2] = 0;
+ _multData->palAnimIndices[3] = 0;
_vm->_global->_pPaletteDesc->vgaPal = _palAnimPalette;
}
@@ -736,7 +730,7 @@ void Mult_v2::doPalAnim(void) {
return;
for (_index = 0; _index < 4; _index++) {
- palKey = &_multData2->palKeys[_palAnimKey];
+ palKey = &_multData->palKeys[_palAnimKey];
if ((_frame % palKey->rates[_index]) != 0)
continue;
@@ -749,16 +743,16 @@ void Mult_v2::doPalAnim(void) {
_vm->_global->_pPaletteDesc->vgaPal[palKey->subst[0][_index] - 1].blue;
while (1) {
- off = palKey->subst[(_multData2->palAnimIndices[_index] + 1) % 16][_index];
+ off = palKey->subst[(_multData->palAnimIndices[_index] + 1) % 16][_index];
if (off == 0) {
- off = palKey->subst[_multData2->palAnimIndices[_index]][_index] - 1;
+ off = palKey->subst[_multData->palAnimIndices[_index]][_index] - 1;
_vm->_global->_pPaletteDesc->vgaPal[off].red = _palAnimRed[_index];
_vm->_global->_pPaletteDesc->vgaPal[off].green = _palAnimGreen[_index];
_vm->_global->_pPaletteDesc->vgaPal[off].blue = _palAnimBlue[_index];
} else {
- off = palKey->subst[(_multData2->palAnimIndices[_index] + 1) % 16][_index] - 1;
- off2 = palKey->subst[_multData2->palAnimIndices[_index]][_index] - 1;
+ off = palKey->subst[(_multData->palAnimIndices[_index] + 1) % 16][_index] - 1;
+ off2 = palKey->subst[_multData->palAnimIndices[_index]][_index] - 1;
_vm->_global->_pPaletteDesc->vgaPal[off2].red =
_vm->_global->_pPaletteDesc->vgaPal[off].red;
@@ -768,19 +762,19 @@ void Mult_v2::doPalAnim(void) {
_vm->_global->_pPaletteDesc->vgaPal[off].blue;
}
- _multData2->palAnimIndices[_index] = (_multData2->palAnimIndices[_index] + 1) % 16;
+ _multData->palAnimIndices[_index] = (_multData->palAnimIndices[_index] + 1) % 16;
- off = palKey->subst[_multData2->palAnimIndices[_index]][_index];
+ off = palKey->subst[_multData->palAnimIndices[_index]][_index];
if (off == 0) {
- _multData2->palAnimIndices[_index] = 0;
+ _multData->palAnimIndices[_index] = 0;
off = palKey->subst[0][_index] - 1;
_palAnimRed[_index] = _vm->_global->_pPaletteDesc->vgaPal[off].red;
_palAnimGreen[_index] = _vm->_global->_pPaletteDesc->vgaPal[off].green;
_palAnimBlue[_index] = _vm->_global->_pPaletteDesc->vgaPal[off].blue;
}
- if (_multData2->palAnimIndices[_index] == 0)
+ if (_multData->palAnimIndices[_index] == 0)
break;
}
}
@@ -809,8 +803,8 @@ void Mult_v2::doPalAnim(void) {
char Mult_v2::doFadeAnim(char stop) {
Mult_PalFadeKey *fadeKey;
- for (_index = 0; _index < _multData2->palFadeKeysCount; _index++) {
- fadeKey = &_multData2->palFadeKeys[_index];
+ for (_index = 0; _index < _multData->palFadeKeysCount; _index++) {
+ fadeKey = &_multData->palFadeKeys[_index];
if (fadeKey->frame != _frame)
continue;
@@ -818,14 +812,14 @@ char Mult_v2::doFadeAnim(char stop) {
stop = 0;
if ((fadeKey->flag & 1) == 0) {
if (fadeKey->fade == 0) {
- _vm->_global->_pPaletteDesc->vgaPal = _multData2->fadePal[fadeKey->palIndex];
+ _vm->_global->_pPaletteDesc->vgaPal = _multData->fadePal[fadeKey->palIndex];
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
} else {
- _vm->_global->_pPaletteDesc->vgaPal = _multData2->fadePal[fadeKey->palIndex];
+ _vm->_global->_pPaletteDesc->vgaPal = _multData->fadePal[fadeKey->palIndex];
_vm->_palanim->fade(_vm->_global->_pPaletteDesc, fadeKey->fade, 0);
}
} else {
- _vm->_global->_pPaletteDesc->vgaPal = _multData2->fadePal[fadeKey->palIndex];
+ _vm->_global->_pPaletteDesc->vgaPal = _multData->fadePal[fadeKey->palIndex];
_vm->_palanim->fade(_vm->_global->_pPaletteDesc, fadeKey->fade, -1);
_palFadingRed = (fadeKey->flag >> 1) & 1;
@@ -851,8 +845,8 @@ char Mult_v2::doFadeAnim(char stop) {
char Mult_v2::doSoundAnim(char stop, int16 frame) {
Mult_SndKey *sndKey;
- for (_index = 0; _index < _multData2->sndKeysCount; _index++) {
- sndKey = &_multData2->sndKeys[_index];
+ for (_index = 0; _index < _multData->sndKeysCount; _index++) {
+ sndKey = &_multData->sndKeys[_index];
if (sndKey->frame != frame)
continue;
@@ -883,20 +877,20 @@ void Mult_v2::sub_62DD(int16 index) {
int16 curAnim;
int i, j;
- frame = _multData2->animKeysFrames[index];
+ frame = _multData->animKeysFrames[index];
if (frame == -1)
return;
for (i = 0; i < 4; i++) {
- if (_multData2->field_124[index][i] != -1) {
- for (j = _multData2->animKeysIndices[index][i]; j < _multData2->animKeysCount[i]; j++) {
- if ((i >= 4) || (j >= _multData2->animKeysCount[i]))
+ if (_multData->field_124[index][i] != -1) {
+ for (j = _multData->animKeysIndices[index][i]; j < _multData->animKeysCount[i]; j++) {
+ if ((i >= 4) || (j >= _multData->animKeysCount[i]))
continue;
- animKey = &_multData2->animKeys[i][j];
+ animKey = &_multData->animKeys[i][j];
if (animKey->frame == frame) {
- animObj = &_objects[_multData2->field_124[index][i]];
+ animObj = &_objects[_multData->field_124[index][i]];
if (animKey->layer > -1) {
- _multData2->animKeysIndices[index][i] = j;
+ _multData->animKeysIndices[index][i] = j;
(*animObj->pPosX) = animKey->posX;
(*animObj->pPosY) = animKey->posY;
animObj->pAnimData->frame = 0;
@@ -906,18 +900,18 @@ void Mult_v2::sub_62DD(int16 index) {
animObj->pAnimData->maxTick = 0;
animObj->pAnimData->animation = 0;
animObj->tick = 0;
- curAnim = _multData2->animIndices[0];
+ curAnim = _multData->animIndices[0];
layer = animKey->layer;
layers = _vm->_scenery->_animations[curAnim].layersCount;
while (layer >= layers) {
layer -= layers;
animObj->pAnimData->animation++;
- curAnim = _multData2->animIndices[animObj->pAnimData->animation];
+ curAnim = _multData->animIndices[animObj->pAnimData->animation];
layers = _vm->_scenery->_animations[curAnim].layersCount;
}
animObj->pAnimData->layer = layer;
animObj->pAnimData->animation =
- _multData2->animIndices[animObj->pAnimData->animation];
+ _multData->animIndices[animObj->pAnimData->animation];
break;
} else
animObj->pAnimData->isStatic = 1;
@@ -926,37 +920,37 @@ void Mult_v2::sub_62DD(int16 index) {
}
}
- if (_multData2->field_124[index][i] != -1) {
- for (j = _multData2->field_17F[index][i]; j < _multData2->someKeysCount[i]; j++) {
- someKey1 = &_multData2->someKeys[i][j];
- someKey2 = &_multData2->someKeys[i][j-1];
+ if (_multData->field_124[index][i] != -1) {
+ for (j = _multData->field_17F[index][i]; j < _multData->someKeysCount[i]; j++) {
+ someKey1 = &_multData->someKeys[i][j];
+ someKey2 = &_multData->someKeys[i][j-1];
if (someKey1->frame == frame) {
if (someKey1->field_2 != -1) {
- _multData2->someKeysIndices[0] = -1;
- _multData2->someKeysIndices[1] = -1;
- _multData2->someKeysIndices[2] = -1;
- _multData2->someKeysIndices[3] = -1;
- if ((_multData2->animDirection == 1) || (someKey2->field_2 == 1))
- _multData2->someKeysIndices[i] = j;
- else if (_multData2->animKeysStopFrames[index] == frame)
- _multData2->someKeysIndices[i] = -1;
+ _multData->someKeysIndices[0] = -1;
+ _multData->someKeysIndices[1] = -1;
+ _multData->someKeysIndices[2] = -1;
+ _multData->someKeysIndices[3] = -1;
+ if ((_multData->animDirection == 1) || (someKey2->field_2 == 1))
+ _multData->someKeysIndices[i] = j;
+ else if (_multData->animKeysStopFrames[index] == frame)
+ _multData->someKeysIndices[i] = -1;
else
- _multData2->someKeysIndices[i] = j - 1;
+ _multData->someKeysIndices[i] = j - 1;
} else
- _multData2->someKeysIndices[i] = -1;
+ _multData->someKeysIndices[i] = -1;
} else if (someKey1->frame > frame)
break;
}
}
- if (_multData2->someKeysIndices[i] != -1) {
+ if (_multData->someKeysIndices[i] != -1) {
/*
- int arg3 = frame - _multData2->someKeys[i][_multData2->someKeysIndices[i]].field_0;
- int arg2 = _multData2->animDirection;
+ int arg3 = frame - _multData->someKeys[i][_multData->someKeysIndices[i]].field_0;
+ int arg2 = _multData->animDirection;
if ((arg2 != 1) && (--arg3 > 0))
arg3 = 0;
- int arg1 = _multData2->someKeys[i][_multData2->someKeysIndices[i]];
+ int arg1 = _multData->someKeys[i][_multData->someKeysIndices[i]];
// somepointer09 is 14 bytes wide (surely a struct)
- int arg0 = _multData2->somepointer09[-_multData2->someKeys[i][_multData2->someKeysIndices[i]].field_2 - 2];
+ int arg0 = _multData->somepointer09[-_multData->someKeys[i][_multData->someKeysIndices[i]].field_2 - 2];
*/
warning("GOB2 Stub! sub_1CBF8(arg0, arg1, arg2, arg3);");
}
@@ -965,23 +959,23 @@ void Mult_v2::sub_62DD(int16 index) {
doSoundAnim(0, frame);
WRITE_VAR(22, frame);
- if (_multData2->animKeysStopFrames[index] == frame) {
- _multData2->someKeysIndices[0] = -1;
- _multData2->someKeysIndices[1] = -1;
- _multData2->someKeysIndices[2] = -1;
- _multData2->someKeysIndices[3] = -1;
+ if (_multData->animKeysStopFrames[index] == frame) {
+ _multData->someKeysIndices[0] = -1;
+ _multData->someKeysIndices[1] = -1;
+ _multData->someKeysIndices[2] = -1;
+ _multData->someKeysIndices[3] = -1;
frame = -1;
for (i = 0; i < 4; i++)
- if ((_multData2->field_124[index][i] != -1) && (_multData2->field_124[index][i] != 1024))
- _objects[_multData2->field_124[index][i]].pAnimData->animType =
- _objects[_multData2->field_124[index][i]].pAnimData->field_17;
- } else if (_multData2->animDirection == 1)
+ if ((_multData->field_124[index][i] != -1) && (_multData->field_124[index][i] != 1024))
+ _objects[_multData->field_124[index][i]].pAnimData->animType =
+ _objects[_multData->field_124[index][i]].pAnimData->field_17;
+ } else if (_multData->animDirection == 1)
frame++;
else
frame--;
// loc_6A06
- _multData2->animKeysFrames[index] = frame;
+ _multData->animKeysFrames[index] = frame;
WRITE_VAR(18 + index, frame);
}
@@ -992,8 +986,7 @@ void Mult_v2::sub_6A35(void) {
for (i = 0; i < 8; i++)
if (_multDatas[i] != 0) {
- _multData2 = _multDatas[i];
- _frameStart = _multData2->frameStart; // Temporarily to sync _frameStart and _multData2->frameStart
+ _multData = _multDatas[i];
for (j = 0; j < 4; j++)
sub_62DD(j);
}
@@ -1323,45 +1316,45 @@ void Mult_v2::freeMultKeys(void) {
char animCount;
char staticCount;
- if (_multData2 == 0)
+ if (_multData == 0)
return;
- staticCount = (_multData2->staticCount + 1) & 0x7F;
- animCount = _multData2->animCount + 1;
+ staticCount = (_multData->staticCount + 1) & 0x7F;
+ animCount = _multData->animCount + 1;
for (i = 0; i < staticCount; i++) { // loc_7345
- if (_multData2->staticLoaded[i] != 0)
- _vm->_scenery->freeStatic(_multData2->staticIndices[i]);
+ if (_multData->staticLoaded[i] != 0)
+ _vm->_scenery->freeStatic(_multData->staticIndices[i]);
}
for (i = 0; i < animCount; i++) { // loc_7377
- if (_multData2->animLoaded[i] != 0)
- _vm->_scenery->freeAnim(_multData2->animIndices[i]);
+ if (_multData->animLoaded[i] != 0)
+ _vm->_scenery->freeAnim(_multData->animIndices[i]);
}
- delete[] _multData2->staticKeys;
+ delete[] _multData->staticKeys;
for (i = 0; i < 4; i++) { // loc_73BA
- delete[] _multData2->animKeys[i];
- if (_multData2->someKeys[i] != 0)
- delete[] _multData2->someKeys[i];
+ delete[] _multData->animKeys[i];
+ if (_multData->someKeys[i] != 0)
+ delete[] _multData->someKeys[i];
}
- delete[] _multData2->palFadeKeys;
- delete[] _multData2->palKeys;
- delete[] _multData2->textKeys;
+ delete[] _multData->palFadeKeys;
+ delete[] _multData->palKeys;
+ delete[] _multData->textKeys;
- for (i = 0; i < _multData2->sndSlotsCount; i++) { // loc_7448
- if ((_multData2->sndSlot[i] & 0x8000) == 0)
- _vm->_game->freeSoundSlot(_multData2->sndSlot[i]);
+ for (i = 0; i < _multData->sndSlotsCount; i++) { // loc_7448
+ if ((_multData->sndSlot[i] & 0x8000) == 0)
+ _vm->_game->freeSoundSlot(_multData->sndSlot[i]);
}
- delete[] _multData2->sndKeys;
+ delete[] _multData->sndKeys;
- if (_multData2->somepointer09 != 0)
- delete[] _multData2->somepointer09;
- if (_multData2->somepointer10 != 0)
- delete[] _multData2->somepointer10;
+ if (_multData->somepointer09 != 0)
+ delete[] _multData->somepointer09;
+ if (_multData->somepointer10 != 0)
+ delete[] _multData->somepointer10;
if (_animDataAllocated != 0) {
freeMult();
@@ -1379,12 +1372,11 @@ void Mult_v2::freeMultKeys(void) {
}
for (i = 0; i < 8; i++)
- if (_multDatas[i] == _multData2)
+ if (_multDatas[i] == _multData)
_multDatas[i] = 0;
- delete _multData2;
- _multData2 = 0;
- _frameStart = 0; // Temporarily to sync _frameStart and _multData2->frameStart
+ delete _multData;
+ _multData = 0;
}
} // End of namespace Gob