diff options
author | Sven Hesse | 2006-06-10 14:37:48 +0000 |
---|---|---|
committer | Sven Hesse | 2006-06-10 14:37:48 +0000 |
commit | 897fa6a5a64a3424ae4ea83b1c7cad77ac7e8200 (patch) | |
tree | 527cb68aa7f5c9cff8f7f01038c4ef2c100db883 /engines | |
parent | f5fdbcddfb54510ef9f44e4f57d68d84f9055757 (diff) | |
download | scummvm-rg350-897fa6a5a64a3424ae4ea83b1c7cad77ac7e8200.tar.gz scummvm-rg350-897fa6a5a64a3424ae4ea83b1c7cad77ac7e8200.tar.bz2 scummvm-rg350-897fa6a5a64a3424ae4ea83b1c7cad77ac7e8200.zip |
More stub-filling + small clean-up
svn-id: r23012
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/draw.cpp | 50 | ||||
-rw-r--r-- | engines/gob/draw.h | 4 | ||||
-rw-r--r-- | engines/gob/draw_v1.cpp | 5 | ||||
-rw-r--r-- | engines/gob/draw_v2.cpp | 50 | ||||
-rw-r--r-- | engines/gob/goblin.cpp | 12 | ||||
-rw-r--r-- | engines/gob/inter_v2.cpp | 29 | ||||
-rw-r--r-- | engines/gob/map.h | 2 | ||||
-rw-r--r-- | engines/gob/map_v2.cpp | 4 | ||||
-rw-r--r-- | engines/gob/mult.cpp | 14 | ||||
-rw-r--r-- | engines/gob/mult.h | 30 | ||||
-rw-r--r-- | engines/gob/mult_v1.cpp | 14 | ||||
-rw-r--r-- | engines/gob/mult_v2.cpp | 208 | ||||
-rw-r--r-- | engines/gob/scenery.cpp | 3 |
13 files changed, 248 insertions, 177 deletions
diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp index 78f25a19b8..ff023640af 100644 --- a/engines/gob/draw.cpp +++ b/engines/gob/draw.cpp @@ -478,56 +478,6 @@ void Draw::adjustCoords(char adjust, int16 *coord1, int16 *coord2) { } } -void Draw::initBigSprite(int16 index, int16 width, int16 height, int16 flags) { - int i; - int16 partsheight; - int16 remainheight; - int8 fragment; - - if (flags != 0) - flags = 2; - - // .-- sub_CBD0 --- - - for (i = 0; i < 3; i++) - _bigSpritesParts[index][i] = 0; - _spritesHeights[index] = height; - - if (_vm->_video->getRectSize(width, height, flags, _vm->_global->_videoMode) > 65000) { - _spritesHeights[index] = height & 0xFFFE; - while (_vm->_video->getRectSize(width, _spritesHeights[index], flags, - _vm->_global->_videoMode) > 65000) { - _spritesHeights[index] -= 2; - } - - partsheight = _spritesHeights[index]; - _spritesArray[index] = - _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, partsheight, flags); - fragment = 0; - while (partsheight < height) { - remainheight = height - partsheight; - if (_spritesHeights[index] >= remainheight) { - _bigSpritesParts[index][fragment] = - _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, - remainheight, flags); - partsheight = height; - } else { - _bigSpritesParts[index][fragment] = - _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, - _spritesHeights[index], flags); - partsheight += _spritesHeights[index]; - } - _vm->_video->clearSurf(_bigSpritesParts[index][fragment]); - fragment++; - } - } else - _spritesArray[index] = - _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, height, flags); - - _vm->_video->clearSurf(_spritesArray[index]); - // '------ -} - void Draw::fillRect(int16 index, int16 left, int16 top, int16 right, int16 bottom, int16 color) { int i; diff --git a/engines/gob/draw.h b/engines/gob/draw.h index 76d53a5108..f9350b816d 100644 --- a/engines/gob/draw.h +++ b/engines/gob/draw.h @@ -119,7 +119,6 @@ public: void freeSprite(int16 index); void adjustCoords(char adjust, int16 *coord1, int16 *coord2); - void initBigSprite(int16 index, int16 width, int16 height, int16 flags); void fillRect(int16 index, int16 left, int16 top, int16 right, int16 bottom, int16 color); void drawSprite(int16 source, int16 dest, int16 left, @@ -133,6 +132,7 @@ public: void printTextCentered(int16 arg_0, int16 left, int16 top, int16 right, int16 bottom, char *str, int16 fontIndex, int16 color); + virtual void initBigSprite(int16 index, int16 width, int16 height, int16 flags) = 0; virtual void printText(void) = 0; virtual void spriteOperation(int16 operation) = 0; @@ -145,6 +145,7 @@ protected: class Draw_v1 : public Draw { public: + virtual void initBigSprite(int16 index, int16 width, int16 height, int16 flags); virtual void printText(void); virtual void spriteOperation(int16 operation); @@ -154,6 +155,7 @@ public: class Draw_v2 : public Draw_v1 { public: + virtual void initBigSprite(int16 index, int16 width, int16 height, int16 flags); virtual void printText(void); virtual void spriteOperation(int16 operation); diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp index 2c0725dd9b..7307c169ba 100644 --- a/engines/gob/draw_v1.cpp +++ b/engines/gob/draw_v1.cpp @@ -38,6 +38,11 @@ namespace Gob { Draw_v1::Draw_v1(GobEngine *vm) : Draw(vm) { } +void Draw_v1::initBigSprite(int16 index, int16 width, int16 height, int16 flags) { + _vm->_draw->_spritesArray[index] = + _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, height, flags); +} + void Draw_v1::printText(void) { int16 savedFlags; int16 ldestSpriteX; diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index 4e759e024d..426bf825dc 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -38,6 +38,56 @@ namespace Gob { Draw_v2::Draw_v2(GobEngine *vm) : Draw_v1(vm) { } +void Draw_v2::initBigSprite(int16 index, int16 width, int16 height, int16 flags) { + int i; + int16 partsheight; + int16 remainheight; + int8 fragment; + + if (flags != 0) + flags = 2; + + // .-- sub_CBD0 --- + + for (i = 0; i < 3; i++) + _bigSpritesParts[index][i] = 0; + _spritesHeights[index] = height; + + if (_vm->_video->getRectSize(width, height, flags, _vm->_global->_videoMode) > 65000) { + _spritesHeights[index] = height & 0xFFFE; + while (_vm->_video->getRectSize(width, _spritesHeights[index], flags, + _vm->_global->_videoMode) > 65000) { + _spritesHeights[index] -= 2; + } + + partsheight = _spritesHeights[index]; + _spritesArray[index] = + _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, partsheight, flags); + fragment = 0; + while (partsheight < height) { + remainheight = height - partsheight; + if (_spritesHeights[index] >= remainheight) { + _bigSpritesParts[index][fragment] = + _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, + remainheight, flags); + partsheight = height; + } else { + _bigSpritesParts[index][fragment] = + _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, + _spritesHeights[index], flags); + partsheight += _spritesHeights[index]; + } + _vm->_video->clearSurf(_bigSpritesParts[index][fragment]); + fragment++; + } + } else + _spritesArray[index] = + _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, height, flags); + + _vm->_video->clearSurf(_spritesArray[index]); + // '------ +} + void Draw_v2::printText(void) { int i; char *dataPtr; diff --git a/engines/gob/goblin.cpp b/engines/gob/goblin.cpp index a0d93469f5..84e5fc798f 100644 --- a/engines/gob/goblin.cpp +++ b/engines/gob/goblin.cpp @@ -1816,7 +1816,7 @@ void Goblin::sub_19BD3(void) { si = anim0->state; di = anim1->state; - if (anim0->someFlag == 0) { + if (anim0->isBusy == 0) { if ((_word_2F9BC == 0) && (anim0->isStatic == 0)) { if ((VAR(_dword_2F9B6) == 0) && (si == 28)) { si = _vm->_util->getRandom(3) + 24; @@ -1828,7 +1828,7 @@ void Goblin::sub_19BD3(void) { if ((si == 8) || (si == 9) || (si == 29)) anim0->curLookDir = 6; } - if (anim1->someFlag == 0) { + if (anim1->isBusy == 0) { if ((_word_2F9BA == 0) && (anim1->isStatic == 0)) { if ((VAR(_dword_2F9B2) == 0) && (di == 28)) { di = _vm->_util->getRandom(3) + 24; @@ -1841,10 +1841,10 @@ void Goblin::sub_19BD3(void) { anim1->curLookDir = 6; } - if ((anim0->someFlag == 1) && (anim0->isStatic == 0) && + if ((anim0->isBusy == 1) && (anim0->isStatic == 0) && ((anim0->state == 28) || (anim0->state == 29))) anim0->curLookDir = 0; - if ((anim1->someFlag == 1) && (anim1->isStatic == 0) && + if ((anim1->isBusy == 1) && (anim1->isStatic == 0) && ((anim1->state == 28) || (anim1->state == 29))) anim1->curLookDir = 0; @@ -1853,7 +1853,7 @@ void Goblin::sub_19BD3(void) { anim0->curLookDir = 4; else if (anim0->layer == 45) anim0->curLookDir = 0; - if (anim0->someFlag == 0) + if (anim0->isBusy == 0) anim0->curLookDir = 6; } if (VAR(19) != ((uint32) -1)) { @@ -1861,7 +1861,7 @@ void Goblin::sub_19BD3(void) { anim1->curLookDir = 4; else if (anim1->layer == 49) anim1->curLookDir = 0; - if (anim1->someFlag == 0) + if (anim1->isBusy == 0) anim1->curLookDir = 6; } diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index d47517ff7a..a7bceee98e 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -892,6 +892,7 @@ int16 Inter_v2::loadSound(int16 search) { *dataPtr ^= 0x80; _vm->_game->_soundTypes[slot] = 4; _vm->_game->_soundSamples[slot] = soundDesc; + _vm->_game->_soundFromExt[slot] = 1; } else { // loc_99BC extData = _vm->_game->loadExtData(id, 0, 0); if (extData == 0) @@ -902,6 +903,7 @@ int16 Inter_v2::loadSound(int16 search) { else // TODO: This is very ugly _vm->_game->_soundSamples[slot] = (Snd::SoundDesc *) extData; + _vm->_game->_soundFromExt[slot] = 1; } } else { // loc_9A13 extData = _vm->_game->loadTotResource(id); @@ -984,7 +986,7 @@ void Inter_v2::o2_moveGoblin(void) { obj->gobDestY = destY; objAnim->field_13 = destX; objAnim->field_14 = destY; - if (objAnim->someFlag != 0) { + if (objAnim->isBusy != 0) { if ((destX == -1) && (destY == -1)) { mouseX = _vm->_global->_inter_mouseX; mouseY = _vm->_global->_inter_mouseY; @@ -1101,6 +1103,7 @@ void Inter_v2::loadMult(void) { int16 objIndex; // si int16 i; int16 animation; + int16 layer; char *lmultData; Mult::Mult_Object *obj; Mult::Mult_AnimData *objAnim; @@ -1135,15 +1138,17 @@ void Inter_v2::loadMult(void) { obj->gobDestY = val; obj->goblinY = val; *obj->pPosX *= _vm->_map->_tilesWidth; + layer = objAnim->layer; + animation = obj->goblinStates[layer][0].animation; objAnim->field_15 = objAnim->unknown; objAnim->nextState = -1; objAnim->field_F = -1; objAnim->pathExistence = 0; - objAnim->state = objAnim->layer; + objAnim->isBusy = 0; + objAnim->state = layer; objAnim->layer = obj->goblinStates[objAnim->state][0].layer; - objAnim->animation = obj->goblinStates[objAnim->state][0].animation; - animation = objAnim->animation; - _vm->_scenery->updateAnim(objAnim->state, 0, 0, 0, *obj->pPosX, *obj->pPosY, 0); + objAnim->animation = animation; + _vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 0); if (!_vm->_map->_bigTiles) { *obj->pPosY = (obj->goblinY + 1) * _vm->_map->_tilesHeight - (_vm->_scenery->_animBottom - _vm->_scenery->_animTop); @@ -1159,16 +1164,18 @@ void Inter_v2::loadMult(void) { obj = &_vm->_mult->_objects[objIndex]; objAnim = obj->pAnimData; + layer = objAnim->layer; + animation = obj->goblinStates[layer][0].animation; objAnim->nextState = -1; objAnim->field_F = -1; - objAnim->state = objAnim->layer; + objAnim->state = layer; objAnim->layer = obj->goblinStates[objAnim->state][0].layer; - objAnim->animation = obj->goblinStates[objAnim->state][0].animation; + objAnim->animation = animation; if ((*obj->pPosX == 1000) && (*obj->pPosY == 1000)) { *obj->pPosX = _vm->_scenery->_animations[objAnim->animation].layers[objAnim->state]->posX; *obj->pPosY = _vm->_scenery->_animations[objAnim->animation].layers[objAnim->state]->posY; } - _vm->_scenery->updateAnim(objAnim->state, 0, objAnim->animation, 0, *obj->pPosX, *obj->pPosY, 0); + _vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 0); } } } @@ -1599,8 +1606,8 @@ 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)); +/* _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]; @@ -1630,7 +1637,7 @@ void Inter_v2::o2_initMult(void) { if (_vm->_anim->_animSurf != 0 && (oldAnimWidth != _vm->_anim->_areaWidth || oldAnimHeight != _vm->_anim->_areaHeight)) { - if (_vm->_anim->_animSurf->flag & 0x80) + if (_vm->_anim->_animSurf->vidMode & 0x80) _vm->_draw->freeSprite(0x16); else delete _vm->_anim->_animSurf; diff --git a/engines/gob/map.h b/engines/gob/map.h index 6be36b21ff..c550fe0add 100644 --- a/engines/gob/map.h +++ b/engines/gob/map.h @@ -152,7 +152,7 @@ public: } Map_v2(GobEngine *vm); - virtual ~Map_v2() {}; + virtual ~Map_v2(); }; } // End of namespace Gob diff --git a/engines/gob/map_v2.cpp b/engines/gob/map_v2.cpp index fa982fbbaa..8dc541c4fd 100644 --- a/engines/gob/map_v2.cpp +++ b/engines/gob/map_v2.cpp @@ -40,6 +40,10 @@ namespace Gob { Map_v2::Map_v2(GobEngine *vm) : Map_v1(vm) { } +Map_v2::~Map_v2() { + _passMap = 0; +} + void Map_v2::loadMapObjects(char *avjFile) { int i; int j; diff --git a/engines/gob/mult.cpp b/engines/gob/mult.cpp index 1e161d78bc..f48d7f7ea5 100644 --- a/engines/gob/mult.cpp +++ b/engines/gob/mult.cpp @@ -139,20 +139,6 @@ void Mult::interGetObjAnimSize(void) { WRITE_VAR_OFFSET(_vm->_parse->parseVarIndex(), _vm->_scenery->_toRedrawBottom); } -void Mult::freeMult(void) { - if (_vm->_anim->_animSurf != 0) - _vm->_video->freeSurfDesc(_vm->_anim->_animSurf); - - delete[] _objects; - delete[] _renderData; - delete[] _orderArray; - - _objects = 0; - _renderData = 0; - _orderArray = 0; - _vm->_anim->_animSurf = 0; -} - void Mult::freeAll(void) { int16 i; diff --git a/engines/gob/mult.h b/engines/gob/mult.h index 0ee6879d5b..05241cad29 100644 --- a/engines/gob/mult.h +++ b/engines/gob/mult.h @@ -46,20 +46,20 @@ public: int8 newAnimation; byte intersected; int8 newCycle; - int8 somethingAnimation; // New in GOB2 - int8 somethingLayer; // New in GOB2 - int8 somethingFrame; // New in GOB2 - int8 someFlag; // New in GOB2 int8 state; // New in GOB2 int8 nextState; // New in GOB2 int8 field_F; // New in GOB2 int8 curLookDir; // New in GOB2 + int8 isBusy; // New in GOB2 int8 pathExistence; // New in GOB2 int8 field_13; // New in GOB2 int8 field_14; // New in GOB2 int8 field_15; // New in GOB2 int8 field_16; // New in GOB2 int8 field_17; // New in GOB2 + int8 somethingAnimation; // New in GOB2 + int8 somethingLayer; // New in GOB2 + int8 somethingFrame; // New in GOB2 } GCC_PACK; struct Mult_GobState { @@ -144,6 +144,18 @@ public: int16 resId; int16 soundIndex; } GCC_PACK; + + struct Mult_SomeKey { + int16 frame; + int16 field_2; + int16 field_4; + int16 field_6; + int16 field_8; + int16 field_A; + int16 field_C; + int16 field_E; + } GCC_PACK; + #pragma END_PACK_STRUCTS // Globals @@ -219,7 +231,6 @@ public: void zeroMultData(void); void checkFreeMult(void); void interGetObjAnimSize(void); - void freeMult(void); void freeAll(void); void initAll(void); @@ -231,6 +242,7 @@ public: virtual void animate(void) = 0; virtual void playSound(Snd::SoundDesc * soundDesc, int16 repCount, int16 freq, int16 channel) = 0; + virtual void freeMult(void) = 0; virtual void freeMultKeys(void) = 0; Mult(GobEngine *vm); @@ -262,6 +274,7 @@ public: virtual void animate(void); virtual void playSound(Snd::SoundDesc * soundDesc, int16 repCount, int16 freq, int16 channel); + virtual void freeMult(void); virtual void freeMultKeys(void); protected: @@ -318,9 +331,9 @@ public: int16 field_15F[4][4]; int16 field_17F[4][4]; - int16 somepointer05size[4]; - char *somepointer05[4]; // Seems to be similar to staticKeys/animKeys - int16 somepointer05indices[4]; + int16 someKeysCount[4]; + Mult_SomeKey *someKeys[4]; + int16 someKeysIndices[4]; char *somepointer09; // ? char *somepointer10; // ? char *execPtr; @@ -344,6 +357,7 @@ public: virtual void animate(void); virtual void playSound(Snd::SoundDesc * soundDesc, int16 repCount, int16 freq, int16 channel); + virtual void freeMult(void); virtual void freeMultKeys(void); protected: diff --git a/engines/gob/mult_v1.cpp b/engines/gob/mult_v1.cpp index 7ceeee1787..ef59283de3 100644 --- a/engines/gob/mult_v1.cpp +++ b/engines/gob/mult_v1.cpp @@ -912,6 +912,20 @@ void Mult_v1::animate(void) { } } +void Mult_v1::freeMult(void) { + if (_vm->_anim->_animSurf != 0) + _vm->_video->freeSurfDesc(_vm->_anim->_animSurf); + + delete[] _objects; + delete[] _renderData; + delete[] _orderArray; + + _objects = 0; + _renderData = 0; + _orderArray = 0; + _vm->_anim->_animSurf = 0; +} + void Mult_v1::playSound(Snd::SoundDesc * soundDesc, int16 repCount, int16 freq, int16 channel) { _vm->_snd->playSample(soundDesc, repCount, freq); diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp index a1f80ea4e8..91b922dc7e 100644 --- a/engines/gob/mult_v2.cpp +++ b/engines/gob/mult_v2.cpp @@ -42,6 +42,7 @@ namespace Gob { Mult_v2::Mult_v2(GobEngine *vm) : Mult_v1(vm) { int i; + _renderData2 = 0; _multData2 = 0; for (i = 0; i < 8; i++) _multDatas[i] = 0; } @@ -147,9 +148,9 @@ void Mult_v2::loadMult(int16 resId) { } for (i = 0; i < 4; i++) { - _multData2->somepointer05size[i] = 0; - _multData2->somepointer05[i] = 0; - _multData2->somepointer05indices[i] = -1; + _multData2->someKeysCount[i] = 0; + _multData2->someKeys[i] = 0; + _multData2->someKeysIndices[i] = -1; for (j = 0; j < 4; j++) { _multData2->field_15F[i][j] = 0; @@ -284,11 +285,18 @@ void Mult_v2::loadMult(int16 resId) { _vm->_global->_inter_execPtr += size * 14; _dataPtr += 2; for (i = 0; i < 4; i++) { - _multData2->somepointer05size[i] = (int16)READ_LE_UINT16(_dataPtr); + _multData2->someKeysCount[i] = (int16)READ_LE_UINT16(_dataPtr); _dataPtr += 2; - _multData2->somepointer05[i] = new char[_multData2->somepointer05size[i] * 16]; - for (j = 0; j < _multData2->somepointer05size[i]; j++) { - memcpy(_multData2->somepointer05[i]+j*16, _dataPtr, 16); + _multData2->someKeys[i] = new Mult_SomeKey[_multData2->someKeysCount[i]]; + for (j = 0; j < _multData2->someKeysCount[i]; j++) { + _multData2->someKeys[i][j].frame = (int16)READ_LE_UINT16(_dataPtr); + _multData2->someKeys[i][j].field_2 = (int16)READ_LE_UINT16(_dataPtr + 2); + _multData2->someKeys[i][j].field_4 = (int16)READ_LE_UINT16(_dataPtr + 4); + _multData2->someKeys[i][j].field_6 = (int16)READ_LE_UINT16(_dataPtr + 6); + _multData2->someKeys[i][j].field_8 = (int16)READ_LE_UINT16(_dataPtr + 8); + _multData2->someKeys[i][j].field_A = (int16)READ_LE_UINT16(_dataPtr + 10); + _multData2->someKeys[i][j].field_C = (int16)READ_LE_UINT16(_dataPtr + 12); + _multData2->someKeys[i][j].field_E = (int16)READ_LE_UINT16(_dataPtr + 14); _dataPtr += 16; } } @@ -311,9 +319,9 @@ void Mult_v2::multSub(uint16 multindex) { uint16 flags; int16 expr; int16 textFrame; + int16 index; // di int i; int j; - int16 di; flags = multindex; multindex = (multindex >> 12) & 0xF; @@ -333,13 +341,13 @@ void Mult_v2::multSub(uint16 multindex) { } if (flags & 0x200) - di = 3; + index = 3; else if (flags & 0x100) - di = 2; + index = 2; else if (flags & 0x80) - di = 1; + index = 1; else - di = 0; + index = 0; if (flags & 0x400) { flags = 0x400; @@ -349,64 +357,78 @@ void Mult_v2::multSub(uint16 multindex) { flags &= 0x7F; } - _multData2->field_124[di][0] = flags; + _multData2->field_124[index][0] = flags; for (i = 1; i < 4; i++) { - _multData2->field_124[di][i] = _vm->_parse->parseValExpr(); + _multData2->field_124[index][i] = _vm->_parse->parseValExpr(); } expr = _vm->_parse->parseValExpr(); - _multData2->animKeysIndices1[di] = expr; - _multData2->animKeysIndices2[di] = expr; + _multData2->animKeysIndices1[index] = expr; + _multData2->animKeysIndices2[index] = expr; - WRITE_VAR(18 + di, expr); - if (expr == -1) { // loc_5D0E + WRITE_VAR(18 + index, expr); + if (expr == -1) { if (_objects) for (i = 0; i < 4; i++) - if ((_multData2->field_124[di][i] != -1) && (_multData2->field_124[di][i] != 1024)) - _objects[_multData2->field_124[di][i]].pAnimData->animType = - _objects[_multData2->field_124[di][i]].pAnimData->field_17; - } else { // loc_5DDC + 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->field_156 == 1) { - _multData2->field_157[di] = 32000; + _multData2->field_157[index] = 32000; for (i = 0; i < _multData2->textKeysCount; i++) { textFrame = _multData2->textKeys[i].frame; - if ((textFrame > _multData2->animKeysIndices2[di]) && - (textFrame < _multData2->field_157[di])) { - _multData2->field_157[di] = textFrame; + if ((textFrame > _multData2->animKeysIndices2[index]) && + (textFrame < _multData2->field_157[index])) { + _multData2->field_157[index] = textFrame; } } } else { - _multData2->field_157[di] = 0; + _multData2->field_157[index] = 0; for (i = 0; i < _multData2->textKeysCount; i++) { textFrame = _multData2->textKeys[i].frame; - if ((textFrame < _multData2->animKeysIndices2[di]) && - (textFrame > _multData2->field_157[di])) { - _multData2->field_157[di] = textFrame; + if ((textFrame < _multData2->animKeysIndices2[index]) && + (textFrame > _multData2->field_157[index])) { + _multData2->field_157[index] = textFrame; } } } if (_objects) { for (i = 0; i < 4; i++) { - if ((_multData2->field_124[di][i] != -1) && (_multData2->field_124[di][i] != 1024)) - _objects[_multData2->field_124[di][i]].pAnimData->field_17 = - _objects[_multData2->field_124[di][i]].pAnimData->animType; + 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; } } - // loc_5FCF - for (i = 0; i < 4; i++ /* var_C += 2, var_E += 4*/) { - _multData2->field_15F[di][i] = 0; + + for (i = 0; i < 4; i++) { + _multData2->field_15F[index][i] = 0; for (j = 0; j < _multData2->animKeysCount[i]; j++) { - if (_multData2->animKeys[i][j].frame >= _multData2->animKeysIndices2[di]) - _multData2->field_15F[di][i] = j; + if (_multData2->animKeys[i][j].frame >= _multData2->animKeysIndices2[index]) + _multData2->field_15F[index][i] = j; } } + if (_multData2->field_156 == -1) { // loc_60CF - warning("Mult_v2::multSub(), somepointer05 and somepointer05indices"); + warning("Mult_v2::multSub(), someKeys and someKeysIndices"); } - // loc_6187 - warning("Mult_v2::multSub(), somepointer05"); - } - warning("GOB2 Stub! Mult_v2::multSub()"); + for (i = 0; i < 4; i++) { + _multData2->field_17F[index][i] = 0; + for (j = 0; j < _multData2->someKeysCount[i]; j++) { + if (_multData2->field_156 == 1) { + if (_multData2->someKeys[i][j].frame >= _multData2->animKeysIndices2[index]) { + _multData2->field_17F[index][i] = j; + break; + } + } else { + if (_multData2->someKeys[i][j].frame >= _multData2->field_157[index]) { + _multData2->field_17F[index][i] = j; + break; + } + } + } + } + } } void Mult_v2::playMult(int16 startFrame, int16 endFrame, char checkEscape, @@ -445,8 +467,8 @@ void Mult_v2::playMult(int16 startFrame, int16 endFrame, char checkEscape, delete[] _objects; if (_orderArray) delete[] _orderArray; - if (_renderData) - delete[] _renderData; +/* if (_renderData) + delete[] _renderData;*/ if (_renderData2) delete[] _renderData2; @@ -455,8 +477,8 @@ void Mult_v2::playMult(int16 startFrame, int16 endFrame, char checkEscape, _orderArray = new int8[_objCount]; memset(_orderArray, 0, _objCount * sizeof(int8)); - _renderData = new int16[9 * _objCount]; - memset(_renderData, 0, _objCount * 9 * sizeof(int16)); +/* _renderData = new int16[9 * _objCount]; + memset(_renderData, 0, _objCount * 9 * sizeof(int16));*/ _renderData2 = new Mult_Object*[_objCount]; memset(_renderData2, 0, _objCount * sizeof(Mult_Object*)); @@ -464,6 +486,7 @@ void Mult_v2::playMult(int16 startFrame, int16 endFrame, char checkEscape, _animArrayY = new int32[_objCount]; _animArrayData = new Mult_AnimData[_objCount]; + memset(_animArrayData, 0, _objCount * sizeof(Mult_AnimData)); for (_counter = 0; _counter < _objCount; _counter++) { multObj = &_objects[_counter]; @@ -784,9 +807,12 @@ void Mult_v2::doPalAnim(void) { off = palKey->subst[(_multData2->palAnimIndices[_index] + 1) % 16][_index] - 1; off2 = palKey->subst[_multData2->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; } _multData2->palAnimIndices[_index] = (_multData2->palAnimIndices[_index] + 1) % 16; @@ -897,7 +923,7 @@ char Mult_v2::doSoundAnim(char stop, int16 frame) { void Mult_v2::sub_62DD(int16 index) { Mult_Object *animObj; Mult_AnimKey *animKey; -// void *somep05, *somep05l; + Mult_SomeKey *someKey1, *someKey2; int16 frame; int16 layer; int16 layers; @@ -952,41 +978,41 @@ void Mult_v2::sub_62DD(int16 index) { } } if (_multData2->field_124[index][i] != -1) { - warning("GOB2 Stub! Messing about with _multData2->somepointer05"); - for (j = _multData2->field_17F[index][i]; j < _multData2->somepointer05size[i]; j++) { -/* - somep05 = &_multData2->somepointer05[i][j]; - somep05l = &_multData2->somepointer05[i][j-1]; - if (somep05->field_0 > frame) +// warning("GOB2 Stub! Messing about with _multData2->someKeys, %d, %d", _multData2->field_17F[index][i], _multData2->someKeysCount[i]); + for (j = _multData2->field_17F[index][i]; j < _multData2->someKeysCount[i]; j++) { + + someKey1 = &_multData2->someKeys[i][j]; + someKey2 = &_multData2->someKeys[i][j-1]; + if (someKey1->frame > frame) break; - else if (somep05->field_0 == frame) { - if (somep05->field_2 == -1) - _multData2->somepointer05indices[i] = -1; + else if (someKey1->frame == frame) { + if (someKey1->field_2 == -1) + _multData2->someKeysIndices[i] = -1; else { - _multData2->somepointer05indices[0] = -1; - _multData2->somepointer05indices[1] = -1; - _multData2->somepointer05indices[2] = -1; - _multData2->somepointer05indices[3] = -1; - if ((_multData2->field_156 == 1) || (somep05l->field_2 == 1)) - _multData2->somepointer05indices[i] = j; + _multData2->someKeysIndices[0] = -1; + _multData2->someKeysIndices[1] = -1; + _multData2->someKeysIndices[2] = -1; + _multData2->someKeysIndices[3] = -1; + if ((_multData2->field_156 == 1) || (someKey2->field_2 == 1)) + _multData2->someKeysIndices[i] = j; else if (_multData2->field_157[index] == frame) - _multData2->somepointer05indices[i] = -1; + _multData2->someKeysIndices[i] = -1; else - _multData2->somepointer05indices[i] = j - 1; + _multData2->someKeysIndices[i] = j - 1; } } -*/ + } } - if (_multData2->somepointer05indices[i] != -1) { + if (_multData2->someKeysIndices[i] != -1) { /* - int arg3 = frame - _multData2->somepointer05[i][_multData2->somepointer05indices[i]].field_0; + int arg3 = frame - _multData2->someKeys[i][_multData2->someKeysIndices[i]].field_0; int arg2 = _multData2->field_156; if ((arg2 != 1) && (--arg3 > 0)) arg3 = 0; - int arg1 = _multData2->somepointer05[i][_multData2->somepointer05indices[i]]; + int arg1 = _multData2->someKeys[i][_multData2->someKeysIndices[i]]; // somepointer09 is 14 bytes wide (surely a struct) - int arg0 = _multData2->somepointer09[-_multData2->somepointer05[i][_multData2->somepointer05indices[i]].field_2 - 2]; + int arg0 = _multData2->somepointer09[-_multData2->someKeys[i][_multData2->someKeysIndices[i]].field_2 - 2]; */ warning("GOB2 Stub! sub_1CBF8(arg0, arg1, arg2, arg3);"); } @@ -997,10 +1023,10 @@ void Mult_v2::sub_62DD(int16 index) { if (_multData2->field_156 == 1) { // loc_6809 frame++; if (_multData2->field_157[index] == (frame-1)) { - _multData2->somepointer05indices[0] = -1; - _multData2->somepointer05indices[1] = -1; - _multData2->somepointer05indices[2] = -1; - _multData2->somepointer05indices[3] = -1; + _multData2->someKeysIndices[0] = -1; + _multData2->someKeysIndices[1] = -1; + _multData2->someKeysIndices[2] = -1; + _multData2->someKeysIndices[3] = -1; frame = -1; for (i = 0; i < 4; i++) { if ((_multData2->field_124[index][i] == -1) || (_multData2->field_124[index][i] == 1024)) @@ -1012,10 +1038,10 @@ void Mult_v2::sub_62DD(int16 index) { } else { // loc_68F3 frame--; if (_multData2->field_157[index] == (frame+1)) { - _multData2->somepointer05indices[0] = -1; - _multData2->somepointer05indices[1] = -1; - _multData2->somepointer05indices[2] = -1; - _multData2->somepointer05indices[3] = -1; + _multData2->someKeysIndices[0] = -1; + _multData2->someKeysIndices[1] = -1; + _multData2->someKeysIndices[2] = -1; + _multData2->someKeysIndices[3] = -1; frame = -1; for (i = 0; i < 4; i++) { if ((_multData2->field_124[index][i] == -1) || (_multData2->field_124[index][i] == 1024)) @@ -1186,7 +1212,7 @@ void Mult_v2::animate(void) { if ((animObj1->pAnimData->order == animObj2->pAnimData->order) && ((animObj1->somethingBottom > animObj2->somethingBottom) || ((animObj1->somethingBottom == animObj2->somethingBottom) && - (animObj1->pAnimData->someFlag == 1)))) + (animObj1->pAnimData->isBusy == 1)))) SWAP(orderArray[i], orderArray[j]); } } @@ -1365,6 +1391,20 @@ void Mult_v2::playSound(Snd::SoundDesc * soundDesc, int16 repCount, int16 freq, } } +void Mult_v2::freeMult(void) { + if (_vm->_anim->_animSurf != 0) + delete _vm->_anim->_animSurf; + + delete[] _objects; + delete[] _renderData2; + delete[] _orderArray; + + _objects = 0; + _renderData2 = 0; + _orderArray = 0; + _vm->_anim->_animSurf = 0; +} + void Mult_v2::freeMultKeys(void) { int i; char animCount; @@ -1390,8 +1430,8 @@ void Mult_v2::freeMultKeys(void) { for (i = 0; i < 4; i++) { // loc_73BA delete[] _multData2->animKeys[i]; - if (_multData2->somepointer05[i] != 0) - delete[] _multData2->somepointer05[i]; + if (_multData2->someKeys[i] != 0) + delete[] _multData2->someKeys[i]; } delete[] _multData2->palFadeKeys; diff --git a/engines/gob/scenery.cpp b/engines/gob/scenery.cpp index 328245e69e..8ae63de033 100644 --- a/engines/gob/scenery.cpp +++ b/engines/gob/scenery.cpp @@ -473,8 +473,7 @@ int16 Scenery::loadAnim(char search) { _animPictToSprite[7 * sceneryIndex + i] = sprIndex; _spriteRefs[sprIndex] = 1; _spriteResId[sprIndex] = sprResId; - _vm->_draw->_spritesArray[sprIndex] = - _vm->_video->initSurfDesc(_vm->_global->_videoMode, width, height, 2); + _vm->_draw->initBigSprite(sprIndex, width, height, 2); _vm->_video->clearSurf(_vm->_draw->_spritesArray[sprIndex]); _vm->_draw->_destSurface = sprIndex; |