diff options
author | Eugene Sandulenko | 2006-01-04 01:23:20 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2006-01-04 01:23:20 +0000 |
commit | 71a386618ac9239a64381821824e1a2665fdda4b (patch) | |
tree | 319e82de224577e00932aaf469f66b7bd046d479 | |
parent | 42eeb3aff69b88d845bbc73557788e5dc3522aed (diff) | |
download | scummvm-rg350-71a386618ac9239a64381821824e1a2665fdda4b.tar.gz scummvm-rg350-71a386618ac9239a64381821824e1a2665fdda4b.tar.bz2 scummvm-rg350-71a386618ac9239a64381821824e1a2665fdda4b.zip |
More work on renaming class variables with underscore prefix
svn-id: r19903
-rw-r--r-- | gob/draw.cpp | 2 | ||||
-rw-r--r-- | gob/game.cpp | 35 | ||||
-rw-r--r-- | gob/goblin.cpp | 530 | ||||
-rw-r--r-- | gob/inter.cpp | 114 | ||||
-rw-r--r-- | gob/inter.h | 18 | ||||
-rw-r--r-- | gob/map.cpp | 254 | ||||
-rw-r--r-- | gob/map.h | 26 | ||||
-rw-r--r-- | gob/palanim.cpp | 80 | ||||
-rw-r--r-- | gob/palanim.h | 10 |
9 files changed, 531 insertions, 538 deletions
diff --git a/gob/draw.cpp b/gob/draw.cpp index a894f8e1a7..17273da482 100644 --- a/gob/draw.cpp +++ b/gob/draw.cpp @@ -233,7 +233,7 @@ void Draw::blitInvalidated(void) { if (gcursorIndex == 4) blitCursor(); - if (_vm->_inter->terminate) + if (_vm->_inter->_terminate) return; if (noInvalidated && applyPal == 0) diff --git a/gob/game.cpp b/gob/game.cpp index b664a69d92..e3bf942ff1 100644 --- a/gob/game.cpp +++ b/gob/game.cpp @@ -457,10 +457,10 @@ int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY, int16 *pButtons, char hand handleMouse); } - if (_vm->_inter->soundEndTimeKey != 0 - && _vm->_util->getTimeKey() >= _vm->_inter->soundEndTimeKey) { - _vm->_snd->stopSound(_vm->_inter->soundStopVal); - _vm->_inter->soundEndTimeKey = 0; + 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) @@ -515,7 +515,7 @@ int16 Game::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId, timeKey = _vm->_util->getTimeKey(); while (1) { - if (_vm->_inter->terminate != 0) { + if (_vm->_inter->_terminate) { if (handleMouse) _vm->_draw->blitCursor(); return 0; @@ -811,12 +811,11 @@ int16 Game::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 b if (key != 0 || activeCollResId != 0) break; - if (_vm->_inter->terminate != 0) + if (_vm->_inter->_terminate) return 0; } - if (key == 0 || activeCollResId != 0 - || _vm->_inter->terminate != 0) + if (key == 0 || activeCollResId != 0 || _vm->_inter->_terminate) return 0; switch (key) { @@ -1013,7 +1012,7 @@ int16 Game::multiEdit(int16 time, int16 index, int16 *pCurPos, InputDesc * inpDe _vm->_global->inter_variables + collArea->key, inpDesc[*pCurPos].fontIndex, collArea->flags, &time); - if (_vm->_inter->terminate != 0) + if (_vm->_inter->_terminate) return 0; switch (key) { @@ -1525,7 +1524,7 @@ void Game::collisionsBlock(void) { WRITE_VAR(16, 0); activeCollResId = 0; } - while (activeCollResId == 0 && _vm->_inter->terminate == 0); + while (activeCollResId == 0 && !_vm->_inter->_terminate); if (((uint16)activeCollResId & ~0x8000) == collResId) { collStackPos = 0; @@ -1595,7 +1594,7 @@ void Game::collisionsBlock(void) { } savedIP = 0; - if (_vm->_inter->terminate == 0) { + if (!_vm->_inter->_terminate) { savedIP = (char *)totFileData + collisionAreas[activeCollIndex].funcLeave; @@ -1741,13 +1740,13 @@ void Game::playTot(int16 skipPlay) { char *savedIP; int16 i; - oldNestLevel = _vm->_inter->nestLevel; - oldBreakFrom = _vm->_inter->breakFromLevel; + oldNestLevel = _vm->_inter->_nestLevel; + oldBreakFrom = _vm->_inter->_breakFromLevel; oldCaptureCounter = _vm->_scenery->pCaptureCounter; savedIP = _vm->_global->inter_execPtr; - _vm->_inter->nestLevel = &nestLevel; - _vm->_inter->breakFromLevel = &breakFrom; + _vm->_inter->_nestLevel = &nestLevel; + _vm->_inter->_breakFromLevel = &breakFrom; _vm->_scenery->pCaptureCounter = &captureCounter; strcpy(savedTotName, curTotFile); @@ -1870,7 +1869,7 @@ void Game::playTot(int16 skipPlay) { _vm->_inter->callSub(2); if (totToLoad[0] != 0) - _vm->_inter->terminate = 0; + _vm->_inter->_terminate = false; variablesCount = READ_LE_UINT32((char *)totFileData + 0x2c); _vm->_draw->blitInvalidated(); @@ -1921,8 +1920,8 @@ void Game::playTot(int16 skipPlay) { strcpy(curTotFile, savedTotName); - _vm->_inter->nestLevel = oldNestLevel; - _vm->_inter->breakFromLevel = oldBreakFrom; + _vm->_inter->_nestLevel = oldNestLevel; + _vm->_inter->_breakFromLevel = oldBreakFrom; _vm->_scenery->pCaptureCounter = oldCaptureCounter; _vm->_global->inter_execPtr = savedIP; } diff --git a/gob/goblin.cpp b/gob/goblin.cpp index 3da9c50764..ba60851fcf 100644 --- a/gob/goblin.cpp +++ b/gob/goblin.cpp @@ -660,16 +660,16 @@ void Goblin::switchGoblin(int16 index) { else next = index - 1; - if (_vm->_map->passMap[_vm->_map->curGoblinY][_vm->_map->curGoblinX] == 3 || - _vm->_map->passMap[_vm->_map->curGoblinY][_vm->_map->curGoblinX] == 6) + if (_vm->_map->_passMap[_vm->_map->_curGoblinY][_vm->_map->_curGoblinX] == 3 || + _vm->_map->_passMap[_vm->_map->_curGoblinY][_vm->_map->_curGoblinX] == 6) return; if (goblins[(currentGoblin + 1) % 3]->type != 0 && goblins[(currentGoblin + 2) % 3]->type != 0) return; - gobPositions[currentGoblin].x = _vm->_map->curGoblinX; - gobPositions[currentGoblin].y = _vm->_map->curGoblinY; + gobPositions[currentGoblin].x = _vm->_map->_curGoblinX; + gobPositions[currentGoblin].y = _vm->_map->_curGoblinY; goblins[currentGoblin]->doAnim = 1; goblins[currentGoblin]->nextState = 21; @@ -691,15 +691,15 @@ void Goblin::switchGoblin(int16 index) { tmp = gobPositions[currentGoblin].x; pressedMapX = tmp; - _vm->_map->destX = tmp; + _vm->_map->_destX = tmp; gobDestX = tmp; - _vm->_map->curGoblinX = tmp; + _vm->_map->_curGoblinX = tmp; tmp = gobPositions[currentGoblin].y; pressedMapY = tmp; - _vm->_map->destY = tmp; + _vm->_map->_destY = tmp; gobDestY = tmp; - _vm->_map->curGoblinY = tmp; + _vm->_map->_curGoblinY = tmp; *curGobVarPtr = currentGoblin; pathExistence = 0; @@ -713,9 +713,9 @@ void Goblin::adjustDest(int16 posX, int16 posY) { int16 deltaPix; int16 i; - if (_vm->_map->passMap[pressedMapY][pressedMapX] == 0 && + if (_vm->_map->_passMap[pressedMapY][pressedMapX] == 0 && (gobAction == 0 - || _vm->_map->itemsMap[pressedMapY][pressedMapX] == 0)) { + || _vm->_map->_itemsMap[pressedMapY][pressedMapX] == 0)) { resDelta = -1; resDeltaDir = 0; @@ -723,7 +723,7 @@ void Goblin::adjustDest(int16 posX, int16 posY) { for (i = 1; i <= pressedMapX - && _vm->_map->passMap[pressedMapY][pressedMapX - i] == 0; + && _vm->_map->_passMap[pressedMapY][pressedMapX - i] == 0; i++); if (i <= pressedMapX) { @@ -733,7 +733,7 @@ void Goblin::adjustDest(int16 posX, int16 posY) { for (i = 1; (i + pressedMapX) < Map::kMapWidth - && _vm->_map->passMap[pressedMapY][pressedMapX + i] == 0; + && _vm->_map->_passMap[pressedMapY][pressedMapX + i] == 0; i++); if (pressedMapX + i < Map::kMapWidth) { @@ -747,7 +747,7 @@ void Goblin::adjustDest(int16 posX, int16 posY) { for (i = 1; (i + pressedMapY) < Map::kMapHeight - && _vm->_map->passMap[pressedMapY + i][pressedMapX] == 0; + && _vm->_map->_passMap[pressedMapY + i][pressedMapX] == 0; i++); if (pressedMapY + i < Map::kMapHeight) { @@ -761,7 +761,7 @@ void Goblin::adjustDest(int16 posX, int16 posY) { for (i = 1; i <= pressedMapY - && _vm->_map->passMap[pressedMapY - i][pressedMapX] == 0; + && _vm->_map->_passMap[pressedMapY - i][pressedMapX] == 0; i++); if (i <= pressedMapY) { @@ -796,18 +796,18 @@ void Goblin::adjustDest(int16 posX, int16 posY) { void Goblin::adjustTarget(void) { if (gobAction == 4 - && _vm->_map->itemsMap[pressedMapY][pressedMapX] == 0) { + && _vm->_map->_itemsMap[pressedMapY][pressedMapX] == 0) { if (pressedMapY > 0 - && _vm->_map->itemsMap[pressedMapY - 1][pressedMapX] != + && _vm->_map->_itemsMap[pressedMapY - 1][pressedMapX] != 0) { pressedMapY--; } else if (pressedMapX < Map::kMapWidth - 1 - && _vm->_map->itemsMap[pressedMapY][pressedMapX + 1] != + && _vm->_map->_itemsMap[pressedMapY][pressedMapX + 1] != 0) { pressedMapX++; } else if (pressedMapX < Map::kMapWidth - 1 && pressedMapY > 0 - && _vm->_map->itemsMap[pressedMapY - 1][pressedMapX + + && _vm->_map->_itemsMap[pressedMapY - 1][pressedMapX + 1] != 0) { pressedMapY--; pressedMapX++; @@ -816,16 +816,16 @@ void Goblin::adjustTarget(void) { } void Goblin::targetDummyItem(Gob_Object *gobDesc) { - if (_vm->_map->itemsMap[pressedMapY][pressedMapX] == 0 && - _vm->_map->passMap[pressedMapY][pressedMapX] == 1) { + if (_vm->_map->_itemsMap[pressedMapY][pressedMapX] == 0 && + _vm->_map->_passMap[pressedMapY][pressedMapX] == 1) { if (gobDesc->curLookDir == 0) { - _vm->_map->itemPoses[0].x = pressedMapX; - _vm->_map->itemPoses[0].y = pressedMapY; - _vm->_map->itemPoses[0].orient = -4; + _vm->_map->_itemPoses[0].x = pressedMapX; + _vm->_map->_itemPoses[0].y = pressedMapY; + _vm->_map->_itemPoses[0].orient = -4; } else { - _vm->_map->itemPoses[0].x = pressedMapX; - _vm->_map->itemPoses[0].y = pressedMapY; - _vm->_map->itemPoses[0].orient = -1; + _vm->_map->_itemPoses[0].x = pressedMapX; + _vm->_map->_itemPoses[0].y = pressedMapY; + _vm->_map->_itemPoses[0].orient = -1; } } } @@ -840,7 +840,7 @@ void Goblin::targetItem(void) { Gob_Object *itemDesc; if (gobAction == 3 || gobAction == 4) { - items = _vm->_map->itemsMap[pressedMapY][pressedMapX]; + items = _vm->_map->_itemsMap[pressedMapY][pressedMapX]; if (gobAction == 4 && (items & 0xff00) != 0 && objects[itemToObject[(items & 0xff00) >> 8]]-> pickable == 1) { @@ -862,71 +862,71 @@ void Goblin::targetItem(void) { itemByteFlag = 0; } - pressedMapY = _vm->_map->itemPoses[destItemId].y; - _vm->_map->destY = _vm->_map->itemPoses[destItemId].y; - gobDestY = _vm->_map->itemPoses[destItemId].y; + pressedMapY = _vm->_map->_itemPoses[destItemId].y; + _vm->_map->_destY = _vm->_map->_itemPoses[destItemId].y; + gobDestY = _vm->_map->_itemPoses[destItemId].y; if (gobAction == 3 || destActionItem == 0) { - pressedMapX = _vm->_map->itemPoses[destItemId].x; - _vm->_map->destX = _vm->_map->itemPoses[destItemId].x; - gobDestX = _vm->_map->itemPoses[destItemId].x; + pressedMapX = _vm->_map->_itemPoses[destItemId].x; + _vm->_map->_destX = _vm->_map->_itemPoses[destItemId].x; + gobDestX = _vm->_map->_itemPoses[destItemId].x; } else if ((items & 0xff00) != 0) { - if (_vm->_map->itemPoses[destItemId].orient == 4) { - if ((_vm->_map->itemsMap[pressedMapY] + if (_vm->_map->_itemPoses[destItemId].orient == 4) { + if ((_vm->_map->_itemsMap[pressedMapY] [pressedMapX - 1] & 0xff00) == - (_vm->_map->itemsMap[pressedMapY] + (_vm->_map->_itemsMap[pressedMapY] [pressedMapX] & 0xff00)) { pressedMapX--; - _vm->_map->destX = pressedMapX; + _vm->_map->_destX = pressedMapX; gobDestX = pressedMapX; } - } else if (_vm->_map->itemPoses[destItemId].orient == 0) { + } else if (_vm->_map->_itemPoses[destItemId].orient == 0) { - if ((_vm->_map->itemsMap[pressedMapY] + if ((_vm->_map->_itemsMap[pressedMapY] [pressedMapX + 1] & 0xff00) == - (_vm->_map->itemsMap[pressedMapY] + (_vm->_map->_itemsMap[pressedMapY] [pressedMapX] & 0xff00)) { pressedMapX++; - _vm->_map->destX = pressedMapX; + _vm->_map->_destX = pressedMapX; gobDestX = pressedMapX; } } - if ((_vm->_map->itemsMap[pressedMapY + + if ((_vm->_map->_itemsMap[pressedMapY + 1][pressedMapX] & 0xff00) == - (_vm->_map->itemsMap[pressedMapY][pressedMapX] & + (_vm->_map->_itemsMap[pressedMapY][pressedMapX] & 0xff00)) { pressedMapY++; - _vm->_map->destY = pressedMapY; + _vm->_map->_destY = pressedMapY; gobDestY = pressedMapY; } } else { - if (_vm->_map->itemPoses[destItemId].orient == 4) { - if ((_vm->_map->itemsMap[pressedMapY] + if (_vm->_map->_itemPoses[destItemId].orient == 4) { + if ((_vm->_map->_itemsMap[pressedMapY] [pressedMapX - 1]) == - (_vm->_map->itemsMap[pressedMapY] + (_vm->_map->_itemsMap[pressedMapY] [pressedMapX])) { pressedMapX--; - _vm->_map->destX = pressedMapX; + _vm->_map->_destX = pressedMapX; gobDestX = pressedMapX; } - } else if (_vm->_map->itemPoses[destItemId].orient == 0) { + } else if (_vm->_map->_itemPoses[destItemId].orient == 0) { - if ((_vm->_map->itemsMap[pressedMapY] + if ((_vm->_map->_itemsMap[pressedMapY] [pressedMapX + 1]) == - (_vm->_map->itemsMap[pressedMapY] + (_vm->_map->_itemsMap[pressedMapY] [pressedMapX])) { pressedMapX++; - _vm->_map->destX = pressedMapX; + _vm->_map->_destX = pressedMapX; gobDestX = pressedMapX; } } - if ((_vm->_map->itemsMap[pressedMapY + + if ((_vm->_map->_itemsMap[pressedMapY + 1][pressedMapX]) == - (_vm->_map->itemsMap[pressedMapY][pressedMapX])) { + (_vm->_map->_itemsMap[pressedMapY][pressedMapX])) { pressedMapY++; - _vm->_map->destY = pressedMapY; + _vm->_map->_destY = pressedMapY; gobDestY = pressedMapY; } @@ -960,18 +960,18 @@ void Goblin::targetItem(void) { if ((tmpX % 12) < 6 && tmpPosX > 0) tmpPosX--; - if (_vm->_map->itemPoses[destActionItem].orient == 0 || - _vm->_map->itemPoses[destActionItem].orient == -1) { + if (_vm->_map->_itemPoses[destActionItem].orient == 0 || + _vm->_map->_itemPoses[destActionItem].orient == -1) { tmpPosX++; } - if (_vm->_map->passMap[tmpPosY][tmpPosX] == 1) { + if (_vm->_map->_passMap[tmpPosY][tmpPosX] == 1) { pressedMapX = tmpPosX; - _vm->_map->destX = tmpPosX; + _vm->_map->_destX = tmpPosX; gobDestX = tmpPosX; pressedMapY = tmpPosY; - _vm->_map->destY = tmpPosY; + _vm->_map->_destY = tmpPosY; gobDestY = tmpPosY; } } @@ -983,17 +983,17 @@ void Goblin::initiateMove(void) { _vm->_map->findNearestToGob(); _vm->_map->optimizePoints(); - pathExistence = _vm->_map->checkDirectPath(_vm->_map->curGoblinX, _vm->_map->curGoblinY, + pathExistence = _vm->_map->checkDirectPath(_vm->_map->_curGoblinX, _vm->_map->_curGoblinY, pressedMapX, pressedMapY); if (pathExistence == 3) { - if (_vm->_map->checkLongPath(_vm->_map->curGoblinX, _vm->_map->curGoblinY, + if (_vm->_map->checkLongPath(_vm->_map->_curGoblinX, _vm->_map->_curGoblinY, pressedMapX, pressedMapY, - _vm->_map->nearestWayPoint, _vm->_map->nearestDest) == 0) { + _vm->_map->_nearestWayPoint, _vm->_map->_nearestDest) == 0) { pathExistence = 0; } else { - _vm->_map->destX = _vm->_map->wayPoints[_vm->_map->nearestWayPoint].x; - _vm->_map->destY = _vm->_map->wayPoints[_vm->_map->nearestWayPoint].y; + _vm->_map->_destX = _vm->_map->_wayPoints[_vm->_map->_nearestWayPoint].x; + _vm->_map->_destY = _vm->_map->_wayPoints[_vm->_map->_nearestWayPoint].y; } } } @@ -1036,36 +1036,36 @@ void Goblin::moveFindItem(int16 posX, int16 posY) { pressedMapX = posX / 12; pressedMapY = posY / 6; - if (_vm->_map->itemsMap[pressedMapY][pressedMapX] == 0 + if (_vm->_map->_itemsMap[pressedMapY][pressedMapX] == 0 && i < 20) { - if (_vm->_map->itemsMap[pressedMapY + + if (_vm->_map->_itemsMap[pressedMapY + 1][pressedMapX] != 0) { pressedMapY++; - } else if (_vm->_map->itemsMap[pressedMapY + + } else if (_vm->_map->_itemsMap[pressedMapY + 1][pressedMapX + 1] != 0) { pressedMapX++; pressedMapY++; } else - if (_vm->_map->itemsMap[pressedMapY][pressedMapX + + if (_vm->_map->_itemsMap[pressedMapY][pressedMapX + 1] != 0) { pressedMapX++; - } else if (_vm->_map->itemsMap[pressedMapY - + } else if (_vm->_map->_itemsMap[pressedMapY - 1][pressedMapX + 1] != 0) { pressedMapX++; pressedMapY--; - } else if (_vm->_map->itemsMap[pressedMapY - + } else if (_vm->_map->_itemsMap[pressedMapY - 1][pressedMapX] != 0) { pressedMapY--; - } else if (_vm->_map->itemsMap[pressedMapY - + } else if (_vm->_map->_itemsMap[pressedMapY - 1][pressedMapX - 1] != 0) { pressedMapY--; pressedMapX--; } else - if (_vm->_map->itemsMap[pressedMapY][pressedMapX - + if (_vm->_map->_itemsMap[pressedMapY][pressedMapX - 1] != 0) { pressedMapX--; - } else if (_vm->_map->itemsMap[pressedMapY + + } else if (_vm->_map->_itemsMap[pressedMapY + 1][pressedMapX - 1] != 0) { pressedMapX--; pressedMapY++; @@ -1095,8 +1095,8 @@ void Goblin::moveCheckSelect(int16 framesCount, Gob_Object * gobDesc, int16 *pGo if (*pGobIndex != 0) { pathExistence = 0; - } else if (_vm->_map->curGoblinX == pressedMapX && - _vm->_map->curGoblinY == pressedMapY) { + } else if (_vm->_map->_curGoblinX == pressedMapX && + _vm->_map->_curGoblinY == pressedMapY) { if (gobAction != 0) readyToAct = 1; @@ -1139,10 +1139,10 @@ void Goblin::moveInitStep(int16 framesCount, int16 action, int16 cont, adjustDest(posX, posY); adjustTarget(); - _vm->_map->destX = pressedMapX; + _vm->_map->_destX = pressedMapX; gobDestX = pressedMapX; - _vm->_map->destY = pressedMapY; + _vm->_map->_destY = pressedMapY; gobDestY = pressedMapY; targetDummyItem(gobDesc); @@ -1154,8 +1154,8 @@ void Goblin::moveInitStep(int16 framesCount, int16 action, int16 cont, } else { if (readyToAct != 0 && - (_vm->_map->curGoblinX != pressedMapX || - _vm->_map->curGoblinY != pressedMapY)) + (_vm->_map->_curGoblinX != pressedMapX || + _vm->_map->_curGoblinY != pressedMapY)) readyToAct = 0; if (gobDesc->type == 1) { @@ -1169,57 +1169,57 @@ void Goblin::moveTreatRopeStairs(Gob_Object *gobDesc) { return; if (gobDesc->nextState == 28 - && _vm->_map->passMap[_vm->_map->curGoblinY - 1][_vm->_map->curGoblinX] == 6) { + && _vm->_map->_passMap[_vm->_map->_curGoblinY - 1][_vm->_map->_curGoblinX] == 6) { forceNextState[0] = 28; forceNextState[1] = -1; } if (gobDesc->nextState == 29 - && _vm->_map->passMap[_vm->_map->curGoblinY + 1][_vm->_map->curGoblinX] == 6) { + && _vm->_map->_passMap[_vm->_map->_curGoblinY + 1][_vm->_map->_curGoblinX] == 6) { forceNextState[0] = 29; forceNextState[1] = -1; } if ((gobDesc->nextState == 28 || gobDesc->nextState == 29 || gobDesc->nextState == 20) - && _vm->_map->passMap[_vm->_map->curGoblinY][_vm->_map->curGoblinX] == 6) { + && _vm->_map->_passMap[_vm->_map->_curGoblinY][_vm->_map->_curGoblinX] == 6) { if ((gobDesc->curLookDir == 0 || gobDesc->curLookDir == 4 || gobDesc->curLookDir == 2) - && _vm->_map->passMap[_vm->_map->curGoblinY - 1][_vm->_map->curGoblinX] == 6) { + && _vm->_map->_passMap[_vm->_map->_curGoblinY - 1][_vm->_map->_curGoblinX] == 6) { forceNextState[0] = 28; forceNextState[1] = -1; } else if ((gobDesc->curLookDir == 0 || gobDesc->curLookDir == 4 || gobDesc->curLookDir == 6) - && _vm->_map->passMap[_vm->_map->curGoblinY + 1][_vm->_map->curGoblinX] == 6) { + && _vm->_map->_passMap[_vm->_map->_curGoblinY + 1][_vm->_map->_curGoblinX] == 6) { forceNextState[0] = 29; forceNextState[1] = -1; } } if (gobDesc->nextState == 8 - && _vm->_map->passMap[_vm->_map->curGoblinY - 1][_vm->_map->curGoblinX] == 3) { + && _vm->_map->_passMap[_vm->_map->_curGoblinY - 1][_vm->_map->_curGoblinX] == 3) { forceNextState[0] = 8; forceNextState[1] = -1; } if (gobDesc->nextState == 9 - && _vm->_map->passMap[_vm->_map->curGoblinY + 1][_vm->_map->curGoblinX] == 3) { + && _vm->_map->_passMap[_vm->_map->_curGoblinY + 1][_vm->_map->_curGoblinX] == 3) { forceNextState[0] = 9; forceNextState[1] = -1; } if (gobDesc->nextState == 20 - && _vm->_map->passMap[_vm->_map->curGoblinY][_vm->_map->curGoblinX] == 3) { + && _vm->_map->_passMap[_vm->_map->_curGoblinY][_vm->_map->_curGoblinX] == 3) { if ((gobDesc->curLookDir == 0 || gobDesc->curLookDir == 4 || gobDesc->curLookDir == 2) - && _vm->_map->passMap[_vm->_map->curGoblinY - 1][_vm->_map->curGoblinX] == 3) { + && _vm->_map->_passMap[_vm->_map->_curGoblinY - 1][_vm->_map->_curGoblinX] == 3) { forceNextState[0] = 8; forceNextState[1] = -1; } else if ((gobDesc->curLookDir == 0 || gobDesc->curLookDir == 4 || gobDesc->curLookDir == 6) - && _vm->_map->passMap[_vm->_map->curGoblinY + 1][_vm->_map->curGoblinX] == 3) { + && _vm->_map->_passMap[_vm->_map->_curGoblinY + 1][_vm->_map->_curGoblinX] == 3) { forceNextState[0] = 9; forceNextState[1] = -1; } @@ -1229,76 +1229,76 @@ void Goblin::moveTreatRopeStairs(Gob_Object *gobDesc) { void Goblin::movePathFind(Gob_Object *gobDesc, int16 nextAct) { if (pathExistence == 1) { - _vm->_map->curGoblinX = gobPositions[currentGoblin].x; - _vm->_map->curGoblinY = gobPositions[currentGoblin].y; + _vm->_map->_curGoblinX = gobPositions[currentGoblin].x; + _vm->_map->_curGoblinY = gobPositions[currentGoblin].y; - if (_vm->_map->curGoblinX == pressedMapX && - _vm->_map->curGoblinY == pressedMapY && gobAction != 0) { + if (_vm->_map->_curGoblinX == pressedMapX && + _vm->_map->_curGoblinY == pressedMapY && gobAction != 0) { readyToAct = 1; pathExistence = 0; } - nextAct = _vm->_map->getDirection(_vm->_map->curGoblinX, _vm->_map->curGoblinY, - _vm->_map->destX, _vm->_map->destY); + nextAct = _vm->_map->getDirection(_vm->_map->_curGoblinX, _vm->_map->_curGoblinY, + _vm->_map->_destX, _vm->_map->_destY); if (nextAct == 0) pathExistence = 0; } else if (pathExistence == 3) { - _vm->_map->curGoblinX = gobPositions[currentGoblin].x; - _vm->_map->curGoblinY = gobPositions[currentGoblin].y; + _vm->_map->_curGoblinX = gobPositions[currentGoblin].x; + _vm->_map->_curGoblinY = gobPositions[currentGoblin].y; - if (_vm->_map->curGoblinX == gobDestX && _vm->_map->curGoblinY == gobDestY) { + if (_vm->_map->_curGoblinX == gobDestX && _vm->_map->_curGoblinY == gobDestY) { pathExistence = 1; - _vm->_map->destX = pressedMapX; - _vm->_map->destY = pressedMapY; + _vm->_map->_destX = pressedMapX; + _vm->_map->_destY = pressedMapY; } else { - if (_vm->_map->checkDirectPath(_vm->_map->curGoblinX, _vm->_map->curGoblinY, + if (_vm->_map->checkDirectPath(_vm->_map->_curGoblinX, _vm->_map->_curGoblinY, gobDestX, gobDestY) == 1) { - _vm->_map->destX = gobDestX; - _vm->_map->destY = gobDestY; - } else if (_vm->_map->curGoblinX == _vm->_map->destX && _vm->_map->curGoblinY == _vm->_map->destY) { + _vm->_map->_destX = gobDestX; + _vm->_map->_destY = gobDestY; + } else if (_vm->_map->_curGoblinX == _vm->_map->_destX && _vm->_map->_curGoblinY == _vm->_map->_destY) { - if (_vm->_map->nearestWayPoint > _vm->_map->nearestDest) { + if (_vm->_map->_nearestWayPoint > _vm->_map->_nearestDest) { _vm->_map->optimizePoints(); - _vm->_map->destX = - _vm->_map->wayPoints[_vm->_map->nearestWayPoint]. + _vm->_map->_destX = + _vm->_map->_wayPoints[_vm->_map->_nearestWayPoint]. x; - _vm->_map->destY = - _vm->_map->wayPoints[_vm->_map->nearestWayPoint]. + _vm->_map->_destY = + _vm->_map->_wayPoints[_vm->_map->_nearestWayPoint]. y; - if (_vm->_map->nearestWayPoint > _vm->_map->nearestDest) - _vm->_map->nearestWayPoint--; - } else if (_vm->_map->nearestWayPoint < _vm->_map->nearestDest) { + if (_vm->_map->_nearestWayPoint > _vm->_map->_nearestDest) + _vm->_map->_nearestWayPoint--; + } else if (_vm->_map->_nearestWayPoint < _vm->_map->_nearestDest) { _vm->_map->optimizePoints(); - _vm->_map->destX = - _vm->_map->wayPoints[_vm->_map->nearestWayPoint]. + _vm->_map->_destX = + _vm->_map->_wayPoints[_vm->_map->_nearestWayPoint]. x; - _vm->_map->destY = - _vm->_map->wayPoints[_vm->_map->nearestWayPoint]. + _vm->_map->_destY = + _vm->_map->_wayPoints[_vm->_map->_nearestWayPoint]. y; - if (_vm->_map->nearestWayPoint < _vm->_map->nearestDest) - _vm->_map->nearestWayPoint++; + if (_vm->_map->_nearestWayPoint < _vm->_map->_nearestDest) + _vm->_map->_nearestWayPoint++; } else { - if (_vm->_map->checkDirectPath(_vm->_map->curGoblinX, - _vm->_map->curGoblinY, gobDestX, - gobDestY) == 3 && _vm->_map->passMap[pressedMapY][pressedMapX] != 0) { - _vm->_map->destX = _vm->_map->wayPoints[_vm->_map->nearestWayPoint].x; - _vm->_map->destY = _vm->_map->wayPoints[_vm->_map->nearestWayPoint].y; + if (_vm->_map->checkDirectPath(_vm->_map->_curGoblinX, + _vm->_map->_curGoblinY, gobDestX, + gobDestY) == 3 && _vm->_map->_passMap[pressedMapY][pressedMapX] != 0) { + _vm->_map->_destX = _vm->_map->_wayPoints[_vm->_map->_nearestWayPoint].x; + _vm->_map->_destY = _vm->_map->_wayPoints[_vm->_map->_nearestWayPoint].y; } else { pathExistence = 1; - _vm->_map->destX = pressedMapX; - _vm->_map->destY = pressedMapY; + _vm->_map->_destX = pressedMapX; + _vm->_map->_destY = pressedMapY; } } } nextAct = - _vm->_map->getDirection(_vm->_map->curGoblinX, _vm->_map->curGoblinY, - _vm->_map->destX, _vm->_map->destY); + _vm->_map->getDirection(_vm->_map->_curGoblinX, _vm->_map->_curGoblinY, + _vm->_map->_destX, _vm->_map->_destY); } } @@ -1323,18 +1323,18 @@ void Goblin::movePathFind(Gob_Object *gobDesc, int16 nextAct) { break; case Map::kDirN: - if (_vm->_map->passMap[_vm->_map->curGoblinY - 1][_vm->_map->curGoblinX] == 6 && + if (_vm->_map->_passMap[_vm->_map->_curGoblinY - 1][_vm->_map->_curGoblinX] == 6 && currentGoblin != 1) { pathExistence = 0; break; } - if (_vm->_map->passMap[_vm->_map->curGoblinY][_vm->_map->curGoblinX] == 3) { + if (_vm->_map->_passMap[_vm->_map->_curGoblinY][_vm->_map->_curGoblinX] == 3) { gobDesc->nextState = 8; break; } - if (_vm->_map->passMap[_vm->_map->curGoblinY][_vm->_map->curGoblinX] == 6 && + if (_vm->_map->_passMap[_vm->_map->_curGoblinY][_vm->_map->_curGoblinX] == 6 && currentGoblin == 1) { gobDesc->nextState = 28; break; @@ -1344,18 +1344,18 @@ void Goblin::movePathFind(Gob_Object *gobDesc, int16 nextAct) { break; case Map::kDirS: - if (_vm->_map->passMap[_vm->_map->curGoblinY + 1][_vm->_map->curGoblinX] == 6 && + if (_vm->_map->_passMap[_vm->_map->_curGoblinY + 1][_vm->_map->_curGoblinX] == 6 && currentGoblin != 1) { pathExistence = 0; break; } - if (_vm->_map->passMap[_vm->_map->curGoblinY][_vm->_map->curGoblinX] == 3) { + if (_vm->_map->_passMap[_vm->_map->_curGoblinY][_vm->_map->_curGoblinX] == 3) { gobDesc->nextState = 9; break; } - if (_vm->_map->passMap[_vm->_map->curGoblinY][_vm->_map->curGoblinX] == 6 && + if (_vm->_map->_passMap[_vm->_map->_curGoblinY][_vm->_map->_curGoblinX] == 6 && currentGoblin == 1) { gobDesc->nextState = 29; break; @@ -1365,7 +1365,7 @@ void Goblin::movePathFind(Gob_Object *gobDesc, int16 nextAct) { break; case Map::kDirSE: - if (_vm->_map->passMap[_vm->_map->curGoblinY + 1][_vm->_map->curGoblinX + 1] == 6 && + if (_vm->_map->_passMap[_vm->_map->_curGoblinY + 1][_vm->_map->_curGoblinX + 1] == 6 && currentGoblin != 1) { pathExistence = 0; break; @@ -1379,7 +1379,7 @@ void Goblin::movePathFind(Gob_Object *gobDesc, int16 nextAct) { break; case Map::kDirSW: - if (_vm->_map->passMap[_vm->_map->curGoblinY + 1][_vm->_map->curGoblinX - 1] == 6 && + if (_vm->_map->_passMap[_vm->_map->_curGoblinY + 1][_vm->_map->_curGoblinX - 1] == 6 && currentGoblin != 1) { pathExistence = 0; break; @@ -1393,7 +1393,7 @@ void Goblin::movePathFind(Gob_Object *gobDesc, int16 nextAct) { break; case Map::kDirNW: - if (_vm->_map->passMap[_vm->_map->curGoblinY - 1][_vm->_map->curGoblinX - 1] == 6 && + if (_vm->_map->_passMap[_vm->_map->_curGoblinY - 1][_vm->_map->_curGoblinX - 1] == 6 && currentGoblin != 1) { pathExistence = 0; break; @@ -1407,7 +1407,7 @@ void Goblin::movePathFind(Gob_Object *gobDesc, int16 nextAct) { break; case Map::kDirNE: - if (_vm->_map->passMap[_vm->_map->curGoblinY - 1][_vm->_map->curGoblinX + 1] == 6 && + if (_vm->_map->_passMap[_vm->_map->_curGoblinY - 1][_vm->_map->_curGoblinX + 1] == 6 && currentGoblin != 1) { pathExistence = 0; break; @@ -1448,7 +1448,7 @@ void Goblin::movePathFind(Gob_Object *gobDesc, int16 nextAct) { break; } - switch (_vm->_map->itemPoses[destActionItem].orient) { + switch (_vm->_map->_itemPoses[destActionItem].orient) { case 0: case -4: gobDesc->nextState = 10; @@ -1466,8 +1466,8 @@ void Goblin::movePathFind(Gob_Object *gobDesc, int16 nextAct) { break; default: - if (_vm->_map->passMap[_vm->_map->curGoblinY][_vm->_map->curGoblinX] == 3 || - (_vm->_map->passMap[_vm->_map->curGoblinY][_vm->_map->curGoblinX] == 6 + if (_vm->_map->_passMap[_vm->_map->_curGoblinY][_vm->_map->_curGoblinX] == 3 || + (_vm->_map->_passMap[_vm->_map->_curGoblinY][_vm->_map->_curGoblinX] == 6 && currentGoblin == 1)) { gobDesc->nextState = 20; break; @@ -1611,8 +1611,8 @@ void Goblin::moveAdvance(Gob_Object *gobDesc, int16 nextAct, int16 framesCount) forceNextState[i + 1]; } - _vm->_map->curGoblinX = gobPositions[currentGoblin].x; - _vm->_map->curGoblinY = gobPositions[currentGoblin].y; + _vm->_map->_curGoblinX = gobPositions[currentGoblin].x; + _vm->_map->_curGoblinY = gobPositions[currentGoblin].y; if (gobDesc->nextState != gobDesc->state) { gobStateLayer = nextLayer(gobDesc); @@ -1677,10 +1677,10 @@ void Goblin::moveAdvance(Gob_Object *gobDesc, int16 nextAct, int16 framesCount) gobDesc->yPos, 0); gobDesc->yPos = - (_vm->_map->curGoblinY + 1) * 6 - + (_vm->_map->_curGoblinY + 1) * 6 - (_vm->_scenery->toRedrawBottom - _vm->_scenery->animTop); gobDesc->xPos = - _vm->_map->curGoblinX * 12 - (_vm->_scenery->toRedrawLeft - + _vm->_map->_curGoblinX * 12 - (_vm->_scenery->toRedrawLeft - _vm->_scenery->animLeft); } @@ -1699,8 +1699,8 @@ void Goblin::moveAdvance(Gob_Object *gobDesc, int16 nextAct, int16 framesCount) forceNextState[i + 1]; } - _vm->_map->curGoblinX = gobPositions[currentGoblin].x; - _vm->_map->curGoblinY = gobPositions[currentGoblin].y; + _vm->_map->_curGoblinX = gobPositions[currentGoblin].x; + _vm->_map->_curGoblinY = gobPositions[currentGoblin].y; gobStateLayer = nextLayer(gobDesc); if (gobDesc->stateMach == gobDesc->realStateMach) { @@ -1761,10 +1761,10 @@ void Goblin::moveAdvance(Gob_Object *gobDesc, int16 nextAct, int16 framesCount) gobDesc->xPos, gobDesc->yPos, 0); gobDesc->yPos = - (_vm->_map->curGoblinY + 1) * 6 - (_vm->_scenery->toRedrawBottom - + (_vm->_map->_curGoblinY + 1) * 6 - (_vm->_scenery->toRedrawBottom - _vm->_scenery->animTop); gobDesc->xPos = - _vm->_map->curGoblinX * 12 - (_vm->_scenery->toRedrawLeft - _vm->_scenery->animLeft); + _vm->_map->_curGoblinX * 12 - (_vm->_scenery->toRedrawLeft - _vm->_scenery->animLeft); if ((gobDesc->state == 10 || gobDesc->state == 11) && currentGoblin != 0) @@ -1792,8 +1792,8 @@ int16 Goblin::doMove(Gob_Object *gobDesc, int16 cont, int16 action) { } if (positionedGob != currentGoblin) { - _vm->_map->curGoblinX = gobPositions[currentGoblin].x; - _vm->_map->curGoblinY = gobPositions[currentGoblin].y; + _vm->_map->_curGoblinX = gobPositions[currentGoblin].x; + _vm->_map->_curGoblinY = gobPositions[currentGoblin].y; } positionedGob = currentGoblin; @@ -1897,9 +1897,9 @@ void Goblin::loadObjects(char *source) { freeObjects(); initList(); - strcpy(_vm->_map->sourceFile, source); + strcpy(_vm->_map->_sourceFile, source); - _vm->_map->sourceFile[strlen(_vm->_map->sourceFile) - 4] = 0; + _vm->_map->_sourceFile[strlen(_vm->_map->_sourceFile) - 4] = 0; _vm->_map->loadMapObjects(source); for (i = 0; i < gobsCount; i++) @@ -2104,20 +2104,20 @@ void Goblin::pickItem(int16 indexToPocket, int16 idToPocket) { for (y = 0; y < Map::kMapHeight; y++) { for (x = 0; x < Map::kMapWidth; x++) { if (itemByteFlag == 1) { - if (((_vm->_map->itemsMap[y][x] & 0xff00) >> 8) == + if (((_vm->_map->_itemsMap[y][x] & 0xff00) >> 8) == idToPocket) - _vm->_map->itemsMap[y][x] &= 0xff; + _vm->_map->_itemsMap[y][x] &= 0xff; } else { - if ((_vm->_map->itemsMap[y][x] & 0xff) == idToPocket) - _vm->_map->itemsMap[y][x] &= 0xff00; + if ((_vm->_map->_itemsMap[y][x] & 0xff) == idToPocket) + _vm->_map->_itemsMap[y][x] &= 0xff00; } } } if (idToPocket >= 0 && idToPocket < 20) { - _vm->_map->itemPoses[itemIdInPocket].x = 0; - _vm->_map->itemPoses[itemIdInPocket].y = 0; - _vm->_map->itemPoses[itemIdInPocket].orient = 0; + _vm->_map->_itemPoses[itemIdInPocket].x = 0; + _vm->_map->_itemPoses[itemIdInPocket].y = 0; + _vm->_map->_itemPoses[itemIdInPocket].orient = 0; } } @@ -2186,16 +2186,16 @@ void Goblin::placeItem(int16 indexInPocket, int16 idInPocket) { } if (idInPocket >= 0 && idInPocket < 20) { - _vm->_map->itemPoses[idInPocket].x = gobPositions[0].x; - _vm->_map->itemPoses[idInPocket].y = gobPositions[0].y; - _vm->_map->itemPoses[idInPocket].orient = lookDir; - if (_vm->_map->itemPoses[idInPocket].orient == 0) { -// _vm->_map->itemPoses[idInPocket].x++; - if (_vm->_map->passMap[(int)_vm->_map->itemPoses[idInPocket].y][_vm->_map->itemPoses[idInPocket].x + 1] == 1) - _vm->_map->itemPoses[idInPocket].x++; + _vm->_map->_itemPoses[idInPocket].x = gobPositions[0].x; + _vm->_map->_itemPoses[idInPocket].y = gobPositions[0].y; + _vm->_map->_itemPoses[idInPocket].orient = lookDir; + if (_vm->_map->_itemPoses[idInPocket].orient == 0) { +// _vm->_map->_itemPoses[idInPocket].x++; + if (_vm->_map->_passMap[(int)_vm->_map->_itemPoses[idInPocket].y][_vm->_map->_itemPoses[idInPocket].x + 1] == 1) + _vm->_map->_itemPoses[idInPocket].x++; } else { - if (_vm->_map->passMap[(int)_vm->_map->itemPoses[idInPocket].y][_vm->_map->itemPoses[idInPocket].x - 1] == 1) - _vm->_map->itemPoses[idInPocket].x--; + if (_vm->_map->_passMap[(int)_vm->_map->_itemPoses[idInPocket].y][_vm->_map->_itemPoses[idInPocket].x - 1] == 1) + _vm->_map->_itemPoses[idInPocket].x--; } } } @@ -2219,9 +2219,9 @@ void Goblin::swapItems(int16 indexToPick, int16 idToPick) { if (itemByteFlag == 0) { for (y = 0; y < Map::kMapHeight; y++) { for (x = 0; x < Map::kMapWidth; x++) { - if ((_vm->_map->itemsMap[y][x] & 0xff) == idToPick) - _vm->_map->itemsMap[y][x] = - (_vm->_map->itemsMap[y][x] & 0xff00) + + if ((_vm->_map->_itemsMap[y][x] & 0xff) == idToPick) + _vm->_map->_itemsMap[y][x] = + (_vm->_map->_itemsMap[y][x] & 0xff00) + idToPlace; } } @@ -2229,26 +2229,26 @@ void Goblin::swapItems(int16 indexToPick, int16 idToPick) { for (y = 0; y < Map::kMapHeight; y++) { for (x = 0; x < Map::kMapWidth; x++) { - if (((_vm->_map->itemsMap[y][x] & 0xff00) >> 8) == + if (((_vm->_map->_itemsMap[y][x] & 0xff00) >> 8) == idToPick) - _vm->_map->itemsMap[y][x] = - (_vm->_map->itemsMap[y][x] & 0xff) + + _vm->_map->_itemsMap[y][x] = + (_vm->_map->_itemsMap[y][x] & 0xff) + (idToPlace << 8); } } } if (idToPick >= 0 && idToPick < 20) { - _vm->_map->itemPoses[idToPlace].x = - _vm->_map->itemPoses[itemIdInPocket].x; - _vm->_map->itemPoses[idToPlace].y = - _vm->_map->itemPoses[itemIdInPocket].y; - _vm->_map->itemPoses[idToPlace].orient = - _vm->_map->itemPoses[itemIdInPocket].orient; - - _vm->_map->itemPoses[itemIdInPocket].x = 0; - _vm->_map->itemPoses[itemIdInPocket].y = 0; - _vm->_map->itemPoses[itemIdInPocket].orient = 0; + _vm->_map->_itemPoses[idToPlace].x = + _vm->_map->_itemPoses[itemIdInPocket].x; + _vm->_map->_itemPoses[idToPlace].y = + _vm->_map->_itemPoses[itemIdInPocket].y; + _vm->_map->_itemPoses[idToPlace].orient = + _vm->_map->_itemPoses[itemIdInPocket].orient; + + _vm->_map->_itemPoses[itemIdInPocket].x = 0; + _vm->_map->_itemPoses[itemIdInPocket].y = 0; + _vm->_map->_itemPoses[itemIdInPocket].orient = 0; } itemIndInPocket = -1; @@ -2273,7 +2273,7 @@ void Goblin::swapItems(int16 indexToPick, int16 idToPick) { placeObj->yPos += (gobPositions[0].y * 6) + 5 - _vm->_scenery->toRedrawBottom; - if (_vm->_map->itemPoses[idToPlace].orient == 4) { + if (_vm->_map->_itemPoses[idToPlace].orient == 4) { placeObj->xPos += (gobPositions[0].x * 12 + 14) - (_vm->_scenery->toRedrawLeft + _vm->_scenery->toRedrawRight) / 2; } else { @@ -2608,107 +2608,107 @@ void Goblin::interFunc(void) { for (y = 0; y < Map::kMapHeight; y++) { for (x = 0; x < Map::kMapWidth; x++) { - if ((_vm->_map->itemsMap[y][x] & 0xff) == item) { - _vm->_map->itemsMap[y][x] &= 0xff00; - } else if (((_vm->_map->itemsMap[y][x] & 0xff00) >> 8) + if ((_vm->_map->_itemsMap[y][x] & 0xff) == item) { + _vm->_map->_itemsMap[y][x] &= 0xff00; + } else if (((_vm->_map->_itemsMap[y][x] & 0xff00) >> 8) == item) { - _vm->_map->itemsMap[y][x] &= 0xff; + _vm->_map->_itemsMap[y][x] &= 0xff; } } } if (xPos < Map::kMapWidth - 1) { if (yPos > 0) { - if ((_vm->_map->itemsMap[yPos][xPos] & 0xff00) != 0 || - (_vm->_map->itemsMap[yPos - 1][xPos] & 0xff00) != + if ((_vm->_map->_itemsMap[yPos][xPos] & 0xff00) != 0 || + (_vm->_map->_itemsMap[yPos - 1][xPos] & 0xff00) != 0 - || (_vm->_map->itemsMap[yPos][xPos + + || (_vm->_map->_itemsMap[yPos][xPos + 1] & 0xff00) != 0 - || (_vm->_map->itemsMap[yPos - 1][xPos + + || (_vm->_map->_itemsMap[yPos - 1][xPos + 1] & 0xff00) != 0) { - _vm->_map->itemsMap[yPos][xPos] = - (_vm->_map->itemsMap[yPos][xPos] & 0xff00) + _vm->_map->_itemsMap[yPos][xPos] = + (_vm->_map->_itemsMap[yPos][xPos] & 0xff00) + item; - _vm->_map->itemsMap[yPos - 1][xPos] = - (_vm->_map->itemsMap[yPos - + _vm->_map->_itemsMap[yPos - 1][xPos] = + (_vm->_map->_itemsMap[yPos - 1][xPos] & 0xff00) + item; - _vm->_map->itemsMap[yPos][xPos + 1] = - (_vm->_map->itemsMap[yPos][xPos + + _vm->_map->_itemsMap[yPos][xPos + 1] = + (_vm->_map->_itemsMap[yPos][xPos + 1] & 0xff00) + item; - _vm->_map->itemsMap[yPos - 1][xPos + 1] = - (_vm->_map->itemsMap[yPos - 1][xPos + + _vm->_map->_itemsMap[yPos - 1][xPos + 1] = + (_vm->_map->_itemsMap[yPos - 1][xPos + 1] & 0xff00) + item; } else { - _vm->_map->itemsMap[yPos][xPos] = - (_vm->_map->itemsMap[yPos][xPos] & 0xff) + + _vm->_map->_itemsMap[yPos][xPos] = + (_vm->_map->_itemsMap[yPos][xPos] & 0xff) + (item << 8); - _vm->_map->itemsMap[yPos - 1][xPos] = - (_vm->_map->itemsMap[yPos - + _vm->_map->_itemsMap[yPos - 1][xPos] = + (_vm->_map->_itemsMap[yPos - 1][xPos] & 0xff) + (item << 8); - _vm->_map->itemsMap[yPos][xPos + 1] = - (_vm->_map->itemsMap[yPos][xPos + + _vm->_map->_itemsMap[yPos][xPos + 1] = + (_vm->_map->_itemsMap[yPos][xPos + 1] & 0xff) + (item << 8); - _vm->_map->itemsMap[yPos - 1][xPos + 1] = - (_vm->_map->itemsMap[yPos - 1][xPos + + _vm->_map->_itemsMap[yPos - 1][xPos + 1] = + (_vm->_map->_itemsMap[yPos - 1][xPos + 1] & 0xff) + (item << 8); } } else { - if ((_vm->_map->itemsMap[yPos][xPos] & 0xff00) != 0 || - (_vm->_map->itemsMap[yPos][xPos + 1] & 0xff00) != + if ((_vm->_map->_itemsMap[yPos][xPos] & 0xff00) != 0 || + (_vm->_map->_itemsMap[yPos][xPos + 1] & 0xff00) != 0) { - _vm->_map->itemsMap[yPos][xPos] = - (_vm->_map->itemsMap[yPos][xPos] & 0xff00) + _vm->_map->_itemsMap[yPos][xPos] = + (_vm->_map->_itemsMap[yPos][xPos] & 0xff00) + item; - _vm->_map->itemsMap[yPos][xPos + 1] = - (_vm->_map->itemsMap[yPos][xPos + + _vm->_map->_itemsMap[yPos][xPos + 1] = + (_vm->_map->_itemsMap[yPos][xPos + 1] & 0xff00) + item; } else { - _vm->_map->itemsMap[yPos][xPos] = - (_vm->_map->itemsMap[yPos][xPos] & 0xff) + + _vm->_map->_itemsMap[yPos][xPos] = + (_vm->_map->_itemsMap[yPos][xPos] & 0xff) + (item << 8); - _vm->_map->itemsMap[yPos][xPos + 1] = - (_vm->_map->itemsMap[yPos][xPos + + _vm->_map->_itemsMap[yPos][xPos + 1] = + (_vm->_map->_itemsMap[yPos][xPos + 1] & 0xff) + (item << 8); } } } else { if (yPos > 0) { - if ((_vm->_map->itemsMap[yPos][xPos] & 0xff00) != 0 || - (_vm->_map->itemsMap[yPos - 1][xPos] & 0xff00) != + if ((_vm->_map->_itemsMap[yPos][xPos] & 0xff00) != 0 || + (_vm->_map->_itemsMap[yPos - 1][xPos] & 0xff00) != 0) { - _vm->_map->itemsMap[yPos][xPos] = - (_vm->_map->itemsMap[yPos][xPos] & 0xff00) + _vm->_map->_itemsMap[yPos][xPos] = + (_vm->_map->_itemsMap[yPos][xPos] & 0xff00) + item; - _vm->_map->itemsMap[yPos - 1][xPos] = - (_vm->_map->itemsMap[yPos - + _vm->_map->_itemsMap[yPos - 1][xPos] = + (_vm->_map->_itemsMap[yPos - 1][xPos] & 0xff00) + item; } else { - _vm->_map->itemsMap[yPos][xPos] = - (_vm->_map->itemsMap[yPos][xPos] & 0xff) + + _vm->_map->_itemsMap[yPos][xPos] = + (_vm->_map->_itemsMap[yPos][xPos] & 0xff) + (item << 8); - _vm->_map->itemsMap[yPos - 1][xPos] = - (_vm->_map->itemsMap[yPos - + _vm->_map->_itemsMap[yPos - 1][xPos] = + (_vm->_map->_itemsMap[yPos - 1][xPos] & 0xff) + (item << 8); } } else { - if ((_vm->_map->itemsMap[yPos][xPos] & 0xff00) != 0) { - _vm->_map->itemsMap[yPos][xPos] = - (_vm->_map->itemsMap[yPos][xPos] & 0xff00) + if ((_vm->_map->_itemsMap[yPos][xPos] & 0xff00) != 0) { + _vm->_map->_itemsMap[yPos][xPos] = + (_vm->_map->_itemsMap[yPos][xPos] & 0xff00) + item; } else { - _vm->_map->itemsMap[yPos][xPos] = - (_vm->_map->itemsMap[yPos][xPos] & 0xff) + + _vm->_map->_itemsMap[yPos][xPos] = + (_vm->_map->_itemsMap[yPos][xPos] & 0xff) + (item << 8); } } @@ -2717,31 +2717,31 @@ void Goblin::interFunc(void) { if (item < 0 || item >= 20) break; - if (xPos > 1 && _vm->_map->passMap[yPos][xPos - 2] == 1) { - _vm->_map->itemPoses[item].x = xPos - 2; - _vm->_map->itemPoses[item].y = yPos; - _vm->_map->itemPoses[item].orient = 4; + if (xPos > 1 && _vm->_map->_passMap[yPos][xPos - 2] == 1) { + _vm->_map->_itemPoses[item].x = xPos - 2; + _vm->_map->_itemPoses[item].y = yPos; + _vm->_map->_itemPoses[item].orient = 4; break; } - if (xPos < Map::kMapWidth - 2 && _vm->_map->passMap[yPos][xPos + 2] == 1) { - _vm->_map->itemPoses[item].x = xPos + 2; - _vm->_map->itemPoses[item].y = yPos; - _vm->_map->itemPoses[item].orient = 0; + if (xPos < Map::kMapWidth - 2 && _vm->_map->_passMap[yPos][xPos + 2] == 1) { + _vm->_map->_itemPoses[item].x = xPos + 2; + _vm->_map->_itemPoses[item].y = yPos; + _vm->_map->_itemPoses[item].orient = 0; break; } - if (xPos < Map::kMapWidth - 1 && _vm->_map->passMap[yPos][xPos + 1] == 1) { - _vm->_map->itemPoses[item].x = xPos + 1; - _vm->_map->itemPoses[item].y = yPos; - _vm->_map->itemPoses[item].orient = 0; + if (xPos < Map::kMapWidth - 1 && _vm->_map->_passMap[yPos][xPos + 1] == 1) { + _vm->_map->_itemPoses[item].x = xPos + 1; + _vm->_map->_itemPoses[item].y = yPos; + _vm->_map->_itemPoses[item].orient = 0; break; } - if (xPos > 0 && _vm->_map->passMap[yPos][xPos - 1] == 1) { - _vm->_map->itemPoses[item].x = xPos - 1; - _vm->_map->itemPoses[item].y = yPos; - _vm->_map->itemPoses[item].orient = 4; + if (xPos > 0 && _vm->_map->_passMap[yPos][xPos - 1] == 1) { + _vm->_map->_itemPoses[item].x = xPos - 1; + _vm->_map->_itemPoses[item].y = yPos; + _vm->_map->_itemPoses[item].orient = 4; break; } break; @@ -2756,10 +2756,10 @@ void Goblin::interFunc(void) { yPos = VAR(yPos); } - if ((_vm->_map->itemsMap[yPos][xPos] & 0xff00) != 0) { - *retVarPtr = (_vm->_map->itemsMap[yPos][xPos] & 0xff00) >> 8; + if ((_vm->_map->_itemsMap[yPos][xPos] & 0xff00) != 0) { + *retVarPtr = (_vm->_map->_itemsMap[yPos][xPos] & 0xff00) >> 8; } else { - *retVarPtr = _vm->_map->itemsMap[yPos][xPos]; + *retVarPtr = _vm->_map->_itemsMap[yPos][xPos]; } break; @@ -2767,7 +2767,7 @@ void Goblin::interFunc(void) { xPos = _vm->_inter->load16(); yPos = _vm->_inter->load16(); val = _vm->_inter->load16(); - _vm->_map->passMap[yPos][xPos] = val; + _vm->_map->_passMap[yPos][xPos] = val; break; case 50: @@ -2866,11 +2866,11 @@ void Goblin::interFunc(void) { gobPositions[item].x = xPos; pressedMapX = xPos; - _vm->_map->curGoblinX = xPos; + _vm->_map->_curGoblinX = xPos; gobPositions[item].y = yPos; pressedMapY = yPos; - _vm->_map->curGoblinY = yPos; + _vm->_map->_curGoblinY = yPos; *curGobScrXVarPtr = objDesc->xPos; *curGobScrYVarPtr = objDesc->yPos; @@ -2997,9 +2997,9 @@ void Goblin::interFunc(void) { yPos = _vm->_inter->load16(); val = _vm->_inter->load16(); - _vm->_map->itemPoses[item].x = xPos; - _vm->_map->itemPoses[item].y = yPos; - _vm->_map->itemPoses[item].orient = val; + _vm->_map->_itemPoses[item].x = xPos; + _vm->_map->_itemPoses[item].y = yPos; + _vm->_map->_itemPoses[item].orient = val; break; case 500: @@ -3067,9 +3067,9 @@ void Goblin::interFunc(void) { yPos = _vm->_inter->load16(); val = _vm->_inter->load16(); - _vm->_map->itemPoses[item].x = xPos; - _vm->_map->itemPoses[item].y = yPos; - _vm->_map->itemPoses[item].orient = val; + _vm->_map->_itemPoses[item].x = xPos; + _vm->_map->_itemPoses[item].y = yPos; + _vm->_map->_itemPoses[item].orient = val; break; case 1000: @@ -3174,11 +3174,11 @@ void Goblin::interFunc(void) { gobDesc->toRedraw = 1; pressedMapX = gobPositions[0].x; - _vm->_map->destX = gobPositions[0].x; + _vm->_map->_destX = gobPositions[0].x; gobDestX = gobPositions[0].x; pressedMapY = gobPositions[0].y; - _vm->_map->destY = gobPositions[0].y; + _vm->_map->_destY = gobPositions[0].y; gobDestY = gobPositions[0].y; *curGobVarPtr = 0; diff --git a/gob/inter.cpp b/gob/inter.cpp index 50c063cff2..292e94efe1 100644 --- a/gob/inter.cpp +++ b/gob/inter.cpp @@ -34,15 +34,15 @@ namespace Gob { Inter::Inter(GobEngine *vm) : _vm(vm) { - terminate = 0; - breakFlag = 0; - animPalLowIndex = 0; - animPalHighIndex = 0; - animPalDir = 0; - soundEndTimeKey = 0; - soundStopVal = 0; - breakFromLevel = 0; - nestLevel = 0; + _terminate = false; + _breakFlag = false; + _animPalLowIndex = 0; + _animPalHighIndex = 0; + _animPalDir = 0; + _soundEndTimeKey = 0; + _soundStopVal = 0; + _breakFromLevel = 0; + _nestLevel = 0; } int16 Inter::load16(void) { @@ -197,24 +197,24 @@ void Inter::animPalette(void) { int16 i; Video::Color col; - if (animPalDir == 0) + if (_animPalDir == 0) return; _vm->_video->waitRetrace(_vm->_global->videoMode); - if (animPalDir == -1) { - col = _vm->_draw->vgaSmallPalette[animPalLowIndex]; + if (_animPalDir == -1) { + col = _vm->_draw->vgaSmallPalette[_animPalLowIndex]; - for (i = animPalLowIndex; i < animPalHighIndex; i++) + for (i = _animPalLowIndex; i < _animPalHighIndex; i++) _vm->_draw->vgaSmallPalette[i] = _vm->_draw->vgaSmallPalette[i + 1]; - _vm->_draw->vgaSmallPalette[animPalHighIndex] = col; + _vm->_draw->vgaSmallPalette[_animPalHighIndex] = col; } else { - col = _vm->_draw->vgaSmallPalette[animPalHighIndex]; - for (i = animPalHighIndex; i > animPalLowIndex; i--) + col = _vm->_draw->vgaSmallPalette[_animPalHighIndex]; + for (i = _animPalHighIndex; i > _animPalLowIndex; i--) _vm->_draw->vgaSmallPalette[i] = _vm->_draw->vgaSmallPalette[i - 1]; - _vm->_draw->vgaSmallPalette[animPalLowIndex] = col; + _vm->_draw->vgaSmallPalette[_animPalLowIndex] = col; } _vm->_global->pPaletteDesc->vgaPal = _vm->_draw->vgaSmallPalette; @@ -222,9 +222,9 @@ void Inter::animPalette(void) { } void Inter::animPalInit(void) { - animPalDir = load16(); - animPalLowIndex = _vm->_parse->parseValExpr(); - animPalHighIndex = _vm->_parse->parseValExpr(); + _animPalDir = load16(); + _animPalLowIndex = _vm->_parse->parseValExpr(); + _animPalHighIndex = _vm->_parse->parseValExpr(); } void Inter::loadMult(void) { @@ -920,7 +920,7 @@ void Inter::playComposition(void) { void Inter::stopSound(void) { _vm->_snd->stopSound(_vm->_parse->parseValExpr()); - soundEndTimeKey = 0; + _soundEndTimeKey = 0; } void Inter::playSound(void) { @@ -934,7 +934,7 @@ void Inter::playSound(void) { frequency = _vm->_parse->parseValExpr(); _vm->_snd->stopSound(0); - soundEndTimeKey = 0; + _soundEndTimeKey = 0; if (_vm->_game->soundSamples[index] == 0) return; @@ -943,16 +943,16 @@ void Inter::playSound(void) { return; repCount = -repCount; - soundEndTimeKey = _vm->_util->getTimeKey(); + _soundEndTimeKey = _vm->_util->getTimeKey(); if (frequency == 0) { freq2 = _vm->_game->soundSamples[index]->frequency; } else { freq2 = frequency; } - soundStopVal = + _soundStopVal = (10 * (_vm->_game->soundSamples[index]->size / 2)) / freq2; - soundEndTimeKey += + _soundEndTimeKey += ((_vm->_game->soundSamples[index]->size * repCount - _vm->_game->soundSamples[index]->size / 2) * 1000) / freq2; } @@ -1029,7 +1029,7 @@ void Inter::loadTot(void) { } strcat(buf, ".tot"); - terminate = 1; + _terminate = true; strcpy(_vm->_game->totToLoad, buf); } @@ -1166,7 +1166,7 @@ void Inter::checkSwitchTable(char **ppExec) { for (i = 0; i < len; i++) { evalExpr(0); - if (terminate != 0) + if (_terminate) return; if (_vm->_global->inter_resVal == value) { @@ -1203,7 +1203,7 @@ void Inter::repeatUntil(void) { char flag; debug(4, "repeatUntil"); - nestLevel[0]++; + _nestLevel[0]++; blockPtr = _vm->_global->inter_execPtr; do { @@ -1213,13 +1213,13 @@ void Inter::repeatUntil(void) { funcBlock(1); _vm->_global->inter_execPtr = blockPtr + size + 1; flag = evalBoolResult(); - } while (flag == 0 && breakFlag == 0 && terminate == 0); + } while (flag == 0 && !_breakFlag && !_terminate); - nestLevel[0]--; + _nestLevel[0]--; - if (*breakFromLevel > -1) { - breakFlag = 0; - *breakFromLevel = -1; + if (*_breakFromLevel > -1) { + _breakFlag = false; + *_breakFromLevel = -1; } } @@ -1230,12 +1230,12 @@ void Inter::whileDo(void) { int16 size; debug(4, "whileDo"); - nestLevel[0]++; + _nestLevel[0]++; do { savedIP = _vm->_global->inter_execPtr; flag = evalBoolResult(); - if (terminate != 0) + if (_terminate) return; blockPtr = _vm->_global->inter_execPtr; @@ -1249,17 +1249,17 @@ void Inter::whileDo(void) { _vm->_global->inter_execPtr += size; } - if (breakFlag != 0 || terminate != 0) { + if (_breakFlag || _terminate) { _vm->_global->inter_execPtr = blockPtr; _vm->_global->inter_execPtr += size; break; } } while (flag != 0); - nestLevel[0]--; - if (*breakFromLevel > -1) { - breakFlag = 0; - *breakFromLevel = -1; + _nestLevel[0]--; + if (*_breakFromLevel > -1) { + _breakFlag = false; + *_breakFromLevel = -1; } } @@ -1275,7 +1275,7 @@ void Inter::funcBlock(int16 retFlag) { if (_vm->_global->inter_execPtr == 0) return; - breakFlag = 0; + _breakFlag = false; _vm->_global->inter_execPtr++; cmdCount = *_vm->_global->inter_execPtr++; _vm->_global->inter_execPtr += 2; @@ -1287,7 +1287,7 @@ void Inter::funcBlock(int16 retFlag) { counter = 0; do { - if (terminate != 0) + if (_terminate) break; cmd = (byte)*_vm->_global->inter_execPtr; @@ -1440,7 +1440,7 @@ void Inter::funcBlock(int16 retFlag) { switch (cmd) { case 0: if (retFlag != 2) - breakFlag = 1; + _breakFlag = true; _vm->_global->inter_execPtr = 0; return; @@ -1479,16 +1479,16 @@ void Inter::funcBlock(int16 retFlag) { switch (cmd) { case 0: if (retFlag == 1) { - breakFlag = 1; + _breakFlag = true; _vm->_global->inter_execPtr = 0; return; } - if (*nestLevel == 0) + if (*_nestLevel == 0) break; - *breakFromLevel = *nestLevel; - breakFlag = 1; + *_breakFromLevel = *_nestLevel; + _breakFlag = true; _vm->_global->inter_execPtr = 0; return; @@ -1626,12 +1626,12 @@ void Inter::funcBlock(int16 retFlag) { } - if (breakFlag != 0) { + if (_breakFlag) { if (retFlag != 2) break; - if (*breakFromLevel == -1) - breakFlag = 0; + if (*_breakFromLevel == -1) + _breakFlag = false; break; } } while (counter != cmdCount); @@ -1641,15 +1641,15 @@ void Inter::funcBlock(int16 retFlag) { } void Inter::initControlVars(void) { - *nestLevel = 0; - *breakFromLevel = -1; + *_nestLevel = 0; + *_breakFromLevel = -1; *_vm->_scenery->pCaptureCounter = 0; - breakFlag = 0; - terminate = 0; - animPalDir = 0; - soundEndTimeKey = 0; + _breakFlag = false; + _terminate = false; + _animPalDir = 0; + _soundEndTimeKey = 0; } void Inter::callSub(int16 retFlag) { @@ -1664,7 +1664,7 @@ void Inter::callSub(int16 retFlag) { } if ((char *)_vm->_global->inter_execPtr == _vm->_game->totFileData) - terminate = 1; + _terminate = true; } } // End of namespace Gob diff --git a/gob/inter.h b/gob/inter.h index f74c6a81f6..fc725a7109 100644 --- a/gob/inter.h +++ b/gob/inter.h @@ -26,15 +26,15 @@ namespace Gob { class Inter { public: - int16 animPalLowIndex; - int16 animPalHighIndex; - int16 animPalDir; - uint32 soundEndTimeKey; - int16 soundStopVal; - char terminate; - char breakFlag; - int16 *breakFromLevel; - int16 *nestLevel; + int16 _animPalLowIndex; + int16 _animPalHighIndex; + int16 _animPalDir; + uint32 _soundEndTimeKey; + int16 _soundStopVal; + char _terminate; + char _breakFlag; + int16 *_breakFromLevel; + int16 *_nestLevel; int16 load16(void); int16 peek16(char *ptr); diff --git a/gob/map.cpp b/gob/map.cpp index 85983a72de..4e5c7d823c 100644 --- a/gob/map.cpp +++ b/gob/map.cpp @@ -34,35 +34,35 @@ namespace Gob { Map::Map(GobEngine *vm) : _vm(vm) { for (int i = 0; i < kMapHeight; i++) for (int j = 0; j < kMapWidth; j++) { - passMap[i][j] = 0; - itemsMap[i][j] = 0; + _passMap[i][j] = 0; + _itemsMap[i][j] = 0; } for (int i = 0; i < 40; i++) { - wayPoints[i].x = 0; - wayPoints[i].y = 0; + _wayPoints[i].x = 0; + _wayPoints[i].y = 0; } for (int i = 0; i < 40; i++) { - itemPoses[i].x = 0; - itemPoses[i].y = 0; - itemPoses[i].orient = 0; + _itemPoses[i].x = 0; + _itemPoses[i].y = 0; + _itemPoses[i].orient = 0; } - nearestWayPoint = 0; - nearestDest = 0; - curGoblinX = 0; - curGoblinY = 0; - destX = 0; - destY = 0; - loadFromAvo = 0; - sourceFile[0] = 0; - avoDataPtr = 0; + _nearestWayPoint = 0; + _nearestDest = 0; + _curGoblinX = 0; + _curGoblinY = 0; + _destX = 0; + _destY = 0; + _loadFromAvo = 0; + _sourceFile[0] = 0; + _avoDataPtr = 0; } void Map::placeItem(int16 x, int16 y, int16 id) { - if ((itemsMap[y][x] & 0xff00) != 0) - itemsMap[y][x] = (itemsMap[y][x] & 0xff00) | id; + if ((_itemsMap[y][x] & 0xff00) != 0) + _itemsMap[y][x] = (_itemsMap[y][x] & 0xff00) | id; else - itemsMap[y][x] = (itemsMap[y][x] & 0x00ff) | (id << 8); + _itemsMap[y][x] = (_itemsMap[y][x] & 0x00ff) | (id << 8); } enum { @@ -91,63 +91,63 @@ int16 Map::getDirection(int16 x0, int16 y0, int16 x1, int16 y1) { else if (x1 < x0) dir |= kLeft; - if (passMap[y0][x0] == 3 && (dir & kUp)) { - if (passMap[y0 - 1][x0] != 0) + if (_passMap[y0][x0] == 3 && (dir & kUp)) { + if (_passMap[y0 - 1][x0] != 0) return kDirN; } - if (passMap[y0][x0] == 3 && (dir & kDown)) { - if (passMap[y0 + 1][x0] != 0) + if (_passMap[y0][x0] == 3 && (dir & kDown)) { + if (_passMap[y0 + 1][x0] != 0) return kDirS; } - if (passMap[y0][x0] == 6 && (dir & kUp)) { - if (passMap[y0 - 1][x0] != 0) + if (_passMap[y0][x0] == 6 && (dir & kUp)) { + if (_passMap[y0 - 1][x0] != 0) return kDirN; } - if (passMap[y0][x0] == 6 && (dir & kDown)) { - if (passMap[y0 + 1][x0] != 0) + if (_passMap[y0][x0] == 6 && (dir & kDown)) { + if (_passMap[y0 + 1][x0] != 0) return kDirS; } if (dir == kLeft) { - if (x0 - 1 >= 0 && passMap[y0][x0 - 1] != 0) + if (x0 - 1 >= 0 && _passMap[y0][x0 - 1] != 0) return kDirW; return 0; } if (dir == kRight) { - if (x0 + 1 < kMapWidth && passMap[y0][x0 + 1] != 0) + if (x0 + 1 < kMapWidth && _passMap[y0][x0 + 1] != 0) return kDirE; return 0; } if (dir == kUp) { - if (y0 - 1 >= 0 && passMap[y0 - 1][x0] != 0) + if (y0 - 1 >= 0 && _passMap[y0 - 1][x0] != 0) return kDirN; if (y0 - 1 >= 0 && x0 - 1 >= 0 - && passMap[y0 - 1][x0 - 1] != 0) + && _passMap[y0 - 1][x0 - 1] != 0) return kDirNW; if (y0 - 1 >= 0 && x0 + 1 < kMapWidth - && passMap[y0 - 1][x0 + 1] != 0) + && _passMap[y0 - 1][x0 + 1] != 0) return kDirNE; return 0; } if (dir == kDown) { - if (y0 + 1 < kMapHeight && passMap[y0 + 1][x0] != 0) + if (y0 + 1 < kMapHeight && _passMap[y0 + 1][x0] != 0) return kDirS; if (y0 + 1 < kMapHeight && x0 - 1 >= 0 - && passMap[y0 + 1][x0 - 1] != 0) + && _passMap[y0 + 1][x0 - 1] != 0) return kDirSW; if (y0 + 1 < kMapHeight && x0 + 1 < kMapWidth - && passMap[y0 + 1][x0 + 1] != 0) + && _passMap[y0 + 1][x0 + 1] != 0) return kDirSE; return 0; @@ -155,13 +155,13 @@ int16 Map::getDirection(int16 x0, int16 y0, int16 x1, int16 y1) { if (dir == (kRight | kUp)) { if (y0 - 1 >= 0 && x0 + 1 < kMapWidth - && passMap[y0 - 1][x0 + 1] != 0) + && _passMap[y0 - 1][x0 + 1] != 0) return kDirNE; - if (y0 - 1 >= 0 && passMap[y0 - 1][x0] != 0) + if (y0 - 1 >= 0 && _passMap[y0 - 1][x0] != 0) return kDirN; - if (x0 + 1 < kMapWidth && passMap[y0][x0 + 1] != 0) + if (x0 + 1 < kMapWidth && _passMap[y0][x0 + 1] != 0) return kDirE; return 0; @@ -169,13 +169,13 @@ int16 Map::getDirection(int16 x0, int16 y0, int16 x1, int16 y1) { if (dir == (kRight | kDown)) { if (x0 + 1 < kMapWidth && y0 + 1 < kMapHeight - && passMap[y0 + 1][x0 + 1] != 0) + && _passMap[y0 + 1][x0 + 1] != 0) return kDirSE; - if (y0 + 1 < kMapHeight && passMap[y0 + 1][x0] != 0) + if (y0 + 1 < kMapHeight && _passMap[y0 + 1][x0] != 0) return kDirS; - if (x0 + 1 < kMapWidth && passMap[y0][x0 + 1] != 0) + if (x0 + 1 < kMapWidth && _passMap[y0][x0 + 1] != 0) return kDirE; return 0; @@ -183,13 +183,13 @@ int16 Map::getDirection(int16 x0, int16 y0, int16 x1, int16 y1) { if (dir == (kLeft | kUp)) { if (x0 - 1 >= 0 && y0 - 1 >= 0 - && passMap[y0 - 1][x0 - 1] != 0) + && _passMap[y0 - 1][x0 - 1] != 0) return kDirNW; - if (y0 - 1 >= 0 && passMap[y0 - 1][x0] != 0) + if (y0 - 1 >= 0 && _passMap[y0 - 1][x0] != 0) return kDirN; - if (x0 - 1 >= 0 && passMap[y0][x0 - 1] != 0) + if (x0 - 1 >= 0 && _passMap[y0][x0 - 1] != 0) return kDirW; return 0; @@ -197,13 +197,13 @@ int16 Map::getDirection(int16 x0, int16 y0, int16 x1, int16 y1) { if (dir == (kLeft | kDown)) { if (x0 - 1 >= 0 && y0 + 1 < kMapHeight - && passMap[y0 + 1][x0 - 1] != 0) + && _passMap[y0 + 1][x0 - 1] != 0) return kDirSW; - if (y0 + 1 < kMapHeight && passMap[y0 + 1][x0] != 0) + if (y0 + 1 < kMapHeight && _passMap[y0 + 1][x0] != 0) return kDirS; - if (x0 - 1 >= 0 && passMap[y0][x0 - 1] != 0) + if (x0 - 1 >= 0 && _passMap[y0][x0 - 1] != 0) return kDirW; return 0; @@ -220,12 +220,12 @@ int16 Map::findNearestWayPoint(int16 x, int16 y) { length = 30000; for (i = 0; i < 40; i++) { - if (wayPoints[i].x < 0 || - wayPoints[i].x >= kMapWidth || - wayPoints[i].y < 0 || wayPoints[i].y >= kMapHeight) + if (_wayPoints[i].x < 0 || + _wayPoints[i].x >= kMapWidth || + _wayPoints[i].y < 0 || _wayPoints[i].y >= kMapHeight) return -1; - tmp = ABS(x - wayPoints[i].x) + ABS(y - wayPoints[i].y); + tmp = ABS(x - _wayPoints[i].x) + ABS(y - _wayPoints[i].y); if (tmp <= length) { lnearestWayPoint = i; @@ -237,17 +237,17 @@ int16 Map::findNearestWayPoint(int16 x, int16 y) { } void Map::findNearestToGob(void) { - int16 wayPoint = findNearestWayPoint(curGoblinX, curGoblinY); + int16 wayPoint = findNearestWayPoint(_curGoblinX, _curGoblinY); if (wayPoint != -1) - nearestWayPoint = wayPoint; + _nearestWayPoint = wayPoint; } void Map::findNearestToDest(void) { - int16 wayPoint = findNearestWayPoint(destX, destY); + int16 wayPoint = findNearestWayPoint(_destX, _destY); if (wayPoint != -1) - nearestDest = wayPoint; + _nearestDest = wayPoint; } int16 Map::checkDirectPath(int16 x0, int16 y0, int16 x1, int16 y1) { @@ -324,20 +324,20 @@ int16 Map::checkLongPath(int16 x0, int16 y0, int16 x1, int16 y1, int16 i0, int16 nextLink = 0; if (i0 > i1) { - curX = wayPoints[i0].x; - curY = wayPoints[i0].y; + curX = _wayPoints[i0].x; + curY = _wayPoints[i0].y; i0--; } else if (i0 < i1) { - curX = wayPoints[i0].x; - curY = wayPoints[i0].y; + curX = _wayPoints[i0].x; + curY = _wayPoints[i0].y; i0++; } else if (i0 == i1) { - curX = wayPoints[i0].x; - curY = wayPoints[i0].y; + curX = _wayPoints[i0].x; + curY = _wayPoints[i0].y; } } - if (i0 == i1 && wayPoints[i0].x == x0 - && wayPoints[i0].y == y0) { + if (i0 == i1 && _wayPoints[i0].x == x0 + && _wayPoints[i0].y == y0) { if (checkDirectPath(x0, y0, x1, y1) == 1) return 1; return 0; @@ -389,29 +389,29 @@ int16 Map::checkLongPath(int16 x0, int16 y0, int16 x1, int16 y1, int16 i0, int16 void Map::optimizePoints(void) { int16 i; - if (nearestWayPoint < nearestDest) { - for (i = nearestWayPoint; i <= nearestDest; i++) { - if (checkDirectPath(curGoblinX, curGoblinY, - wayPoints[i].x, wayPoints[i].y) == 1) - nearestWayPoint = i; + if (_nearestWayPoint < _nearestDest) { + for (i = _nearestWayPoint; i <= _nearestDest; i++) { + if (checkDirectPath(_curGoblinX, _curGoblinY, + _wayPoints[i].x, _wayPoints[i].y) == 1) + _nearestWayPoint = i; } - } else if (nearestWayPoint > nearestDest) { - for (i = nearestWayPoint; i >= nearestDest; i--) { - if (checkDirectPath(curGoblinX, curGoblinY, - wayPoints[i].x, wayPoints[i].y) == 1) - nearestWayPoint = i; + } else if (_nearestWayPoint > _nearestDest) { + for (i = _nearestWayPoint; i >= _nearestDest; i--) { + if (checkDirectPath(_curGoblinX, _curGoblinY, + _wayPoints[i].x, _wayPoints[i].y) == 1) + _nearestWayPoint = i; } } } void Map::loadDataFromAvo(char *dest, int16 size) { - memcpy(dest, avoDataPtr, size); - avoDataPtr += size; + memcpy(dest, _avoDataPtr, size); + _avoDataPtr += size; } uint16 Map::loadFromAvo_LE_UINT16() { - uint16 tmp = READ_LE_UINT16(avoDataPtr); - avoDataPtr += 2; + uint16 tmp = READ_LE_UINT16(_avoDataPtr); + _avoDataPtr += 2; return tmp; } @@ -424,12 +424,12 @@ void Map::loadItemToObject(void) { if (flag == 0) return; - avoDataPtr += 1456; + _avoDataPtr += 1456; count = loadFromAvo_LE_UINT16(); for (i = 0; i < count; i++) { - avoDataPtr += 20; + _avoDataPtr += 20; _vm->_goblin->itemToObject[i] = loadFromAvo_LE_UINT16(); - avoDataPtr += 5; + _avoDataPtr += 5; } } @@ -455,60 +455,60 @@ void Map::loadMapObjects(char *avjFile) { int16 count2; int16 count3; - strcpy(avoName, sourceFile); + strcpy(avoName, _sourceFile); strcat(avoName, ".avo"); handle = _vm->_dataio->openData(avoName); if (handle >= 0) { - loadFromAvo = 1; + _loadFromAvo = 1; _vm->_dataio->closeData(handle); - avoDataPtr = _vm->_dataio->getData(avoName); - dataBuf = avoDataPtr; - loadDataFromAvo((char *)passMap, kMapHeight * kMapWidth); + _avoDataPtr = _vm->_dataio->getData(avoName); + dataBuf = _avoDataPtr; + loadDataFromAvo((char *)_passMap, kMapHeight * kMapWidth); for (y = 0; y < kMapHeight; y++) { for (x = 0; x < kMapWidth; x++) { loadDataFromAvo(&item, 1); - itemsMap[y][x] = item; + _itemsMap[y][x] = item; } } for (i = 0; i < 40; i++) { - wayPoints[i].x = loadFromAvo_LE_UINT16(); - wayPoints[i].y = loadFromAvo_LE_UINT16(); + _wayPoints[i].x = loadFromAvo_LE_UINT16(); + _wayPoints[i].y = loadFromAvo_LE_UINT16(); } - loadDataFromAvo((char *)itemPoses, szMap_ItemPos * 20); + loadDataFromAvo((char *)_itemPoses, szMap_ItemPos * 20); } else { - loadFromAvo = 0; - avoDataPtr = _vm->_dataio->getData(avjFile); - dataBuf = avoDataPtr; + _loadFromAvo = 0; + _avoDataPtr = _vm->_dataio->getData(avjFile); + dataBuf = _avoDataPtr; } - avoDataPtr += 32; - avoDataPtr += 76; - avoDataPtr += 4; - avoDataPtr += 20; + _avoDataPtr += 32; + _avoDataPtr += 76; + _avoDataPtr += 4; + _avoDataPtr += 20; for (i = 0; i < 3; i++) { tmp = loadFromAvo_LE_UINT16(); - avoDataPtr += tmp * 14; + _avoDataPtr += tmp * 14; } soundCount = loadFromAvo_LE_UINT16(); - savedPtr = avoDataPtr; + savedPtr = _avoDataPtr; - avoDataPtr += 14 * soundCount; - avoDataPtr += 4; - avoDataPtr += 24; + _avoDataPtr += 14 * soundCount; + _avoDataPtr += 4; + _avoDataPtr += 24; count2 = loadFromAvo_LE_UINT16(); count3 = loadFromAvo_LE_UINT16(); - savedPtr2 = avoDataPtr; - avoDataPtr += count2 * 8; + savedPtr2 = _avoDataPtr; + _avoDataPtr += count2 * 8; - savedPtr3 = avoDataPtr; - avoDataPtr += count3 * 8; + savedPtr3 = _avoDataPtr; + _avoDataPtr += count3 * 8; _vm->_goblin->gobsCount = loadFromAvo_LE_UINT16(); for (i = 0; i < _vm->_goblin->gobsCount; i++) { @@ -533,9 +533,9 @@ void Map::loadMapObjects(char *avjFile) { // FIXME: All is wrong further. We should unwind calls to loadDataFromAvo() loadDataFromAvo((char *)_vm->_goblin->goblins[i]->stateMach, 40 * szGob_StateLine); - avoDataPtr += 160; - _vm->_goblin->goblins[i]->multObjIndex = *avoDataPtr; - avoDataPtr += 2; + _avoDataPtr += 160; + _vm->_goblin->goblins[i]->multObjIndex = *_avoDataPtr; + _avoDataPtr += 2; _vm->_goblin->goblins[i]->realStateMach = _vm->_goblin->goblins[i]->stateMach; for (state = 0; state < 40; state++) { @@ -548,16 +548,16 @@ void Map::loadMapObjects(char *avjFile) { tmpState->animation = loadFromAvo_LE_UINT16(); tmpState->layer = loadFromAvo_LE_UINT16(); - avoDataPtr += 8; + _avoDataPtr += 8; tmpState->unk0 = loadFromAvo_LE_UINT16(); tmpState->unk1 = loadFromAvo_LE_UINT16(); - avoDataPtr += 2; - if (READ_LE_UINT32(avoDataPtr) != 0) { - avoDataPtr += 4; + _avoDataPtr += 2; + if (READ_LE_UINT32(_avoDataPtr) != 0) { + _avoDataPtr += 4; tmpState->sndItem = loadFromAvo_LE_UINT16(); } else { - avoDataPtr += 6; + _avoDataPtr += 6; tmpState->sndItem = -1; } tmpState->freq = loadFromAvo_LE_UINT16(); @@ -630,9 +630,9 @@ void Map::loadMapObjects(char *avjFile) { _vm->_goblin->objects[i]->stateMach = (Goblin::Gob_StateLine *)malloc(szGob_StateLine * 40); loadDataFromAvo((char *)_vm->_goblin->objects[i]->stateMach, 40 * szGob_StateLine); - avoDataPtr += 160; - _vm->_goblin->objects[i]->multObjIndex = *avoDataPtr; - avoDataPtr += 2; + _avoDataPtr += 160; + _vm->_goblin->objects[i]->multObjIndex = *_avoDataPtr; + _avoDataPtr += 2; _vm->_goblin->objects[i]->realStateMach = _vm->_goblin->objects[i]->stateMach; for (state = 0; state < 40; state++) { @@ -645,16 +645,16 @@ void Map::loadMapObjects(char *avjFile) { tmpState->animation = loadFromAvo_LE_UINT16(); tmpState->layer = loadFromAvo_LE_UINT16(); - avoDataPtr += 8; + _avoDataPtr += 8; tmpState->unk0 = loadFromAvo_LE_UINT16(); tmpState->unk1 = loadFromAvo_LE_UINT16(); - avoDataPtr += 2; - if (READ_LE_UINT32(avoDataPtr) != 0) { - avoDataPtr += 4; + _avoDataPtr += 2; + if (READ_LE_UINT32(_avoDataPtr) != 0) { + _avoDataPtr += 4; tmpState->sndItem = loadFromAvo_LE_UINT16(); } else { - avoDataPtr += 6; + _avoDataPtr += 6; tmpState->sndItem = -1; } tmpState->freq = loadFromAvo_LE_UINT16(); @@ -689,19 +689,19 @@ void Map::loadMapObjects(char *avjFile) { state = loadFromAvo_LE_UINT16(); for (i = 0; i < state; i++) { - avoDataPtr += 30; + _avoDataPtr += 30; loadDataFromAvo((char *)&flag, 4); - avoDataPtr += 56; + _avoDataPtr += 56; if (flag != 0) - avoDataPtr += 30; + _avoDataPtr += 30; } loadDataFromAvo((char *)&tmp, 2); - avoDataPtr += 48; + _avoDataPtr += 48; loadItemToObject(); - avoDataPtr = savedPtr; + _avoDataPtr = savedPtr; for (i = 0; i < soundCount; i++) { loadDataFromAvo(buf, 14); @@ -727,7 +727,7 @@ void Map::loadMapsInitGobs(void) { int16 layer; int16 i; - if (loadFromAvo == 0) + if (_loadFromAvo == 0) error("load: Loading .pas/.pos files is not supported!"); for (i = 0; i < 3; i++) { @@ -60,20 +60,20 @@ public: #pragma END_PACK_STRUCTS - int8 passMap[kMapHeight][kMapWidth]; // [y][x] - int16 itemsMap[kMapHeight][kMapWidth]; // [y][x] - Point wayPoints[40]; - int16 nearestWayPoint; - int16 nearestDest; + int8 _passMap[kMapHeight][kMapWidth]; // [y][x] + int16 _itemsMap[kMapHeight][kMapWidth]; // [y][x] + Point _wayPoints[40]; + int16 _nearestWayPoint; + int16 _nearestDest; - int16 curGoblinX; - int16 curGoblinY; - int16 destX; - int16 destY; - int8 loadFromAvo; + int16 _curGoblinX; + int16 _curGoblinY; + int16 _destX; + int16 _destY; + int8 _loadFromAvo; - ItemPos itemPoses[40]; - char sourceFile[15]; + ItemPos _itemPoses[40]; + char _sourceFile[15]; void placeItem(int16 x, int16 y, int16 id); @@ -91,7 +91,7 @@ public: Map(GobEngine *vm); protected: - char *avoDataPtr; + char *_avoDataPtr; GobEngine *_vm; int16 findNearestWayPoint(int16 x, int16 y); diff --git a/gob/palanim.cpp b/gob/palanim.cpp index 62b4897c2c..268d260b3b 100644 --- a/gob/palanim.cpp +++ b/gob/palanim.cpp @@ -28,19 +28,19 @@ namespace Gob { PalAnim::PalAnim(GobEngine *vm) : _vm(vm) { - fadeValue = 1; + _fadeValue = 1; for (int i = 0; i < 256; i++) { - toFadeRed[i] = 0; - toFadeGreen[i] = 0; - toFadeBlue[i] = 0; + _toFadeRed[i] = 0; + _toFadeGreen[i] = 0; + _toFadeBlue[i] = 0; } } char PalAnim::fadeColor(char from, char to) { - if ((int16)from - fadeValue > (int16)to) - return from - fadeValue; - else if ((int16)from + fadeValue < (int16)to) - return from + fadeValue; + if ((int16)from - _fadeValue > (int16)to) + return from - _fadeValue; + else if ((int16)from + _fadeValue < (int16)to) + return from + _fadeValue; else return to; } @@ -62,15 +62,9 @@ char PalAnim::fadeStep(int16 oper) { error("fade: _vm->_global->inVM != 0 not supported."); for (i = 0; i < 256; i++) { - newRed = - fadeColor(_vm->_global->redPalette[i], - toFadeRed[i]); - newGreen = - fadeColor(_vm->_global->greenPalette[i], - toFadeGreen[i]); - newBlue = - fadeColor(_vm->_global->bluePalette[i], - toFadeBlue[i]); + newRed = fadeColor(_vm->_global->redPalette[i], _toFadeRed[i]); + newGreen = fadeColor(_vm->_global->greenPalette[i], _toFadeGreen[i]); + newBlue = fadeColor(_vm->_global->bluePalette[i], _toFadeBlue[i]); if (_vm->_global->redPalette[i] != newRed || _vm->_global->greenPalette[i] != newGreen @@ -89,15 +83,15 @@ char PalAnim::fadeStep(int16 oper) { _vm->_video->setPalElem(i, fadeColor(_vm->_global->redPalette[i], - toFadeRed[i]), + _toFadeRed[i]), fadeColor(_vm->_global->greenPalette[i], - toFadeGreen[i]), + _toFadeGreen[i]), fadeColor(_vm->_global->bluePalette[i], - toFadeBlue[i]), -1, _vm->_global->videoMode); + _toFadeBlue[i]), -1, _vm->_global->videoMode); - if (_vm->_global->redPalette[i] != toFadeRed[i] || - _vm->_global->greenPalette[i] != toFadeGreen[i] || - _vm->_global->bluePalette[i] != toFadeBlue[i]) + if (_vm->_global->redPalette[i] != _toFadeRed[i] || + _vm->_global->greenPalette[i] != _toFadeGreen[i] || + _vm->_global->bluePalette[i] != _toFadeBlue[i]) stop = 0; } } @@ -106,10 +100,10 @@ char PalAnim::fadeStep(int16 oper) { stop = 1; for (i = 0; i < 16; i++) { _vm->_video->setPalElem(i, - fadeColor(_vm->_global->redPalette[i], toFadeRed[i]), + fadeColor(_vm->_global->redPalette[i], _toFadeRed[i]), _vm->_global->greenPalette[i], _vm->_global->bluePalette[i], -1, _vm->_global->videoMode); - if (_vm->_global->redPalette[i] != toFadeRed[i]) + if (_vm->_global->redPalette[i] != _toFadeRed[i]) stop = 0; } return stop; @@ -118,10 +112,10 @@ char PalAnim::fadeStep(int16 oper) { for (i = 0; i < 16; i++) { _vm->_video->setPalElem(i, _vm->_global->redPalette[i], - fadeColor(_vm->_global->greenPalette[i], toFadeGreen[i]), + fadeColor(_vm->_global->greenPalette[i], _toFadeGreen[i]), _vm->_global->bluePalette[i], -1, _vm->_global->videoMode); - if (_vm->_global->greenPalette[i] != toFadeGreen[i]) + if (_vm->_global->greenPalette[i] != _toFadeGreen[i]) stop = 0; } return stop; @@ -131,10 +125,10 @@ char PalAnim::fadeStep(int16 oper) { _vm->_video->setPalElem(i, _vm->_global->redPalette[i], _vm->_global->greenPalette[i], - fadeColor(_vm->_global->bluePalette[i], toFadeBlue[i]), + fadeColor(_vm->_global->bluePalette[i], _toFadeBlue[i]), -1, _vm->_global->videoMode); - if (_vm->_global->bluePalette[i] != toFadeBlue[i]) + if (_vm->_global->bluePalette[i] != _toFadeBlue[i]) stop = 0; } return stop; @@ -147,9 +141,9 @@ void PalAnim::fade(Video::PalDesc *palDesc, int16 fadeV, int16 allColors) { int16 i; if (fadeV < 0) - fadeValue = -fadeV; + _fadeValue = -fadeV; else - fadeValue = 2; + _fadeValue = 2; if (_vm->_global->colorCount < 256) { if (palDesc != 0) @@ -160,15 +154,15 @@ void PalAnim::fade(Video::PalDesc *palDesc, int16 fadeV, int16 allColors) { if (_vm->_global->setAllPalette == 0) { if (palDesc == 0) { for (i = 0; i < 16; i++) { - toFadeRed[i] = 0; - toFadeGreen[i] = 0; - toFadeBlue[i] = 0; + _toFadeRed[i] = 0; + _toFadeGreen[i] = 0; + _toFadeBlue[i] = 0; } } else { for (i = 0; i < 16; i++) { - toFadeRed[i] = palDesc->vgaPal[i].red; - toFadeGreen[i] = palDesc->vgaPal[i].green; - toFadeBlue[i] = palDesc->vgaPal[i].blue; + _toFadeRed[i] = palDesc->vgaPal[i].red; + _toFadeGreen[i] = palDesc->vgaPal[i].green; + _toFadeBlue[i] = palDesc->vgaPal[i].blue; } } } else { @@ -177,15 +171,15 @@ void PalAnim::fade(Video::PalDesc *palDesc, int16 fadeV, int16 allColors) { if (palDesc == 0) { for (i = 0; i < 256; i++) { - toFadeRed[i] = 0; - toFadeGreen[i] = 0; - toFadeBlue[i] = 0; + _toFadeRed[i] = 0; + _toFadeGreen[i] = 0; + _toFadeBlue[i] = 0; } } else { for (i = 0; i < 256; i++) { - toFadeRed[i] = palDesc->vgaPal[i].red; - toFadeGreen[i] = palDesc->vgaPal[i].green; - toFadeBlue[i] = palDesc->vgaPal[i].blue; + _toFadeRed[i] = palDesc->vgaPal[i].red; + _toFadeGreen[i] = palDesc->vgaPal[i].green; + _toFadeBlue[i] = palDesc->vgaPal[i].blue; } } } diff --git a/gob/palanim.h b/gob/palanim.h index 0f2cfcc3c4..02cd9508d9 100644 --- a/gob/palanim.h +++ b/gob/palanim.h @@ -26,8 +26,6 @@ namespace Gob { class PalAnim { public: - int16 fadeValue; - char fadeColor(char from, char to); char fadeStep(int16 oper); // oper == 0 - fade all colors, 1, 2, 3 - red,green, blue void fade(Video::PalDesc * palDesc, int16 fade, int16 all); @@ -35,9 +33,11 @@ public: PalAnim(GobEngine *vm); protected: - byte toFadeRed[256]; - byte toFadeGreen[256]; - byte toFadeBlue[256]; + int16 _fadeValue; + + byte _toFadeRed[256]; + byte _toFadeGreen[256]; + byte _toFadeBlue[256]; GobEngine *_vm; }; |