diff options
-rw-r--r-- | engines/gob/draw.h | 3 | ||||
-rw-r--r-- | engines/gob/draw_v1.cpp | 2 | ||||
-rw-r--r-- | engines/gob/draw_v2.cpp | 2 | ||||
-rw-r--r-- | engines/gob/game.cpp | 15 | ||||
-rw-r--r-- | engines/gob/game.h | 26 | ||||
-rw-r--r-- | engines/gob/game_v1.cpp | 50 | ||||
-rw-r--r-- | engines/gob/game_v2.cpp | 57 |
7 files changed, 80 insertions, 75 deletions
diff --git a/engines/gob/draw.h b/engines/gob/draw.h index 05cf4ab866..62a4984267 100644 --- a/engines/gob/draw.h +++ b/engines/gob/draw.h @@ -139,6 +139,9 @@ public: _spritesArray[index] = 0; } void adjustCoords(char adjust, int16 *coord1, int16 *coord2); + void adjustCoords(char adjust, uint16 *coord1, uint16 *coord2) { + adjustCoords(adjust, (int16 *) coord1, (int16 *) coord2); + } void drawString(char *str, int16 x, int16 y, int16 color1, int16 color2, int16 transp, SurfaceDesc *dest, Video::FontDesc *font); void printTextCentered(int16 id, int16 left, int16 top, int16 right, diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp index 58e0a3c2d3..bba9c790d6 100644 --- a/engines/gob/draw_v1.cpp +++ b/engines/gob/draw_v1.cpp @@ -63,7 +63,7 @@ void Draw_v1::animateCursor(int16 cursor) { if (cursorIndex == -1) { cursorIndex = 0; - for (ptr = _vm->_game->_collisionAreas; ptr->left != -1; ptr++) { + for (ptr = _vm->_game->_collisionAreas; ptr->left != 0xFFFF; ptr++) { if (ptr->flags & 0xFFF0) continue; diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index 56757bb106..67b8eb3c13 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -82,7 +82,7 @@ void Draw_v2::animateCursor(int16 cursor) { // .-- _draw_animateCursorSUB1 --- if (cursorIndex == -1) { cursorIndex = 0; - for (ptr = _vm->_game->_collisionAreas; ptr->left != -1; ptr++) { + for (ptr = _vm->_game->_collisionAreas; ptr->left != 0xFFFF; ptr++) { if ((ptr->flags & 0xF00) || (ptr->id & 0x4000)) continue; diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 926e9e3f68..43eac76928 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -198,7 +198,7 @@ byte *Game::loadExtData(int16 itemId, int16 *pResWidth, void Game::freeCollision(int16 id) { for (int i = 0; i < 250; i++) { if (_collisionAreas[i].id == id) - _collisionAreas[i].left = -1; + _collisionAreas[i].left = 0xFFFF; } } @@ -675,13 +675,13 @@ byte *Game::loadLocTexts(void) { void Game::setCollisions(void) { byte *savedIP; - int16 left; - int16 top; - int16 width; - int16 height; + uint16 left; + uint16 top; + uint16 width; + uint16 height; Collision *collArea; - for (collArea = _collisionAreas; collArea->left != -1; collArea++) { + for (collArea = _collisionAreas; collArea->left != 0xFFFF; collArea++) { if (((collArea->id & 0xC000) != 0x8000) || (collArea->funcSub == 0)) continue; @@ -691,7 +691,8 @@ void Game::setCollisions(void) { top = _vm->_parse->parseValExpr(); width = _vm->_parse->parseValExpr(); height = _vm->_parse->parseValExpr(); - if ((_vm->_draw->_renderFlags & RENDERFLAG_CAPTUREPOP) && (left != -1)) { + if ((_vm->_draw->_renderFlags & RENDERFLAG_CAPTUREPOP) && + (left != 0xFFFF)) { left += _vm->_draw->_backDeltaX; top += _vm->_draw->_backDeltaY; } diff --git a/engines/gob/game.h b/engines/gob/game.h index 349d95ba86..66fa0179fd 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -37,10 +37,10 @@ public: struct Collision { int16 id; - int16 left; - int16 top; - int16 right; - int16 bottom; + uint16 left; + uint16 top; + uint16 right; + uint16 bottom; int16 flags; int16 key; uint16 funcEnter; @@ -152,9 +152,9 @@ public: virtual void playTot(int16 skipPlay) = 0; virtual void clearCollisions(void) = 0; - virtual int16 addNewCollision(int16 id, int16 left, int16 top, int16 right, - int16 bottom, int16 flags, int16 key, uint16 funcEnter, - uint16 funcLeave) = 0; + virtual int16 addNewCollision(int16 id, uint16 left, uint16 top, + uint16 right, uint16 bottom, int16 flags, int16 key, + uint16 funcEnter, uint16 funcLeave) = 0; virtual void collisionsBlock(void) = 0; virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos, InputDesc *inpDesc, int16 *collResId, int16 *collIndex) = 0; @@ -233,9 +233,9 @@ public: virtual void playTot(int16 skipPlay); virtual void clearCollisions(void); - virtual int16 addNewCollision(int16 id, int16 left, int16 top, int16 right, - int16 bottom, int16 flags, int16 key, uint16 funcEnter, - uint16 funcLeave); + virtual int16 addNewCollision(int16 id, uint16 left, uint16 top, + uint16 right, uint16 bottom, int16 flags, int16 key, + uint16 funcEnter, uint16 funcLeave); virtual void collisionsBlock(void); virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos, InputDesc *inpDesc, int16 *collResId, int16 *collIndex); @@ -261,9 +261,9 @@ public: virtual void playTot(int16 skipPlay); virtual void clearCollisions(void); - virtual int16 addNewCollision(int16 id, int16 left, int16 top, int16 right, - int16 bottom, int16 flags, int16 key, uint16 funcEnter, - uint16 funcLeave); + virtual int16 addNewCollision(int16 id, uint16 left, uint16 top, + uint16 right, uint16 bottom, int16 flags, int16 key, + uint16 funcEnter, uint16 funcLeave); virtual void collisionsBlock(void); virtual int16 multiEdit(int16 time, int16 index, int16 *pCurPos, InputDesc *inpDesc, int16 *collResId, int16 *collIndex); diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index ddc34f176c..6de1165470 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -257,12 +257,12 @@ void Game_v1::playTot(int16 skipPlay) { void Game_v1::clearCollisions() { for (int i = 0; i < 250; i++) { _collisionAreas[i].id = 0; - _collisionAreas[i].left = -1; + _collisionAreas[i].left = 0xFFFF; } } -int16 Game_v1::addNewCollision(int16 id, int16 left, int16 top, - int16 right, int16 bottom, int16 flags, int16 key, +int16 Game_v1::addNewCollision(int16 id, uint16 left, uint16 top, + uint16 right, uint16 bottom, int16 flags, int16 key, uint16 funcEnter, uint16 funcLeave) { Collision *ptr; @@ -275,7 +275,7 @@ int16 Game_v1::addNewCollision(int16 id, int16 left, int16 top, funcEnter, funcLeave); for (int i = 0; i < 250; i++) { - if (_collisionAreas[i].left != -1) + if (_collisionAreas[i].left != 0xFFFF) continue; ptr = &_collisionAreas[i]; @@ -300,7 +300,7 @@ void Game_v1::pushCollisions(char all) { int16 size; debugC(1, kDebugCollisions, "pushCollisions"); - for (size = 0, srcPtr = _collisionAreas; srcPtr->left != -1; srcPtr++) { + for (size = 0, srcPtr = _collisionAreas; srcPtr->left != 0xFFFF; srcPtr++) { if (all || (srcPtr->id & 0x8000)) size++; } @@ -310,10 +310,10 @@ void Game_v1::pushCollisions(char all) { _collStackElemSizes[_collStackSize] = size; _collStackSize++; - for (srcPtr = _collisionAreas; srcPtr->left != -1; srcPtr++) { + for (srcPtr = _collisionAreas; srcPtr->left != 0xFFFF; srcPtr++) { if (all || (srcPtr->id & 0x8000)) { memcpy(destPtr, srcPtr, sizeof(Collision)); - srcPtr->left = -1; + srcPtr->left = 0xFFFF; destPtr++; } } @@ -326,7 +326,7 @@ void Game_v1::popCollisions(void) { debugC(1, kDebugCollisions, "popCollision"); _collStackSize--; - for (destPtr = _collisionAreas; destPtr->left != -1; destPtr++); + for (destPtr = _collisionAreas; destPtr->left != 0xFFFF; destPtr++); srcPtr = _collStack[_collStackSize]; memcpy(destPtr, srcPtr, @@ -595,10 +595,10 @@ void Game_v1::collisionsBlock(void) { int16 cmdHigh; int16 key; int16 flags; - int16 left; - int16 top; - int16 width; - int16 height; + uint16 left; + uint16 top; + uint16 width; + uint16 height; int16 var_22; int16 index; int16 curEditIndex; @@ -693,7 +693,7 @@ void Game_v1::collisionsBlock(void) { _vm->_global->_inter_execPtr += _vm->_inter->load16(); } - if (left == -1) + if (left == 0xFFFF) break; if ((cmd & 1) == 0) { @@ -802,7 +802,7 @@ void Game_v1::collisionsBlock(void) { if (key == 0x1C0D) { for (i = 0; i < 250; i++) { - if (_collisionAreas[i].left == -1) + if (_collisionAreas[i].left == 0xFFFF) continue; if ((_collisionAreas[i].id & 0x8000) == 0) @@ -833,7 +833,7 @@ void Game_v1::collisionsBlock(void) { if (_activeCollResId == 0) { if (key != 0) { for (i = 0; i < 250; i++) { - if (_collisionAreas[i].left == -1) + if (_collisionAreas[i].left == 0xFFFF) continue; if ((_collisionAreas[i].id & 0x8000) == 0) @@ -850,7 +850,7 @@ void Game_v1::collisionsBlock(void) { if (_activeCollResId == 0) { for (i = 0; i < 250; i++) { - if (_collisionAreas[i].left == -1) + if (_collisionAreas[i].left == 0xFFFF) continue; if ((_collisionAreas[i].id & 0x8000) == 0) @@ -878,7 +878,7 @@ void Game_v1::collisionsBlock(void) { collPtr = _collisionAreas; for (i = 0, collPtr = _collisionAreas; - collPtr->left != -1; i++, collPtr++) { + collPtr->left != 0xFFFF; i++, collPtr++) { if ((collPtr->id & 0x8000) == 0) continue; @@ -923,7 +923,7 @@ void Game_v1::collisionsBlock(void) { if (descIndex != 0) { counter = 0; for (i = 0; i < 250; i++) { - if (_collisionAreas[i].left == -1) + if (_collisionAreas[i].left == 0xFFFF) continue; if ((_collisionAreas[i].id & 0x8000) == 0) @@ -939,7 +939,7 @@ void Game_v1::collisionsBlock(void) { } } else { for (i = 0; i < 250; i++) { - if (_collisionAreas[i].left == -1) + if (_collisionAreas[i].left == 0xFFFF) continue; if ((_collisionAreas[i].id & 0x8000) == 0) @@ -955,7 +955,7 @@ void Game_v1::collisionsBlock(void) { if (descIndex2 != 0) { counter = 0; for (i = 0; i < 250; i++) { - if (_collisionAreas[i].left == -1) + if (_collisionAreas[i].left == 0xFFFF) continue; if ((_collisionAreas[i].id & 0x8000) == 0) @@ -1010,7 +1010,7 @@ void Game_v1::collisionsBlock(void) { var_24 = 0; var_26 = 1; for (i = 0; i < 250; i++) { - if (_collisionAreas[i].left == -1) + if (_collisionAreas[i].left == 0xFFFF) continue; if ((_collisionAreas[i].id & 0x8000) == 0) @@ -1102,7 +1102,7 @@ int16 Game_v1::multiEdit(int16 time, int16 index, int16 *pCurPos, for (i = 0; i < 250; i++) { collArea = &_collisionAreas[i]; - if (collArea->left == -1) + if (collArea->left == 0xFFFF) continue; if ((collArea->id & 0x8000) == 0) @@ -1145,7 +1145,7 @@ int16 Game_v1::multiEdit(int16 time, int16 index, int16 *pCurPos, for (i = 0; i < 250; i++) { collArea = &_collisionAreas[i]; - if (collArea->left == -1) + if (collArea->left == 0xFFFF) continue; if ((collArea->id & 0x8000) == 0) @@ -1194,7 +1194,7 @@ int16 Game_v1::multiEdit(int16 time, int16 index, int16 *pCurPos, for (i = 0; i < 250; i++) { collArea = &_collisionAreas[i]; - if (collArea->left == -1) + if (collArea->left == 0xFFFF) continue; if ((collArea->id & 0x8000) == 0) @@ -1487,7 +1487,7 @@ int16 Game_v1::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { *resIndex = 0; ptr = _collisionAreas; - for (i = 0; ptr->left != -1; ptr++, i++) { + for (i = 0; ptr->left != 0xFFFF; ptr++, i++) { if (all) { if ((ptr->flags & 0xF) > 1) continue; diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index 126693fc48..d10c599ddd 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -298,11 +298,12 @@ void Game_v2::clearCollisions() { _lastCollKey = 0; for (int i = 0; i < 150; i++) - _collisionAreas[i].left = -1; + _collisionAreas[i].left = 0xFFFF; } -int16 Game_v2::addNewCollision(int16 id, int16 left, int16 top, int16 right, int16 bottom, - int16 flags, int16 key, uint16 funcEnter, uint16 funcLeave) { +int16 Game_v2::addNewCollision(int16 id, uint16 left, uint16 top, + uint16 right, uint16 bottom, int16 flags, int16 key, + uint16 funcEnter, uint16 funcLeave) { Collision *ptr; debugC(5, kDebugCollisions, "addNewCollision"); @@ -314,7 +315,7 @@ int16 Game_v2::addNewCollision(int16 id, int16 left, int16 top, int16 right, int funcEnter, funcLeave); for (int i = 0; i < 150; i++) { - if ((_collisionAreas[i].left != -1) && (_collisionAreas[i].id != id)) + if ((_collisionAreas[i].left != 0xFFFF) && (_collisionAreas[i].id != id)) continue; ptr = &_collisionAreas[i]; @@ -341,7 +342,7 @@ void Game_v2::pushCollisions(char all) { int16 size; debugC(1, kDebugCollisions, "pushCollisions"); - for (size = 0, srcPtr = _collisionAreas; srcPtr->left != -1; srcPtr++) + for (size = 0, srcPtr = _collisionAreas; srcPtr->left != 0xFFFF; srcPtr++) if (all || (((uint16) srcPtr->id) >= 20)) size++; @@ -365,10 +366,10 @@ void Game_v2::pushCollisions(char all) { _lastCollAreaIndex = 0; _collStackSize++; - for (srcPtr = _collisionAreas; srcPtr->left != -1; srcPtr++) { + for (srcPtr = _collisionAreas; srcPtr->left != 0xFFFF; srcPtr++) { if (all || (((uint16) srcPtr->id) >= 20)) { memcpy(destPtr, srcPtr, sizeof(Collision)); - srcPtr->left = -1; + srcPtr->left = 0xFFFF; destPtr++; } } @@ -389,7 +390,7 @@ void Game_v2::popCollisions(void) { _lastCollId = _collLasts[_collStackSize].id; _lastCollAreaIndex = _collLasts[_collStackSize].areaIndex; - for (destPtr = _collisionAreas; destPtr->left != -1; destPtr++); + for (destPtr = _collisionAreas; destPtr->left != 0xFFFF; destPtr++); srcPtr = _collStack[_collStackSize]; memcpy(destPtr, srcPtr, @@ -599,10 +600,10 @@ void Game_v2::collisionsBlock(void) { int16 cmdHigh; int16 key; int16 flags; - int16 left; - int16 top; - int16 width; - int16 height; + uint16 left; + uint16 top; + uint16 width; + uint16 height; int16 var_1C; int16 index; int16 curEditIndex; @@ -627,7 +628,7 @@ void Game_v2::collisionsBlock(void) { pushCollisions(0); collArea = _collisionAreas; - while (collArea->left != -1) + while (collArea->left != 0xFFFF) collArea++; _shouldPushColls = 0; @@ -680,12 +681,12 @@ void Game_v2::collisionsBlock(void) { height = _vm->_inter->load16(); } - if ((_vm->_draw->_renderFlags & RENDERFLAG_CAPTUREPOP) && (left != -1)) { + if ((_vm->_draw->_renderFlags & RENDERFLAG_CAPTUREPOP) && (left != 0xFFFF)) { left += _vm->_draw->_backDeltaX; top += _vm->_draw->_backDeltaY; } - if (left != -1) { + if (left != 0xFFFF) { _vm->_draw->adjustCoords(0, &left, &top); if (((cmd & 0x3F) < 20) && ((cmd & 0x3F) >= 3)) { if (_vm->_draw->_needAdjust != 2) @@ -766,7 +767,7 @@ void Game_v2::collisionsBlock(void) { } else descArray[index].ptr = 0; - if (left == -1) { + if (left == 0xFFFF) { if ((cmd & 1) == 0) { _vm->_global->_inter_execPtr += 2; _vm->_global->_inter_execPtr += @@ -875,7 +876,7 @@ void Game_v2::collisionsBlock(void) { WRITE_VAR(55, curEditIndex); if (key == 0x1C0D) { for (i = 0; i < 150; i++) { - if (_collisionAreas[i].left == -1) + if (_collisionAreas[i].left == 0xFFFF) break; if ((_collisionAreas[i].id & 0xC000) != 0x8000) @@ -905,7 +906,7 @@ void Game_v2::collisionsBlock(void) { if (_activeCollResId == 0) { if (key != 0) { for (i = 0; i < 150; i++) { - if (_collisionAreas[i].left == -1) + if (_collisionAreas[i].left == 0xFFFF) break; if ((_collisionAreas[i].id & 0xC000) != 0x8000) @@ -921,7 +922,7 @@ void Game_v2::collisionsBlock(void) { if (_activeCollResId == 0) { for (i = 0; i < 150; i++) { - if (_collisionAreas[i].left == -1) + if (_collisionAreas[i].left == 0xFFFF) break; if ((_collisionAreas[i].id & 0xC000) != 0x8000) @@ -945,7 +946,7 @@ void Game_v2::collisionsBlock(void) { if (stackPos2 != 0) { collStackPos = 0; - for (i = 0, collPtr = collArea; collPtr->left != -1; i++, collPtr++) { + for (i = 0, collPtr = collArea; collPtr->left != 0xFFFF; i++, collPtr++) { if ((collPtr->id & 0xF000) != 0x8000) continue; @@ -992,7 +993,7 @@ void Game_v2::collisionsBlock(void) { if (descIndex != 0) { counter = 0; - for (i = 0, collPtr = collArea; collPtr->left != -1; i++, collPtr++) { + for (i = 0, collPtr = collArea; collPtr->left != 0xFFFF; i++, collPtr++) { if ((collPtr->id & 0xF000) == 0x8000) if (++counter == descIndex) { _activeCollResId = collPtr->id; @@ -1003,7 +1004,7 @@ void Game_v2::collisionsBlock(void) { } else { - for (i = 0, collPtr = _collisionAreas; collPtr->left != -1; i++, collPtr++) { + for (i = 0, collPtr = _collisionAreas; collPtr->left != 0xFFFF; i++, collPtr++) { if ((collPtr->id & 0xF000) == 0x8000) { _activeCollResId = collPtr->id; _activeCollIndex = i; @@ -1043,7 +1044,7 @@ void Game_v2::collisionsBlock(void) { var_24 = 0; var_26 = 1; for (i = 0; i < 150; i++) { - if (_collisionAreas[i].left == -1) + if (_collisionAreas[i].left == 0xFFFF) continue; if ((_collisionAreas[i].id & 0xC000) == 0x8000) @@ -1148,7 +1149,7 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, for (i = 0; i < 150; i++) { collArea = &_collisionAreas[i]; - if (collArea->left == -1) + if (collArea->left == 0xFFFF) continue; if ((collArea->id & 0xC000) != 0x8000) @@ -1200,7 +1201,7 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, for (i = 0; i < 150; i++) { collArea = &_collisionAreas[i]; - if (collArea->left == -1) + if (collArea->left == 0xFFFF) continue; if ((collArea->id & 0xC000) != 0x8000) @@ -1241,7 +1242,7 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, if (_mouseButtons != 0) { for (collArea = _collisionAreas, i = 0; - collArea->left != -1; collArea++, i++) { + collArea->left != 0xFFFF; collArea++, i++) { if ((collArea->flags & 0xF00)) continue; @@ -1277,7 +1278,7 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, for (i = 0; i < 150; i++) { collArea = &_collisionAreas[i]; - if (collArea->left == -1) + if (collArea->left == 0xFFFF) continue; if ((collArea->id & 0xC000) != 0x8000) @@ -1586,7 +1587,7 @@ int16 Game_v2::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) { *resIndex = 0; ptr = _collisionAreas; - for (i = 0; ptr->left != -1; ptr++, i++) { + for (i = 0; ptr->left != 0xFFFF; ptr++, i++) { if (ptr->id & 0x4000) continue; |