[Scummvm-cvs-logs] SF.net SVN: scummvm: [23065] scummvm/branches/branch-0-9-0/engines/gob
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Mon Jun 12 23:33:42 CEST 2006
Revision: 23065
Author: drmccoy
Date: 2006-06-12 14:33:30 -0700 (Mon, 12 Jun 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=23065&view=rev
Log Message:
-----------
Fixing loading of Scenery::_animations[]
Modified Paths:
--------------
scummvm/branches/branch-0-9-0/engines/gob/goblin.cpp
scummvm/branches/branch-0-9-0/engines/gob/goblin_v1.cpp
scummvm/branches/branch-0-9-0/engines/gob/goblin_v2.cpp
scummvm/branches/branch-0-9-0/engines/gob/inter_v1.cpp
scummvm/branches/branch-0-9-0/engines/gob/inter_v2.cpp
scummvm/branches/branch-0-9-0/engines/gob/mult_v1.cpp
scummvm/branches/branch-0-9-0/engines/gob/mult_v2.cpp
scummvm/branches/branch-0-9-0/engines/gob/scenery.cpp
scummvm/branches/branch-0-9-0/engines/gob/scenery.h
scummvm/branches/branch-0-9-0/engines/gob/scenery_v1.cpp
scummvm/branches/branch-0-9-0/engines/gob/scenery_v2.cpp
Modified: scummvm/branches/branch-0-9-0/engines/gob/goblin.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/gob/goblin.cpp 2006-06-12 21:31:51 UTC (rev 23064)
+++ scummvm/branches/branch-0-9-0/engines/gob/goblin.cpp 2006-06-12 21:33:30 UTC (rev 23065)
@@ -498,7 +498,7 @@
layer = objDesc->stateMach[objDesc->state][0]->layer;
pLayer =
- _vm->_scenery->_animations[objDesc->animation].layers[layer];
+ &_vm->_scenery->_animations[objDesc->animation].layers[layer];
if (objDesc->curFrame < pLayer->framesCount)
continue;
@@ -547,8 +547,7 @@
int16 layer;
layer = objDesc->stateMach[objDesc->state][0]->layer;
- return _vm->_scenery->_animations[objDesc->animation].layers[layer]->framesCount -
- 1;
+ return _vm->_scenery->_animations[objDesc->animation].layers[layer].framesCount - 1;
}
int16 Goblin::objIntersected(Gob_Object *obj1, Gob_Object *obj2) {
@@ -609,7 +608,7 @@
layer = gobDesc->stateMach[gobDesc->state][0]->layer;
frameCount =
- _vm->_scenery->_animations[gobDesc->animation].layers[layer]->framesCount;
+ _vm->_scenery->_animations[gobDesc->animation].layers[layer].framesCount;
state = gobDesc->state;
frame = gobDesc->curFrame;
@@ -1226,7 +1225,7 @@
layer = gobDesc->stateMach[gobDesc->state][0]->layer;
framesCount =
- _vm->_scenery->_animations[gobDesc->animation].layers[layer]->framesCount;
+ _vm->_scenery->_animations[gobDesc->animation].layers[layer].framesCount;
if (VAR(59) == 0 &&
gobDesc->state != 30 && gobDesc->state != 31) {
@@ -1977,7 +1976,7 @@
animData->frame = 0;
animData->isPaused = 0;
animData->isStatic = 0;
- animData->newCycle = _vm->_scenery->_animations[animation].layers[layer]->framesCount;
+ animData->newCycle = _vm->_scenery->_animations[animation].layers[layer].framesCount;
_vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 1);
if (_vm->_map->_bigTiles) {
@@ -2004,7 +2003,7 @@
layer = obj->goblinStates[animData->state][0].layer;
animation = obj->goblinStates[animData->state][0].animation;
- framesCount = _vm->_scenery->_animations[animation].layers[layer]->framesCount;
+ framesCount = _vm->_scenery->_animations[animation].layers[layer].framesCount;
animData->newCycle = framesCount;
playSounds(obj);
@@ -2042,9 +2041,9 @@
animData->field_F = -1;
animData->animation = obj->goblinStates[animData->state][0].animation;
animData->layer = obj->goblinStates[animData->state][0].layer;
- *obj->pPosX += _vm->_scenery->_animations[animation].layers[layer]->animDeltaX;
- *obj->pPosY += _vm->_scenery->_animations[animation].layers[layer]->animDeltaY;
- animData->newCycle = _vm->_scenery->_animations[animation].layers[layer]->framesCount;
+ *obj->pPosX += _vm->_scenery->_animations[animation].layers[layer].animDeltaX;
+ *obj->pPosY += _vm->_scenery->_animations[animation].layers[layer].animDeltaY;
+ animData->newCycle = _vm->_scenery->_animations[animation].layers[layer].framesCount;
animData->isPaused = 0;
} else
animData->frame--;
Modified: scummvm/branches/branch-0-9-0/engines/gob/goblin_v1.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/gob/goblin_v1.cpp 2006-06-12 21:31:51 UTC (rev 23064)
+++ scummvm/branches/branch-0-9-0/engines/gob/goblin_v1.cpp 2006-06-12 21:33:30 UTC (rev 23065)
@@ -522,11 +522,11 @@
newX =
_vm->_scenery->_animations[gobDesc->animation].
- layers[_gobStateLayer]->animDeltaX + gobDesc->xPos;
+ layers[_gobStateLayer].animDeltaX + gobDesc->xPos;
newY =
_vm->_scenery->_animations[gobDesc->animation].
- layers[_gobStateLayer]->animDeltaY + gobDesc->yPos;
+ layers[_gobStateLayer].animDeltaY + gobDesc->yPos;
_gobStateLayer = nextLayer(gobDesc);
Modified: scummvm/branches/branch-0-9-0/engines/gob/goblin_v2.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/gob/goblin_v2.cpp 2006-06-12 21:31:51 UTC (rev 23064)
+++ scummvm/branches/branch-0-9-0/engines/gob/goblin_v2.cpp 2006-06-12 21:33:30 UTC (rev 23065)
@@ -96,7 +96,7 @@
objAnim->frame = 0;
objAnim->isPaused = 0;
objAnim->isStatic = 0;
- objAnim->newCycle = _vm->_scenery->_animations[animation].layers[layer]->framesCount;
+ objAnim->newCycle = _vm->_scenery->_animations[animation].layers[layer].framesCount;
_vm->_scenery->updateAnim(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 0);
if (!_vm->_map->_bigTiles)
*obj->pPosY = (y + 1) * _vm->_map->_tilesHeight
@@ -139,7 +139,7 @@
dir = 0;
animData = obj->pAnimData;
framesCount =
- _vm->_scenery->_animations[(int)animData->animation].layers[animData->layer]->framesCount;
+ _vm->_scenery->_animations[(int)animData->animation].layers[animData->layer].framesCount;
gobX = obj->goblinX;
gobY = obj->goblinY;
animData->order = gobY;
@@ -317,7 +317,7 @@
animData = obj->pAnimData;
framesCount =
- _vm->_scenery->_animations[(int)animData->animation].layers[animData->layer]->framesCount;
+ _vm->_scenery->_animations[(int)animData->animation].layers[animData->layer].framesCount;
if (animData->isPaused == 0)
animData->frame++;
@@ -388,9 +388,9 @@
animData->field_F = -1;
animData->state = animData->nextState;
*obj->pPosX +=
- _vm->_scenery->_animations[animData->animation].layers[animData->layer]->animDeltaX;
+ _vm->_scenery->_animations[animData->animation].layers[animData->layer].animDeltaX;
*obj->pPosY +=
- _vm->_scenery->_animations[animData->animation].layers[animData->layer]->animDeltaY;
+ _vm->_scenery->_animations[animData->animation].layers[animData->layer].animDeltaY;
animation = obj->goblinStates[animData->nextState][0].animation;
layer = obj->goblinStates[animData->nextState][0].layer;
animData->layer = layer;
Modified: scummvm/branches/branch-0-9-0/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/gob/inter_v1.cpp 2006-06-12 21:31:51 UTC (rev 23064)
+++ scummvm/branches/branch-0-9-0/engines/gob/inter_v1.cpp 2006-06-12 21:33:30 UTC (rev 23065)
@@ -2317,11 +2317,9 @@
layer = objDesc->stateMach[objDesc->state][0]->layer;
objDesc->xPos =
- _vm->_scenery->_animations[objDesc->animation].layers[layer]->
- posX;
+ _vm->_scenery->_animations[objDesc->animation].layers[layer].posX;
objDesc->yPos =
- _vm->_scenery->_animations[objDesc->animation].layers[layer]->
- posY;
+ _vm->_scenery->_animations[objDesc->animation].layers[layer].posY;
*_vm->_goblin->_curGobScrXVarPtr = objDesc->xPos;
*_vm->_goblin->_curGobScrYVarPtr = objDesc->yPos;
@@ -2415,9 +2413,9 @@
layer = objDesc->stateMach[objDesc->state][0]->layer;
objDesc->xPos =
- _vm->_scenery->_animations[objDesc->animation].layers[layer]->posX;
+ _vm->_scenery->_animations[objDesc->animation].layers[layer].posX;
objDesc->yPos =
- _vm->_scenery->_animations[objDesc->animation].layers[layer]->posY;
+ _vm->_scenery->_animations[objDesc->animation].layers[layer].posY;
if (item == _vm->_goblin->_currentGoblin) {
*_vm->_goblin->_curGobScrXVarPtr = objDesc->xPos;
@@ -2439,9 +2437,9 @@
_vm->_goblin->nextLayer(objDesc);
layer = objDesc->stateMach[objDesc->state][0]->layer;
objDesc->xPos =
- _vm->_scenery->_animations[objDesc->animation].layers[layer]->posX;
+ _vm->_scenery->_animations[objDesc->animation].layers[layer].posX;
objDesc->yPos =
- _vm->_scenery->_animations[objDesc->animation].layers[layer]->posY;
+ _vm->_scenery->_animations[objDesc->animation].layers[layer].posY;
objDesc->toRedraw = 1;
objDesc->type = 0;
Modified: scummvm/branches/branch-0-9-0/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/gob/inter_v2.cpp 2006-06-12 21:31:51 UTC (rev 23064)
+++ scummvm/branches/branch-0-9-0/engines/gob/inter_v2.cpp 2006-06-12 21:33:30 UTC (rev 23065)
@@ -1172,8 +1172,8 @@
objAnim->layer = obj->goblinStates[objAnim->state][0].layer;
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;
+ *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(layer, 0, animation, 0, *obj->pPosX, *obj->pPosY, 0);
}
Modified: scummvm/branches/branch-0-9-0/engines/gob/mult_v1.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/gob/mult_v1.cpp 2006-06-12 21:31:51 UTC (rev 23064)
+++ scummvm/branches/branch-0-9-0/engines/gob/mult_v1.cpp 2006-06-12 21:33:30 UTC (rev 23065)
@@ -860,7 +860,7 @@
} 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;
@@ -871,11 +871,11 @@
*(_objects[i].pPosX) =
*(_objects[i].pPosX) +
- _vm->_scenery->_animations[(int)pAnimData->animation].layers[pAnimData->layer]->animDeltaX;
+ _vm->_scenery->_animations[(int)pAnimData->animation].layers[pAnimData->layer].animDeltaX;
*(_objects[i].pPosY) =
*(_objects[i].pPosY) +
- _vm->_scenery->_animations[(int)pAnimData->animation].layers[pAnimData->layer]->animDeltaY;
+ _vm->_scenery->_animations[(int)pAnimData->animation].layers[pAnimData->layer].animDeltaY;
break;
case 2:
Modified: scummvm/branches/branch-0-9-0/engines/gob/mult_v2.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/gob/mult_v2.cpp 2006-06-12 21:31:51 UTC (rev 23064)
+++ scummvm/branches/branch-0-9-0/engines/gob/mult_v2.cpp 2006-06-12 21:33:30 UTC (rev 23065)
@@ -1305,7 +1305,7 @@
if (animData1->animType != 8)
animData1->frame++;
if (animData1->frame >=
- _vm->_scenery->_animations[(int)animData1->animation].layers[animData1->layer]->framesCount) {
+ _vm->_scenery->_animations[(int)animData1->animation].layers[animData1->layer].framesCount) {
switch (animData1->animType) {
case 0:
animData1->frame = 0;
@@ -1314,9 +1314,9 @@
case 1:
animData1->frame = 0;
*(_objects[i].pPosX) +=
- _vm->_scenery->_animations[(int)animData1->animation].layers[animData1->layer]->animDeltaX;
+ _vm->_scenery->_animations[(int)animData1->animation].layers[animData1->layer].animDeltaX;
*(_objects[i].pPosY) +=
- _vm->_scenery->_animations[(int)animData1->animation].layers[animData1->layer]->animDeltaY;
+ _vm->_scenery->_animations[(int)animData1->animation].layers[animData1->layer].animDeltaY;
break;
case 2:
Modified: scummvm/branches/branch-0-9-0/engines/gob/scenery.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/gob/scenery.cpp 2006-06-12 21:31:51 UTC (rev 23064)
+++ scummvm/branches/branch-0-9-0/engines/gob/scenery.cpp 2006-06-12 21:33:30 UTC (rev 23065)
@@ -374,8 +374,12 @@
int16 picsCount;
int16 resId;
int16 i;
+ int16 j;
int16 sceneryIndex;
+ int16 framesCount;
char *dataPtr;
+ char *dataPtr2;
+ char *dataPtr3;
Animation *ptr;
int16 offset;
int16 pictDescId;
@@ -425,20 +429,41 @@
ptr->layersCount = READ_LE_UINT16(dataPtr);
dataPtr += 2;
- ptr->layers = new AnimLayer*[ptr->layersCount];
+ ptr->layers = new AnimLayer[ptr->layersCount];
ptr->pieces = new PieceDesc*[picsCount];
ptr->piecesFromExt = new int8[picsCount];
for (i = 0; i < ptr->layersCount; i++) {
+// ptr->layers[i] = new AnimLayer;
offset = (int16)READ_LE_UINT16(&((int16 *)dataPtr)[i]);
- ptr->layers[i] = (AnimLayer *) (dataPtr + offset - 2);
+ dataPtr2 = dataPtr + offset - 2;
- ptr->layers[i]->unknown0 = (int16)READ_LE_UINT16(&ptr->layers[i]->unknown0);
- ptr->layers[i]->posX = (int16)READ_LE_UINT16(&ptr->layers[i]->posX);
- ptr->layers[i]->posY = (int16)READ_LE_UINT16(&ptr->layers[i]->posY);
- ptr->layers[i]->animDeltaX = (int16)READ_LE_UINT16(&ptr->layers[i]->animDeltaX);
- ptr->layers[i]->animDeltaY = (int16)READ_LE_UINT16(&ptr->layers[i]->animDeltaY);
- ptr->layers[i]->framesCount = (int16)READ_LE_UINT16(&ptr->layers[i]->framesCount);
+ ptr->layers[i].unknown0 = (int16)READ_LE_UINT16(dataPtr2);
+ ptr->layers[i].posX = (int16)READ_LE_UINT16(dataPtr2 + 2);
+ ptr->layers[i].posY = (int16)READ_LE_UINT16(dataPtr2 + 4);
+ ptr->layers[i].animDeltaX = (int16)READ_LE_UINT16(dataPtr2 + 6);
+ ptr->layers[i].animDeltaY = (int16)READ_LE_UINT16(dataPtr2 + 8);
+ ptr->layers[i].transp = (int8) *(dataPtr2 + 10);
+ ptr->layers[i].framesCount = (int16)READ_LE_UINT16(dataPtr2 + 11);
+ dataPtr2 += 13;
+
+ framesCount = 0;
+ dataPtr3 = dataPtr2;
+ for (j = 0; j < ptr->layers[i].framesCount; j++, framesCount++, dataPtr3 += 5) {
+ while(dataPtr3[4] == 1) {
+ framesCount++;
+ dataPtr3 += 5;
+ }
+ }
+
+ ptr->layers[i].frames = new AnimFramePiece[framesCount];
+ for (j = 0; j < framesCount; j++) {
+ ptr->layers[i].frames[j].pictIndex = *dataPtr2++;
+ ptr->layers[i].frames[j].pieceIndex = *dataPtr2++;
+ ptr->layers[i].frames[j].destX = *dataPtr2++;
+ ptr->layers[i].frames[j].destY = *dataPtr2++;
+ ptr->layers[i].frames[j].notFinal = *dataPtr2++;
+ }
}
for (i = 0; i < picsCount; i++) {
@@ -511,6 +536,9 @@
}
}
+
+ for (i = 0; i < _animations[animation].layersCount; i++)
+ delete[] _animations[animation].layers[i].frames;
delete[] _animations[animation].layers;
delete[] _animations[animation].pieces;
delete[] _animations[animation].piecesFromExt;
@@ -531,7 +559,7 @@
_vm->_inter->evalExpr(&animation);
_vm->_inter->evalExpr(&layer);
- layerPtr = _animations[animation].layers[layer];
+ layerPtr = &_animations[animation].layers[layer];
var = _vm->_parse->parseVarIndex();
WRITE_VAR_OFFSET(var, layerPtr->animDeltaX);
Modified: scummvm/branches/branch-0-9-0/engines/gob/scenery.h
===================================================================
--- scummvm/branches/branch-0-9-0/engines/gob/scenery.h 2006-06-12 21:31:51 UTC (rev 23064)
+++ scummvm/branches/branch-0-9-0/engines/gob/scenery.h 2006-06-12 21:33:30 UTC (rev 23065)
@@ -68,7 +68,7 @@
int16 animDeltaY;
int8 transp;
int16 framesCount;
- AnimFramePiece frames[1];
+ AnimFramePiece *frames;
} GCC_PACK;
#pragma END_PACK_STRUCTS
@@ -84,7 +84,7 @@
struct Animation {
int16 layersCount;
- AnimLayer **layers;
+ AnimLayer *layers;
PieceDesc **pieces;
int8 *piecesFromExt;
char *dataPtr;
Modified: scummvm/branches/branch-0-9-0/engines/gob/scenery_v1.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/gob/scenery_v1.cpp 2006-06-12 21:31:51 UTC (rev 23064)
+++ scummvm/branches/branch-0-9-0/engines/gob/scenery_v1.cpp 2006-06-12 21:33:30 UTC (rev 23065)
@@ -43,11 +43,12 @@
int16 drawDeltaX, int16 drawDeltaY, char doDraw) {
AnimLayer *layerPtr;
PieceDesc **pictPtr;
- AnimFramePiece *framePtr;
uint16 pieceIndex;
uint16 pictIndex;
+ int16 curFrame;
+
int16 left;
int16 right;
int16 top;
@@ -65,7 +66,7 @@
if (layer >= _animations[animation].layersCount)
return;
- layerPtr = _animations[animation].layers[layer];
+ layerPtr = &_animations[animation].layers[layer];
if (frame >= layerPtr->framesCount)
return;
@@ -85,11 +86,11 @@
*_pCaptureCounter = *_pCaptureCounter + 1;
}
pictPtr = _animations[animation].pieces;
- framePtr = layerPtr->frames;
+ curFrame = 0;
- for (i = 0; i < frame; i++, framePtr++) {
- while (framePtr->notFinal == 1)
- framePtr++;
+ for (i = 0; i < frame; i++, curFrame++) {
+ while (layerPtr->frames[curFrame].notFinal == 1)
+ curFrame++;
}
if ((flags & 4) == 0) {
@@ -109,15 +110,15 @@
transp = layerPtr->transp ? 3 : 0;
- framePtr--;
+ curFrame--;
do {
- framePtr++;
+ curFrame++;
- pieceIndex = framePtr->pieceIndex;
- pictIndex = framePtr->pictIndex;
+ pieceIndex = layerPtr->frames[curFrame].pieceIndex;
+ pictIndex = layerPtr->frames[curFrame].pictIndex;
- destX = framePtr->destX;
- destY = framePtr->destY;
+ destX = layerPtr->frames[curFrame].destX;
+ destY = layerPtr->frames[curFrame].destY;
highX = pictIndex & 0xc0;
highY = pictIndex & 0x30;
@@ -238,7 +239,7 @@
(int16)(destY + bottom - top));
}
}
- } while (framePtr->notFinal == 1);
+ } while (layerPtr->frames[curFrame].notFinal == 1);
}
} // End of namespace Gob
Modified: scummvm/branches/branch-0-9-0/engines/gob/scenery_v2.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/gob/scenery_v2.cpp 2006-06-12 21:31:51 UTC (rev 23064)
+++ scummvm/branches/branch-0-9-0/engines/gob/scenery_v2.cpp 2006-06-12 21:33:30 UTC (rev 23065)
@@ -67,7 +67,7 @@
if (layer >= _animations[animation].layersCount)
return;
- layerPtr = _animations[animation].layers[layer];
+ layerPtr = &_animations[animation].layers[layer];
if (frame >= layerPtr->framesCount)
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list