mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-29 14:42:26 +00:00
TUCKER: Add Location enum
This commit is contained in:
parent
8ba85bc7b0
commit
0749507a34
@ -217,7 +217,7 @@ void TuckerEngine::execData3PreUpdate_locationNum2Helper() {
|
||||
return;
|
||||
}
|
||||
int start, end;
|
||||
if (_locationNum == 2) {
|
||||
if (_location == kLocationBackAlley) {
|
||||
start = 116;
|
||||
end = 125;
|
||||
} else {
|
||||
@ -2050,8 +2050,8 @@ void TuckerEngine::execData3PreUpdate_locationNum41() {
|
||||
if (_panelLockedFlag && _yPosCurrent > 130 && _selectedObject._yPos > 135 && _nextAction == 0 && _flagsTable[223] == 0) {
|
||||
_panelLockedFlag = false;
|
||||
_csDataLoaded = false;
|
||||
_nextLocationNum = 0;
|
||||
_selectedObject._locationObjectLocationNum = 0;
|
||||
_nextLocation = kLocationNone;
|
||||
_selectedObject._locationObjectLocation = kLocationNone;
|
||||
_locationMaskType = 0;
|
||||
_nextAction = _flagsTable[163] + 32;
|
||||
++_flagsTable[163];
|
||||
@ -2482,7 +2482,7 @@ void TuckerEngine::updateSprite_locationNum58(int i) {
|
||||
|
||||
void TuckerEngine::execData3PreUpdate_locationNum58() {
|
||||
// workaround original game glitch #2872348: do not change position on location change
|
||||
if (_nextLocationNum == 0 && _flagsTable[190] < 3 && _xPosCurrent > 310) {
|
||||
if (_nextLocation == kLocationNone && _flagsTable[190] < 3 && _xPosCurrent > 310) {
|
||||
_xPosCurrent = 310;
|
||||
_panelLockedFlag = false;
|
||||
}
|
||||
@ -2903,15 +2903,15 @@ void TuckerEngine::execData3PreUpdate_locationNum66() {
|
||||
// To work around this we only trigger Violet if Bud actually _walked_ past
|
||||
// the trigger coordinates (as opposed to using the map).
|
||||
// Fixes Trac#10452.
|
||||
if (_nextLocationNum != 0)
|
||||
if (_nextLocation != kLocationNone)
|
||||
return;
|
||||
|
||||
_flagsTable[137] = 0;
|
||||
if (_xPosCurrent > 583 && _flagsTable[191] == 0 && _nextAction == 0 && _locationMaskType == 0) {
|
||||
_panelLockedFlag = false;
|
||||
_csDataLoaded = false;
|
||||
_nextLocationNum = 0;
|
||||
_selectedObject._locationObjectLocationNum = 0;
|
||||
_nextLocation = kLocationNone;
|
||||
_selectedObject._locationObjectLocation = kLocationNone;
|
||||
if (_flagsTable[131] == 0) {
|
||||
_nextAction = 13;
|
||||
} else if (_flagsTable[130] == 0) {
|
||||
|
@ -491,36 +491,36 @@ void TuckerEngine::loadCTable02() {
|
||||
void TuckerEngine::loadLoc() {
|
||||
Common::String filename;
|
||||
|
||||
int i = _locationWidthTable[_locationNum];
|
||||
_locationHeight = (_locationNum < 73) ? 140 : 200;
|
||||
filename = Common::String::format((i == 1) ? "loc%02d.pcx" : "loc%02da.pcx", _locationNum);
|
||||
int i = _locationWidthTable[_location];
|
||||
_locationHeight = (_location < kLocationJesusCutscene1) ? 140 : 200;
|
||||
filename = Common::String::format((i == 1) ? "loc%02d.pcx" : "loc%02da.pcx", _location);
|
||||
copyLocBitmap(filename.c_str(), 0, false);
|
||||
Graphics::copyRect(_quadBackgroundGfxBuf, 320, _locationBackgroundGfxBuf, 640, 320, _locationHeight);
|
||||
if (_locationHeight == 200) {
|
||||
return;
|
||||
}
|
||||
filename = Common::String::format((i != 2) ? "path%02d.pcx" : "path%02da.pcx", _locationNum);
|
||||
filename = Common::String::format((i != 2) ? "path%02d.pcx" : "path%02da.pcx", _location);
|
||||
copyLocBitmap(filename.c_str(), 0, true);
|
||||
if (i > 1) {
|
||||
filename = Common::String::format("loc%02db.pcx", _locationNum);
|
||||
filename = Common::String::format("loc%02db.pcx", _location);
|
||||
copyLocBitmap(filename.c_str(), 320, false);
|
||||
Graphics::copyRect(_quadBackgroundGfxBuf + 44800, 320, _locationBackgroundGfxBuf + 320, 640, 320, _locationHeight);
|
||||
if (i == 2) {
|
||||
filename = Common::String::format("path%02db.pcx", _locationNum);
|
||||
filename = Common::String::format("path%02db.pcx", _location);
|
||||
copyLocBitmap(filename.c_str(), 320, true);
|
||||
}
|
||||
}
|
||||
if (i > 2) {
|
||||
filename = Common::String::format("loc%02dc.pcx", _locationNum);
|
||||
filename = Common::String::format("loc%02dc.pcx", _location);
|
||||
copyLocBitmap(filename.c_str(), 0, false);
|
||||
Graphics::copyRect(_quadBackgroundGfxBuf + 89600, 320, _locationBackgroundGfxBuf, 640, 320, 140);
|
||||
}
|
||||
if (_locationNum == 1) {
|
||||
if (_location == kLocationHotelRoom) {
|
||||
_loadLocBufPtr = _quadBackgroundGfxBuf + 89600;
|
||||
loadImage("rochpath.pcx", _loadLocBufPtr, 0);
|
||||
}
|
||||
if (i > 3) {
|
||||
filename = Common::String::format("loc%02dd.pcx", _locationNum);
|
||||
filename = Common::String::format("loc%02dd.pcx", _location);
|
||||
copyLocBitmap(filename.c_str(), 0, false);
|
||||
Graphics::copyRect(_quadBackgroundGfxBuf + 134400, 320, _locationBackgroundGfxBuf + 320, 640, 320, 140);
|
||||
}
|
||||
@ -528,13 +528,15 @@ void TuckerEngine::loadLoc() {
|
||||
}
|
||||
|
||||
void TuckerEngine::loadObj() {
|
||||
if (_locationNum == 99) {
|
||||
if (_location == kLocationMap) {
|
||||
return;
|
||||
}
|
||||
if (_locationNum < 24) {
|
||||
if (_location <= kLocationWarehouseCutscene) {
|
||||
_part = kPartOne;
|
||||
_speechSoundBaseNum = 2639;
|
||||
} else if (_locationNum < 41 || (_locationNum > 69 && _locationNum < 73) || (_locationNum > 78 && _locationNum < 83)) {
|
||||
} else if (( _location <= kLocationFarDocks)
|
||||
|| (_location >= kLocationComputerScreen && _location <= kLocationSeedyStreetCutscene)
|
||||
|| (_location >= kLocationElvisCutscene && _location <= kLocationJesusCutscene2)) {
|
||||
_part = kPartTwo;
|
||||
_speechSoundBaseNum = 2679;
|
||||
} else {
|
||||
@ -544,7 +546,7 @@ void TuckerEngine::loadObj() {
|
||||
if (_part == _currentPart) {
|
||||
return;
|
||||
}
|
||||
debug(2, "loadObj() part %d locationNum %d", _part, _locationNum);
|
||||
debug(2, "loadObj() part %d location %d", _part, _location);
|
||||
// If a savegame is loaded from the launcher, skip the display chapter
|
||||
if (_startSlot != -1)
|
||||
_startSlot = -1;
|
||||
@ -631,7 +633,7 @@ void TuckerEngine::loadData3() {
|
||||
loadFile("data3.c", _loadTempBuf);
|
||||
DataTokenizer t(_loadTempBuf, _fileLoadSize);
|
||||
_locationAnimationsCount = 0;
|
||||
if (t.findIndex(_locationNum)) {
|
||||
if (t.findIndex(_location)) {
|
||||
while (t.findNextToken(kDataTokenDw)) {
|
||||
int num = t.getNextInteger();
|
||||
if (num < 0) {
|
||||
@ -678,7 +680,7 @@ void TuckerEngine::loadData4() {
|
||||
_displayGameHints = t.getNextInteger() != 0;
|
||||
}
|
||||
_locationObjectsCount = 0;
|
||||
if (t.findIndex(_locationNum)) {
|
||||
if (t.findIndex(_location)) {
|
||||
while (t.findNextToken(kDataTokenDw)) {
|
||||
int i = t.getNextInteger();
|
||||
if (i < 0)
|
||||
@ -694,8 +696,8 @@ void TuckerEngine::loadData4() {
|
||||
d->_standY = t.getNextInteger();
|
||||
d->_textNum = t.getNextInteger();
|
||||
d->_cursorStyle = (CursorStyle)t.getNextInteger();
|
||||
d->_locationNum = t.getNextInteger();
|
||||
if (d->_locationNum > 0) {
|
||||
d->_location = (Location)t.getNextInteger();
|
||||
if (d->_location != kLocationNone) {
|
||||
d->_toX = t.getNextInteger();
|
||||
d->_toY = t.getNextInteger();
|
||||
d->_toX2 = t.getNextInteger();
|
||||
@ -720,7 +722,7 @@ void TuckerEngine::loadActionFile() {
|
||||
|
||||
DataTokenizer t(_loadTempBuf, _fileLoadSize);
|
||||
_actionsCount = 0;
|
||||
if (t.findIndex(_locationNum)) {
|
||||
if (t.findIndex(_location)) {
|
||||
while (t.findNextToken(kDataTokenDw)) {
|
||||
int keyA = t.getNextInteger();
|
||||
if (keyA < 0) {
|
||||
@ -753,7 +755,7 @@ void TuckerEngine::loadCharPos() {
|
||||
loadFile("charpos.c", _loadTempBuf);
|
||||
DataTokenizer t(_loadTempBuf, _fileLoadSize);
|
||||
_charPosCount = 0;
|
||||
if (t.findIndex(_locationNum)) {
|
||||
if (t.findIndex(_location)) {
|
||||
while (t.findNextToken(kDataTokenDw)) {
|
||||
const int i = t.getNextInteger();
|
||||
if (i < 0) {
|
||||
@ -813,9 +815,9 @@ void TuckerEngine::loadCharPos() {
|
||||
|
||||
void TuckerEngine::loadSprA02_01() {
|
||||
unloadSprA02_01();
|
||||
const int count = _sprA02LookupTable[_locationNum];
|
||||
const int count = _sprA02LookupTable[_location];
|
||||
for (int i = 1; i < count + 1; ++i) {
|
||||
Common::String filename = Common::String::format("sprites/a%02d_%02d.spr", _locationNum, i);
|
||||
Common::String filename = Common::String::format("sprites/a%02d_%02d.spr", _location, i);
|
||||
_sprA02Table[i] = loadFile(filename.c_str(), 0);
|
||||
}
|
||||
_sprA02Table[0] = _sprA02Table[1];
|
||||
@ -831,13 +833,13 @@ void TuckerEngine::unloadSprA02_01() {
|
||||
|
||||
void TuckerEngine::loadSprC02_01() {
|
||||
unloadSprC02_01();
|
||||
const int count = _sprC02LookupTable[_locationNum];
|
||||
const int count = _sprC02LookupTable[_location];
|
||||
for (int i = 1; i < count + 1; ++i) {
|
||||
Common::String filename = Common::String::format("sprites/c%02d_%02d.spr", _locationNum, i);
|
||||
Common::String filename = Common::String::format("sprites/c%02d_%02d.spr", _location, i);
|
||||
_sprC02Table[i] = loadFile(filename.c_str(), 0);
|
||||
}
|
||||
_sprC02Table[0] = _sprC02Table[1];
|
||||
_spritesCount = _sprC02LookupTable2[_locationNum];
|
||||
_spritesCount = _sprC02LookupTable2[_location];
|
||||
for (int i = 0; i < kMaxCharacters; ++i) {
|
||||
memset(&_spritesTable[i], 0, sizeof(Sprite));
|
||||
_spritesTable[i]._state = -1;
|
||||
@ -856,7 +858,7 @@ void TuckerEngine::unloadSprC02_01() {
|
||||
void TuckerEngine::loadFx() {
|
||||
loadFile("fx.c", _loadTempBuf);
|
||||
DataTokenizer t(_loadTempBuf, _fileLoadSize);
|
||||
if (t.findIndex(_locationNum)) {
|
||||
if (t.findIndex(_location)) {
|
||||
t.findNextToken(kDataTokenDw);
|
||||
_locationSoundsCount = t.getNextInteger();
|
||||
_currentFxSet = 0;
|
||||
@ -927,7 +929,7 @@ void TuckerEngine::loadFx() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
error("loadFx() - Index not found for location %d", _locationNum);
|
||||
error("loadFx() - Index not found for location %d", _location);
|
||||
}
|
||||
|
||||
}
|
||||
@ -983,7 +985,7 @@ void TuckerEngine::loadActionsTable() {
|
||||
do {
|
||||
if (!_csDataLoaded) {
|
||||
DataTokenizer t(_csDataBuf, _csDataSize);
|
||||
bool found = t.findIndex(_locationNum);
|
||||
bool found = t.findIndex(_location);
|
||||
assert(found);
|
||||
for (int i = 0; i < _nextAction; ++i) {
|
||||
found = t.findNextToken(kDataTokenDw);
|
||||
|
@ -50,36 +50,44 @@ Common::String generateGameStateFileName(const char *target, int slot, bool pref
|
||||
return name;
|
||||
}
|
||||
|
||||
static void saveOrLoadInt(Common::WriteStream &stream, int &i) {
|
||||
static void saveOrLoadVar(Common::WriteStream &stream, int &i) {
|
||||
stream.writeSint32LE(i);
|
||||
}
|
||||
|
||||
static void saveOrLoadInt(Common::ReadStream &stream, int &i) {
|
||||
static void saveOrLoadVar(Common::ReadStream &stream, int &i) {
|
||||
i = stream.readSint32LE();
|
||||
}
|
||||
|
||||
static void saveOrLoadVar(Common::WriteStream &stream, Location &location) {
|
||||
stream.writeSint32LE((int)location);
|
||||
}
|
||||
|
||||
static void saveOrLoadVar(Common::ReadStream &stream, Location &location) {
|
||||
location = (Location)stream.readSint32LE();
|
||||
}
|
||||
|
||||
template<class S>
|
||||
TuckerEngine::SavegameError TuckerEngine::saveOrLoadGameStateData(S &s) {
|
||||
for (int i = 0; i < kFlagsTableSize; ++i) {
|
||||
saveOrLoadInt(s, _flagsTable[i]);
|
||||
saveOrLoadVar(s, _flagsTable[i]);
|
||||
}
|
||||
for (int i = 0; i < 40; ++i) {
|
||||
saveOrLoadInt(s, _inventoryObjectsList[i]);
|
||||
saveOrLoadVar(s, _inventoryObjectsList[i]);
|
||||
}
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
saveOrLoadInt(s, _inventoryItemsState[i]);
|
||||
saveOrLoadVar(s, _inventoryItemsState[i]);
|
||||
}
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
saveOrLoadInt(s, _panelObjectsOffsetTable[i]);
|
||||
saveOrLoadVar(s, _panelObjectsOffsetTable[i]);
|
||||
}
|
||||
saveOrLoadInt(s, _mainSpritesBaseOffset);
|
||||
saveOrLoadInt(s, _selectedObject._xPos);
|
||||
saveOrLoadInt(s, _selectedObject._yPos);
|
||||
saveOrLoadInt(s, _locationNum);
|
||||
saveOrLoadInt(s, _xPosCurrent);
|
||||
saveOrLoadInt(s, _yPosCurrent);
|
||||
saveOrLoadInt(s, _inventoryObjectsCount);
|
||||
saveOrLoadInt(s, _inventoryObjectsOffset);
|
||||
saveOrLoadVar(s, _mainSpritesBaseOffset);
|
||||
saveOrLoadVar(s, _selectedObject._xPos);
|
||||
saveOrLoadVar(s, _selectedObject._yPos);
|
||||
saveOrLoadVar(s, _location);
|
||||
saveOrLoadVar(s, _xPosCurrent);
|
||||
saveOrLoadVar(s, _yPosCurrent);
|
||||
saveOrLoadVar(s, _inventoryObjectsCount);
|
||||
saveOrLoadVar(s, _inventoryObjectsOffset);
|
||||
|
||||
return s.err() ? kSavegameIoError : kSavegameNoError;
|
||||
}
|
||||
@ -121,7 +129,7 @@ Common::Error TuckerEngine::loadGameState(int slot) {
|
||||
|
||||
g_engine->setTotalPlayTime(header.playTime * 1000);
|
||||
|
||||
_nextLocationNum = _locationNum;
|
||||
_nextLocation = _location;
|
||||
setBlackPalette();
|
||||
loadBudSpr();
|
||||
_forceRedrawPanelItems = true;
|
||||
|
@ -50,13 +50,13 @@ void TuckerEngine::handleCreditsSequence() {
|
||||
int counter3 = 0;
|
||||
int num = 0;
|
||||
int imgNum = 0;
|
||||
int prevLocationNum = _locationNum;
|
||||
Location prevLocation = _location;
|
||||
int counter2 = 0;
|
||||
int counter1 = 0;
|
||||
loadCharset2();
|
||||
showCursor(false);
|
||||
stopSounds();
|
||||
_locationNum = 74;
|
||||
_location = kLocationCredits;
|
||||
_flagsTable[236] = 74;
|
||||
uint8 *imgBuf = (uint8 *)malloc(16 * 64000);
|
||||
loadSprC02_01();
|
||||
@ -151,7 +151,7 @@ void TuckerEngine::handleCreditsSequence() {
|
||||
}
|
||||
} while (!_quitGame && isSpeechSoundPlaying());
|
||||
free(imgBuf);
|
||||
_locationNum = prevLocationNum;
|
||||
_location = prevLocation;
|
||||
do {
|
||||
if (_fadePaletteCounter > 0) {
|
||||
fadeInPalette();
|
||||
@ -211,8 +211,8 @@ void TuckerEngine::handleNewPartSequence() {
|
||||
loadImage(filename.c_str(), _quadBackgroundGfxBuf, 1);
|
||||
_spritesCount = 1;
|
||||
clearSprites();
|
||||
int currentLocation = _locationNum;
|
||||
_locationNum = 98;
|
||||
Location currentLocation = _location;
|
||||
_location = kLocationNewPart;
|
||||
unloadSprA02_01();
|
||||
unloadSprC02_01();
|
||||
switch (_part) {
|
||||
@ -260,7 +260,7 @@ void TuckerEngine::handleNewPartSequence() {
|
||||
redrawScreen(0);
|
||||
waitForTimer(3);
|
||||
} while (_fadePaletteCounter > 0 && !_quitGame);
|
||||
_locationNum = currentLocation;
|
||||
_location = currentLocation;
|
||||
showCursor(true);
|
||||
}
|
||||
|
||||
@ -309,7 +309,7 @@ void TuckerEngine::handleMeanwhileSequence() {
|
||||
void TuckerEngine::handleMapSequence() {
|
||||
loadImage("map2.pcx", _quadBackgroundGfxBuf + 89600, 0);
|
||||
loadImage("map1.pcx", _loadTempBuf, 1);
|
||||
_selectedObject._locationObjectLocationNum = 0;
|
||||
_selectedObject._locationObjectLocation = kLocationNone;
|
||||
if (_flagsTable[7] > 0) {
|
||||
copyMapRect(0, 0, 140, 86);
|
||||
}
|
||||
@ -334,45 +334,45 @@ void TuckerEngine::handleMapSequence() {
|
||||
_fullRedraw = true;
|
||||
if (_flagsTable[7] > 0 && _mousePosX > 30 && _mousePosX < 86 && _mousePosY > 36 && _mousePosY < 86) {
|
||||
textNum = 13;
|
||||
_nextLocationNum = (_part == kPartOne) ? 3 : 65;
|
||||
_nextLocation = (_part == kPartOne) ? kLocationSeedyStreet : kLocationSeedyStreetPartThree;
|
||||
xPos = 620;
|
||||
yPos = 130;
|
||||
} else if (_flagsTable[7] > 1 && _mousePosX > 60 && _mousePosX < 120 && _mousePosY > 120 && _mousePosY < 170) {
|
||||
textNum = 14;
|
||||
_nextLocationNum = (_part == kPartOne) ? 9 : 66;
|
||||
_nextLocation = (_part == kPartOne) ? kLocationMall : kLocationMallPartThree;
|
||||
xPos = 344;
|
||||
yPos = 120;
|
||||
} else if (_flagsTable[7] > 2 && _mousePosX > 160 && _mousePosX < 210 && _mousePosY > 110 && _mousePosY < 160) {
|
||||
textNum = 15;
|
||||
_nextLocationNum = (_part == kPartOne) ? 16 : 61;
|
||||
_nextLocation = (_part == kPartOne) ? kLocationPark : kLocationParkPartThree;
|
||||
xPos = 590;
|
||||
yPos = 130;
|
||||
} else if ((_flagsTable[7] == 4 || _flagsTable[7] == 6) && _mousePosX > 150 && _mousePosX < 200 && _mousePosY > 20 && _mousePosY < 70) {
|
||||
textNum = 16;
|
||||
_nextLocationNum = (_part == kPartOne) ? 20 : 68;
|
||||
_nextLocation = (_part == kPartOne) ? kLocationOutsideMuseum : kLocationOutsideMuseumPartThree;
|
||||
xPos = 20;
|
||||
yPos = 130;
|
||||
} else if (_flagsTable[120] == 1 && _mousePosX > 240 && _mousePosX < 290 && _mousePosY > 35 && _mousePosY < 90) {
|
||||
textNum = 17;
|
||||
_nextLocationNum = (_part == kPartOne) ? 19 : 62;
|
||||
_nextLocation = (_part == kPartOne) ? kLocationDocks : kLocationDocksPartThree;
|
||||
xPos = 20;
|
||||
yPos = 124;
|
||||
} else if (_mousePosX > 135 && _mousePosX < 185 && _mousePosY > 170 && _mousePosY < 200) {
|
||||
textNum = 18;
|
||||
_nextLocationNum = _locationNum;
|
||||
_nextLocation = _location;
|
||||
if (!_noPositionChangeAfterMap) {
|
||||
xPos = _xPosCurrent;
|
||||
yPos = _yPosCurrent;
|
||||
} else if (_locationNum == 3 || _locationNum == 65) {
|
||||
} else if (_location == kLocationSeedyStreet || _location == kLocationSeedyStreetPartThree) {
|
||||
xPos = 620;
|
||||
yPos = 130;
|
||||
} else if (_locationNum == 9 || _locationNum == 66) {
|
||||
} else if (_location == kLocationMall || _location == kLocationMallPartThree) {
|
||||
xPos = 344;
|
||||
yPos = 120;
|
||||
} else if (_locationNum == 16 || _locationNum == 61) {
|
||||
} else if (_location == kLocationPark || _location == kLocationParkPartThree) {
|
||||
xPos = 590;
|
||||
yPos = 130;
|
||||
} else if (_locationNum == 20 || _locationNum == 68) {
|
||||
} else if (_location == kLocationOutsideMuseum || _location == kLocationOutsideMuseumPartThree) {
|
||||
xPos = 20;
|
||||
yPos = 130;
|
||||
} else {
|
||||
@ -398,11 +398,11 @@ void TuckerEngine::handleMapSequence() {
|
||||
--_fadePaletteCounter;
|
||||
}
|
||||
_mouseClick = 1;
|
||||
if (_nextLocationNum == 9 && _noPositionChangeAfterMap) {
|
||||
if (_nextLocation == kLocationMall && _noPositionChangeAfterMap) {
|
||||
_backgroundSpriteCurrentAnimation = 2;
|
||||
_backgroundSpriteCurrentFrame = 0;
|
||||
setCursorState(kCursorStateDisabledHidden);
|
||||
} else if (_nextLocationNum == 66 && _noPositionChangeAfterMap) {
|
||||
} else if (_nextLocation == kLocationMallPartThree && _noPositionChangeAfterMap) {
|
||||
_backgroundSpriteCurrentAnimation = 1;
|
||||
_backgroundSpriteCurrentFrame = 0;
|
||||
setCursorState(kCursorStateDisabledHidden);
|
||||
|
@ -157,11 +157,11 @@ void TuckerEngine::resetVariables() {
|
||||
_mainLoopCounter1 = _mainLoopCounter2 = 0;
|
||||
_timerCounter2 = 0;
|
||||
_part = _currentPart = kPartInit;
|
||||
_locationNum = 0;
|
||||
_nextLocationNum = (_gameFlags & kGameFlagDemo) == 0 ? kStartupLocationGame : kStartupLocationDemo;
|
||||
_location = kLocationNone;
|
||||
_nextLocation = (_gameFlags & kGameFlagDemo) ? kLocationInitDemo : kLocationInit;
|
||||
_gamePaused = false;
|
||||
_gameDebug = false;
|
||||
_displaySpeechText = (_gameFlags & kGameFlagNoSubtitles) == 0 ? ConfMan.getBool("subtitles") : false;
|
||||
_displaySpeechText = (_gameFlags & kGameFlagNoSubtitles) ? false : ConfMan.getBool("subtitles");
|
||||
memset(_flagsTable, 0, sizeof(_flagsTable));
|
||||
|
||||
_gameHintsIndex = 0;
|
||||
@ -400,7 +400,7 @@ void TuckerEngine::mainLoop() {
|
||||
loadGameState(slot);
|
||||
}
|
||||
} else if (ConfMan.hasKey("boot_param")) {
|
||||
_nextLocationNum = ConfMan.getInt("boot_param");
|
||||
_nextLocation = (Location)ConfMan.getInt("boot_param");
|
||||
}
|
||||
|
||||
do {
|
||||
@ -427,7 +427,7 @@ void TuckerEngine::mainLoop() {
|
||||
if (_nextAction != 0) {
|
||||
loadActionsTable();
|
||||
}
|
||||
if (_nextLocationNum > 0) {
|
||||
if (_nextLocation != kLocationNone) {
|
||||
setupNewLocation();
|
||||
}
|
||||
updateCharPosition();
|
||||
@ -499,13 +499,13 @@ void TuckerEngine::mainLoop() {
|
||||
}
|
||||
}
|
||||
_mainSpritesBaseOffset = 0;
|
||||
if (_locationWidthTable[_locationNum] > 3) {
|
||||
if (_locationWidthTable[_location] > 3) {
|
||||
++_currentGfxBackgroundCounter;
|
||||
if (_currentGfxBackgroundCounter > 39) {
|
||||
_currentGfxBackgroundCounter = 0;
|
||||
}
|
||||
_currentGfxBackground = _quadBackgroundGfxBuf + (_currentGfxBackgroundCounter / 10) * 44800;
|
||||
if (_fadePaletteCounter < 34 && _locationNum == 22) {
|
||||
if (_fadePaletteCounter < 34 && _location == kLocationFishingTrawler) {
|
||||
int offset = (_currentGfxBackgroundCounter > 29 ? 1 : (_currentGfxBackgroundCounter / 10));
|
||||
_spritesTable[0]._gfxBackgroundOffset = offset * 640;
|
||||
_mainSpritesBaseOffset = offset;
|
||||
@ -589,7 +589,7 @@ void TuckerEngine::mainLoop() {
|
||||
}
|
||||
if (_inputKeys[kInputKeyPause]) {
|
||||
_inputKeys[kInputKeyPause] = false;
|
||||
if (_locationNum != 70) {
|
||||
if (_location != kLocationComputerScreen) {
|
||||
_gamePaused = true;
|
||||
}
|
||||
}
|
||||
@ -757,10 +757,10 @@ void TuckerEngine::showCursor(bool visible) {
|
||||
}
|
||||
|
||||
void TuckerEngine::setupNewLocation() {
|
||||
debug(2, "setupNewLocation() current %d next %d", _locationNum, _nextLocationNum);
|
||||
_locationNum = _nextLocationNum;
|
||||
debug(2, "setupNewLocation() current %d next %d", _location, _nextLocation);
|
||||
_location = _nextLocation;
|
||||
loadObj();
|
||||
_nextLocationNum = 0;
|
||||
_nextLocation = kLocationNone;
|
||||
_fadePaletteCounter = 0;
|
||||
_mainLoopCounter2 = 0;
|
||||
_mainLoopCounter1 = 0;
|
||||
@ -772,7 +772,7 @@ void TuckerEngine::setupNewLocation() {
|
||||
_backgroundSpriteCurrentAnimation = -1;
|
||||
_backgroundSpriteCurrentFrame = 0;
|
||||
}
|
||||
if (!_panelLockedFlag || (_backgroundSpriteCurrentAnimation > 0 && _locationNum != 25)) {
|
||||
if (!_panelLockedFlag || (_backgroundSpriteCurrentAnimation > 0 && _location != kLocationVentSystem)) {
|
||||
_locationMaskType = 0;
|
||||
} else {
|
||||
_locationMaskType = 3;
|
||||
@ -803,7 +803,7 @@ void TuckerEngine::setupNewLocation() {
|
||||
|
||||
void TuckerEngine::copyLocBitmap(const char *filename, int offset, bool isMask) {
|
||||
int type = !isMask ? 1 : 0;
|
||||
if (offset > 0 && _locationNum == 16) {
|
||||
if (offset > 0 && _location == kLocationPark) {
|
||||
type = 0;
|
||||
}
|
||||
loadImage(filename, _loadTempBuf, type);
|
||||
@ -863,7 +863,7 @@ void TuckerEngine::updateCharPosition() {
|
||||
if (_currentActionVerb == kVerbWalk || _locationMaskCounter == 0) {
|
||||
return;
|
||||
}
|
||||
if (_currentActionVerb == kVerbLook && _locationNum != 18) {
|
||||
if (_currentActionVerb == kVerbLook && _location != kLocationRoystonsHomeBoxroom) {
|
||||
int pos;
|
||||
_actionPosX = _xPosCurrent;
|
||||
_actionPosY = _yPosCurrent - 64;
|
||||
@ -1066,10 +1066,10 @@ void TuckerEngine::setBlackPalette() {
|
||||
|
||||
void TuckerEngine::updateCursor() {
|
||||
setCursorStyle(kCursorNormal);
|
||||
if (_backgroundSpriteCurrentAnimation == -1 && !_panelLockedFlag && _selectedObject._locationObjectLocationNum > 0) {
|
||||
_selectedObject._locationObjectLocationNum = 0;
|
||||
if (_backgroundSpriteCurrentAnimation == -1 && !_panelLockedFlag && _selectedObject._locationObjectLocation != kLocationNone) {
|
||||
_selectedObject._locationObjectLocation = kLocationNone;
|
||||
}
|
||||
if (_locationMaskType > 0 || _selectedObject._locationObjectLocationNum > 0 || _pendingActionDelay > 0) {
|
||||
if (_locationMaskType > 0 || _selectedObject._locationObjectLocation != kLocationNone || _pendingActionDelay > 0) {
|
||||
return;
|
||||
}
|
||||
if (_rightMouseButtonPressed) {
|
||||
@ -1088,7 +1088,7 @@ void TuckerEngine::updateCursor() {
|
||||
}
|
||||
if (!_actionVerbLocked) {
|
||||
setActionVerbUnderCursor();
|
||||
if (_actionVerb == kVerbWalk && _locationNum == 63) {
|
||||
if (_actionVerb == kVerbWalk && _location == kLocationTV) {
|
||||
_actionVerb = kVerbUse;
|
||||
}
|
||||
}
|
||||
@ -1201,7 +1201,7 @@ void TuckerEngine::updateCharactersPath() {
|
||||
if (!_panelLockedFlag) {
|
||||
return;
|
||||
}
|
||||
if (_backgroundSpriteCurrentAnimation != -1 && _locationNum != 25) {
|
||||
if (_backgroundSpriteCurrentAnimation != -1 && _location != kLocationVentSystem) {
|
||||
if (_xPosCurrent == _selectedObject._xPos && _yPosCurrent == _selectedObject._yPos) {
|
||||
_locationMaskCounter = 1;
|
||||
_panelLockedFlag = false;
|
||||
@ -1255,7 +1255,7 @@ void TuckerEngine::updateCharactersPath() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_locationNum == 25) {
|
||||
if (_location == kLocationVentSystem) {
|
||||
if ((_backgroundSpriteCurrentAnimation != 3 || _characterBackFrontFacing) && (_backgroundSpriteCurrentAnimation != 6 || !_characterBackFrontFacing)) {
|
||||
_xPosCurrent = xPos;
|
||||
_yPosCurrent = yPos;
|
||||
@ -1274,7 +1274,7 @@ void TuckerEngine::updateCharactersPath() {
|
||||
if (_characterPrevFacingDirection <= 0 || _characterPrevFacingDirection >= 5) {
|
||||
return;
|
||||
}
|
||||
if (_selectedObject._locationObjectLocationNum == 0) {
|
||||
if (_selectedObject._locationObjectLocation == kLocationNone) {
|
||||
_characterFacingDirection = 5;
|
||||
while (_spriteAnimationFramesTable[_spriteAnimationFrameIndex] != 999) {
|
||||
++_spriteAnimationFrameIndex;
|
||||
@ -1319,7 +1319,7 @@ void TuckerEngine::updateData3() {
|
||||
a->_animCurrentCounter = a->_animInitCounter;
|
||||
a->_drawFlag = false;
|
||||
}
|
||||
if (_locationNum == 24 && i == 0) {
|
||||
if (_location == kLocationStoreRoom && i == 0) {
|
||||
// workaround bug #2872385: update fish animation sequence for correct
|
||||
// position in aquarium.
|
||||
if (a->_animInitCounter == 505 && a->_animCurrentCounter == 513) {
|
||||
@ -1541,11 +1541,11 @@ void TuckerEngine::drawConversationTexts() {
|
||||
|
||||
void TuckerEngine::updateScreenScrolling() {
|
||||
int scrollPrevOffset = _scrollOffset;
|
||||
if (_locationWidthTable[_locationNum] != 2) {
|
||||
if (_locationWidthTable[_location] != 2) {
|
||||
_scrollOffset = 0;
|
||||
} else if (_validInstructionId) {
|
||||
_scrollOffset = _xPosCurrent - 200;
|
||||
} else if (_locationNum == 16 && _backgroundSpriteCurrentAnimation == 6 && _scrollOffset + 200 < _xPosCurrent) {
|
||||
} else if (_location == kLocationPark && _backgroundSpriteCurrentAnimation == 6 && _scrollOffset + 200 < _xPosCurrent) {
|
||||
++_scrollOffset;
|
||||
if (_scrollOffset > 320) {
|
||||
_scrollOffset = 320;
|
||||
@ -1641,7 +1641,7 @@ void TuckerEngine::drawData3() {
|
||||
}
|
||||
|
||||
void TuckerEngine::execData3PreUpdate() {
|
||||
switch (_locationNum) {
|
||||
switch (_location) {
|
||||
case 1:
|
||||
execData3PreUpdate_locationNum1();
|
||||
break;
|
||||
@ -1774,11 +1774,13 @@ void TuckerEngine::execData3PreUpdate() {
|
||||
case 70:
|
||||
execData3PreUpdate_locationNum70();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void TuckerEngine::execData3PostUpdate() {
|
||||
switch (_locationNum) {
|
||||
switch (_location) {
|
||||
case 1:
|
||||
execData3PostUpdate_locationNum1();
|
||||
break;
|
||||
@ -1815,6 +1817,8 @@ void TuckerEngine::execData3PostUpdate() {
|
||||
case 66:
|
||||
execData3PostUpdate_locationNum66();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1825,18 +1829,18 @@ void TuckerEngine::drawBackgroundSprites() {
|
||||
int srcH = READ_LE_UINT16(_backgroundSpriteDataPtr + frameOffset + 2);
|
||||
int srcX = READ_LE_UINT16(_backgroundSpriteDataPtr + frameOffset + 8);
|
||||
int srcY = READ_LE_UINT16(_backgroundSpriteDataPtr + frameOffset + 10);
|
||||
if (_locationNum == 22 && _backgroundSpriteCurrentAnimation > 1) {
|
||||
if (_location == kLocationFishingTrawler && _backgroundSpriteCurrentAnimation > 1) {
|
||||
srcY += _mainSpritesBaseOffset;
|
||||
}
|
||||
if (_locationNum == 29 && _backgroundSpriteCurrentAnimation == 3) {
|
||||
if (_location == kLocationSubmarineHangar && _backgroundSpriteCurrentAnimation == 3) {
|
||||
srcX += 228;
|
||||
} else if (_locationNum == 58 && _backgroundSpriteCurrentAnimation == 1) {
|
||||
} else if (_location == kLocationInsideMuseumPartThree && _backgroundSpriteCurrentAnimation == 1) {
|
||||
srcX += 100;
|
||||
} else if (_xPosCurrent > 320 && _xPosCurrent < 640) {
|
||||
srcX += 320;
|
||||
}
|
||||
srcX += _backgroundSprOffset;
|
||||
Graphics::decodeRLE_248(_locationBackgroundGfxBuf + srcY * 640 + srcX, _backgroundSpriteDataPtr + frameOffset + 12, srcW, srcH, 0, _locationHeightTable[_locationNum], false);
|
||||
Graphics::decodeRLE_248(_locationBackgroundGfxBuf + srcY * 640 + srcX, _backgroundSpriteDataPtr + frameOffset + 12, srcW, srcH, 0, _locationHeightTable[_location], false);
|
||||
addDirtyRect(srcX, srcY, srcW, srcH);
|
||||
}
|
||||
}
|
||||
@ -1854,15 +1858,18 @@ void TuckerEngine::drawCurrentSprite() {
|
||||
// [0xE0, ... ..., 0xEF]
|
||||
static const int whitelistReservedColorsLocation48[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 };
|
||||
static const int whitelistReservedColorsLocation61[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 };
|
||||
switch (_locationNum) {
|
||||
case 48:
|
||||
switch (_location) {
|
||||
case kLocationCorridor:
|
||||
whitelistReservedColors = (const int *)&whitelistReservedColorsLocation48;
|
||||
break;
|
||||
|
||||
case 61:
|
||||
case kLocationParkPartThree:
|
||||
if (_xPosCurrent <= 565)
|
||||
whitelistReservedColors = (const int *)&whitelistReservedColorsLocation61;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SpriteFrame *chr = &_spriteFramesTable[_currentSpriteAnimationFrame];
|
||||
@ -1874,7 +1881,7 @@ void TuckerEngine::drawCurrentSprite() {
|
||||
xPos -= chr->_xSize + chr->_xOffset - 14;
|
||||
}
|
||||
Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr->_sourceOffset, chr->_xSize, chr->_ySize,
|
||||
chr->_yOffset, _locationHeightTable[_locationNum], _mirroredDrawing, whitelistReservedColors);
|
||||
chr->_yOffset, _locationHeightTable[_location], _mirroredDrawing, whitelistReservedColors);
|
||||
addDirtyRect(xPos, yPos, chr->_xSize, chr->_ySize);
|
||||
if (_currentSpriteAnimationLength > 1) {
|
||||
SpriteFrame *chr2 = &_spriteFramesTable[_currentSpriteAnimationFrame2];
|
||||
@ -1886,7 +1893,7 @@ void TuckerEngine::drawCurrentSprite() {
|
||||
xPos -= chr2->_xSize + chr2->_xOffset - 14;
|
||||
}
|
||||
Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr2->_sourceOffset, chr2->_xSize, chr2->_ySize,
|
||||
chr2->_yOffset, _locationHeightTable[_locationNum], _mirroredDrawing, whitelistReservedColors);
|
||||
chr2->_yOffset, _locationHeightTable[_location], _mirroredDrawing, whitelistReservedColors);
|
||||
addDirtyRect(xPos, yPos, chr2->_xSize, chr2->_ySize);
|
||||
}
|
||||
}
|
||||
@ -2171,7 +2178,7 @@ void TuckerEngine::updateCharacterAnimation() {
|
||||
assert(_backgroundSpriteCurrentAnimation >= 0 && _backgroundSpriteCurrentAnimation < kSprA02TableSize);
|
||||
_backgroundSpriteDataPtr = _sprA02Table[_backgroundSpriteCurrentAnimation];
|
||||
_backgroundSpriteLastFrame = READ_LE_UINT16(_backgroundSpriteDataPtr);
|
||||
} else if (_locationNum == 25 && !_panelLockedFlag && (_backgroundSpriteCurrentAnimation == 3 || _backgroundSpriteCurrentAnimation == 6)) {
|
||||
} else if (_location == kLocationVentSystem && !_panelLockedFlag && (_backgroundSpriteCurrentAnimation == 3 || _backgroundSpriteCurrentAnimation == 6)) {
|
||||
_backgroundSpriteCurrentFrame = 0;
|
||||
_backgroundSpriteCurrentAnimation = -1;
|
||||
} else {
|
||||
@ -2186,10 +2193,10 @@ void TuckerEngine::updateCharacterAnimation() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_locationNum == 24 && _flagsTable[103] == 0) {
|
||||
if (_location == kLocationStoreRoom && _flagsTable[103] == 0) {
|
||||
if (_panelLockedFlag) {
|
||||
_panelLockedFlag = false;
|
||||
_selectedObject._locationObjectLocationNum = 0;
|
||||
_selectedObject._locationObjectLocation = kLocationNone;
|
||||
if (_actionVerb != kVerbTalk) {
|
||||
_speechSoundNum = 2236;
|
||||
startSpeechSound(_speechSoundNum, _speechVolume);
|
||||
@ -2222,7 +2229,7 @@ void TuckerEngine::updateCharacterAnimation() {
|
||||
_backgroundSpriteDataPtr = _sprA02Table[_backgroundSpriteCurrentAnimation];
|
||||
_backgroundSpriteLastFrame = READ_LE_UINT16(_backgroundSpriteDataPtr);
|
||||
}
|
||||
} else if (_locationNum == 25) {
|
||||
} else if (_location == kLocationVentSystem) {
|
||||
if (_backgroundSpriteCurrentFrame == 0) {
|
||||
if (!_characterBackFrontFacing) {
|
||||
if (_characterBackFrontFacing != _characterPrevBackFrontFacing) {
|
||||
@ -2251,7 +2258,7 @@ void TuckerEngine::updateCharacterAnimation() {
|
||||
_backgroundSpriteLastFrame = READ_LE_UINT16(_backgroundSpriteDataPtr);
|
||||
}
|
||||
_backgroundSprOffset = _xPosCurrent - 160;
|
||||
} else if (_locationNum == 63 && _backgroundSpriteCurrentFrame == 0) {
|
||||
} else if (_location == kLocationTV && _backgroundSpriteCurrentFrame == 0) {
|
||||
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == 99) {
|
||||
_backgroundSpriteCurrentAnimation = 1;
|
||||
} else {
|
||||
@ -2262,7 +2269,7 @@ void TuckerEngine::updateCharacterAnimation() {
|
||||
_backgroundSpriteLastFrame = READ_LE_UINT16(_backgroundSpriteDataPtr);
|
||||
}
|
||||
int frame = _spriteAnimationFramesTable[_spriteAnimationFrameIndex];
|
||||
if (!_panelLockedFlag && _characterFacingDirection < 5 && _selectedObject._locationObjectLocationNum == 0) {
|
||||
if (!_panelLockedFlag && _characterFacingDirection < 5 && _selectedObject._locationObjectLocation == kLocationNone) {
|
||||
_characterFacingDirection = 0;
|
||||
}
|
||||
if (_charSpeechSoundCounter > 0 && _characterFacingDirection != 6 && _actionCharacterNum == 99) {
|
||||
@ -2321,7 +2328,7 @@ void TuckerEngine::updateCharacterAnimation() {
|
||||
num = 13;
|
||||
} else if (getRandomNumber() < 3000) {
|
||||
num = 14;
|
||||
if (_locationNum == 57) {
|
||||
if (_location == kLocationFishShopPartThree) {
|
||||
num = 18;
|
||||
}
|
||||
} else {
|
||||
@ -2409,7 +2416,7 @@ void TuckerEngine::handleMap() {
|
||||
_panelLockedFlag = false;
|
||||
}
|
||||
}
|
||||
if (!_panelLockedFlag && (_backgroundSpriteCurrentAnimation == -1 || _locationNum == 25) && _locationMaskType == 3) {
|
||||
if (!_panelLockedFlag && (_backgroundSpriteCurrentAnimation == -1 || _location == kLocationVentSystem) && _locationMaskType == 3) {
|
||||
setCursorState(kCursorStateNormal);
|
||||
if (_locationMaskCounter == 1) {
|
||||
_characterFacingDirection = 0;
|
||||
@ -2417,10 +2424,10 @@ void TuckerEngine::handleMap() {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (_selectedObject._locationObjectLocationNum != 0 && _locationMaskCounter != 0 && (_backgroundSpriteCurrentAnimation <= -1 || _locationNum == 25)) {
|
||||
if (_selectedObject._locationObjectLocation != kLocationNone && _locationMaskCounter != 0 && (_backgroundSpriteCurrentAnimation <= -1 || _location == kLocationVentSystem)) {
|
||||
// TODO
|
||||
// This is actually "_locationNum != 25" in disassembly. Is this a typo?
|
||||
if (_locationNum == 25 || _backgroundSpriteCurrentAnimation != 4) {
|
||||
if (_location == kLocationVentSystem || _backgroundSpriteCurrentAnimation != 4) {
|
||||
if (_locationMaskType == 0) {
|
||||
_locationMaskType = 1;
|
||||
setCursorState(kCursorStateDisabledHidden);
|
||||
@ -2435,7 +2442,7 @@ void TuckerEngine::handleMap() {
|
||||
}
|
||||
_backgroundSpriteCurrentFrame = 0;
|
||||
_mirroredDrawing = false;
|
||||
if (_locationNum == 25) {
|
||||
if (_location == kLocationVentSystem) {
|
||||
_backgroundSpriteDataPtr = _sprA02Table[_backgroundSpriteCurrentAnimation];
|
||||
_backgroundSpriteLastFrame = READ_LE_UINT16(_backgroundSpriteDataPtr);
|
||||
_backgroundSpriteCurrentFrame = 1;
|
||||
@ -2452,7 +2459,7 @@ void TuckerEngine::handleMap() {
|
||||
_locationMaskType = 2;
|
||||
_panelType = kPanelTypeNormal;
|
||||
setCursorState(kCursorStateNormal);
|
||||
if (_selectedObject._locationObjectLocationNum == 99) {
|
||||
if (_selectedObject._locationObjectLocation == kLocationMap) {
|
||||
_noPositionChangeAfterMap = true;
|
||||
handleMapSequence();
|
||||
return;
|
||||
@ -2462,7 +2469,7 @@ void TuckerEngine::handleMap() {
|
||||
redrawScreen(_scrollOffset);
|
||||
_fadePaletteCounter = 34;
|
||||
}
|
||||
_nextLocationNum = _selectedObject._locationObjectLocationNum;
|
||||
_nextLocation = _selectedObject._locationObjectLocation;
|
||||
_xPosCurrent = _selectedObject._locationObjectToX;
|
||||
_yPosCurrent = _selectedObject._locationObjectToY;
|
||||
if (_selectedObject._locationObjectToX2 > 800) {
|
||||
@ -2483,7 +2490,7 @@ void TuckerEngine::handleMap() {
|
||||
_scrollOffset = 0;
|
||||
_handleMapCounter = 0;
|
||||
_locationMaskCounter = 0;
|
||||
_selectedObject._locationObjectLocationNum = 0;
|
||||
_selectedObject._locationObjectLocation = kLocationNone;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2497,7 +2504,7 @@ void TuckerEngine::clearSprites() {
|
||||
}
|
||||
|
||||
void TuckerEngine::updateSprites() {
|
||||
const int count = (_locationNum == 9) ? 3 : _spritesCount;
|
||||
const int count = (_location == kLocationMall) ? 3 : _spritesCount;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (_spritesTable[i]._stateIndex > -1) {
|
||||
++_spritesTable[i]._stateIndex;
|
||||
@ -2564,7 +2571,7 @@ void TuckerEngine::updateSprite(int i) {
|
||||
_updateSpriteFlag2 = false;
|
||||
_spritesTable[i]._defaultUpdateDelay = 0;
|
||||
_spritesTable[i]._updateDelay = 0;
|
||||
switch (_locationNum) {
|
||||
switch (_location) {
|
||||
case 2:
|
||||
updateSprite_locationNum2();
|
||||
break;
|
||||
@ -2937,6 +2944,8 @@ void TuckerEngine::updateSprite(int i) {
|
||||
case 98:
|
||||
_spritesTable[0]._state = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (_spritesTable[i]._stateIndex <= -1) {
|
||||
if (!_updateSpriteFlag1) {
|
||||
@ -3049,7 +3058,7 @@ bool TuckerEngine::testLocationMask(int x, int y) {
|
||||
if (_locationMaskType > 0 || _locationMaskIgnore) {
|
||||
return true;
|
||||
}
|
||||
if (_locationNum == 26 || _locationNum == 32) {
|
||||
if (_location == kLocationSubwayTunnel || _location == kLocationKitchen) {
|
||||
y -= 3;
|
||||
}
|
||||
const int offset = y * 640 + x;
|
||||
@ -3308,7 +3317,7 @@ int TuckerEngine::executeTableInstruction() {
|
||||
// As a workaround, do not ignore the location mask during this specific
|
||||
// action when entering the club.
|
||||
// This fixes Trac#5838.
|
||||
if (!(_locationNum == 6 && _nextAction == 59)) {
|
||||
if (!(_location == kLocationStripJoint && _nextAction == 59)) {
|
||||
_locationMaskIgnore = true;
|
||||
}
|
||||
_panelLockedFlag = true;
|
||||
@ -3383,7 +3392,7 @@ int TuckerEngine::executeTableInstruction() {
|
||||
_characterAnimationNum = readTableInstructionParam(2);
|
||||
return 0;
|
||||
case kCode_loc:
|
||||
_nextLocationNum = readTableInstructionParam(2);
|
||||
_nextLocation = (Location)readTableInstructionParam(2);
|
||||
return 1;
|
||||
case kCode_mof:
|
||||
setCursorState(kCursorStateDisabledHidden);
|
||||
@ -3471,7 +3480,7 @@ int TuckerEngine::executeTableInstruction() {
|
||||
// To work around the issue in the problematic versions we inject these two
|
||||
// instructions after the first occurence of the 'wsm' instruction (which
|
||||
// proves good enough).
|
||||
if (_locationNum == 24 && _nextAction == 61) {
|
||||
if (_location == kLocationStoreRoom && _nextAction == 61) {
|
||||
setCursorState(kCursorStateDisabledHidden);
|
||||
_panelType = kPanelTypeEmpty;
|
||||
}
|
||||
@ -3583,7 +3592,7 @@ void TuckerEngine::setSelectedObjectKey() {
|
||||
_locationMaskCounter = 0;
|
||||
_actionRequiresTwoObjects = false;
|
||||
_selectedObject._yPos = 0;
|
||||
_selectedObject._locationObjectLocationNum = 0;
|
||||
_selectedObject._locationObjectLocation = kLocationNone;
|
||||
_pendingActionIndex = 0;
|
||||
if (_selectedObjectType == 0) {
|
||||
if (_selectedObjectNum == 0) {
|
||||
@ -3593,7 +3602,7 @@ void TuckerEngine::setSelectedObjectKey() {
|
||||
_selectedObject._xPos = _locationObjectsTable[_selectedCharacterNum]._standX;
|
||||
_selectedObject._yPos = _locationObjectsTable[_selectedCharacterNum]._standY;
|
||||
if (_actionVerb == kVerbWalk || _actionVerb == kVerbUse) {
|
||||
_selectedObject._locationObjectLocationNum = _locationObjectsTable[_selectedCharacterNum]._locationNum;
|
||||
_selectedObject._locationObjectLocation = _locationObjectsTable[_selectedCharacterNum]._location;
|
||||
_selectedObject._locationObjectToX = _locationObjectsTable[_selectedCharacterNum]._toX;
|
||||
_selectedObject._locationObjectToY = _locationObjectsTable[_selectedCharacterNum]._toY;
|
||||
_selectedObject._locationObjectToX2 = _locationObjectsTable[_selectedCharacterNum]._toX2;
|
||||
@ -3623,14 +3632,14 @@ void TuckerEngine::setSelectedObjectKey() {
|
||||
_selectedObject._yPos = _mousePosY;
|
||||
}
|
||||
_selectedObjectLocationMask = testLocationMask(_selectedObject._xPos, _selectedObject._yPos);
|
||||
if (!_selectedObjectLocationMask && _objectKeysLocationTable[_locationNum] == 1) {
|
||||
if (_selectedObject._yPos < _objectKeysPosYTable[_locationNum]) {
|
||||
while (!_selectedObjectLocationMask && _selectedObject._yPos < _objectKeysPosYTable[_locationNum]) {
|
||||
if (!_selectedObjectLocationMask && _objectKeysLocationTable[_location] == 1) {
|
||||
if (_selectedObject._yPos < _objectKeysPosYTable[_location]) {
|
||||
while (!_selectedObjectLocationMask && _selectedObject._yPos < _objectKeysPosYTable[_location]) {
|
||||
++_selectedObject._yPos;
|
||||
_selectedObjectLocationMask = testLocationMask(_selectedObject._xPos, _selectedObject._yPos);
|
||||
}
|
||||
} else {
|
||||
while (!_selectedObjectLocationMask && _selectedObject._yPos < _objectKeysPosYTable[_locationNum]) {
|
||||
while (!_selectedObjectLocationMask && _selectedObject._yPos < _objectKeysPosYTable[_location]) {
|
||||
--_selectedObject._yPos;
|
||||
_selectedObjectLocationMask = testLocationMask(_selectedObject._xPos, _selectedObject._yPos);
|
||||
}
|
||||
@ -3638,12 +3647,12 @@ void TuckerEngine::setSelectedObjectKey() {
|
||||
}
|
||||
if (_selectedObjectLocationMask) {
|
||||
_selectedObjectLocationMask = testLocationMaskArea(_xPosCurrent, _yPosCurrent, _selectedObject._xPos, _selectedObject._yPos);
|
||||
if (_selectedObjectLocationMask && _objectKeysPosXTable[_locationNum] > 0) {
|
||||
if (_selectedObjectLocationMask && _objectKeysPosXTable[_location] > 0) {
|
||||
_selectedObject._xDefaultPos = _selectedObject._xPos;
|
||||
_selectedObject._yDefaultPos = _selectedObject._yPos;
|
||||
_selectedObject._xPos = _objectKeysPosXTable[_locationNum];
|
||||
_selectedObject._yPos = _objectKeysPosYTable[_locationNum];
|
||||
if (_objectKeysLocationTable[_locationNum] == 1) {
|
||||
_selectedObject._xPos = _objectKeysPosXTable[_location];
|
||||
_selectedObject._yPos = _objectKeysPosYTable[_location];
|
||||
if (_objectKeysLocationTable[_location] == 1) {
|
||||
_selectedObject._xPos = _selectedObject._xDefaultPos;
|
||||
}
|
||||
}
|
||||
@ -3730,7 +3739,7 @@ void TuckerEngine::handleMouseClickOnInventoryObject() {
|
||||
break;
|
||||
case 1:
|
||||
if (_actionVerb == kVerbUse && _leftMouseButtonPressed) {
|
||||
if (_mapSequenceFlagsLocationTable[_locationNum - 1] == 1) {
|
||||
if (_mapSequenceFlagsLocationTable[_location - 1] == 1) {
|
||||
handleMapSequence();
|
||||
} else {
|
||||
_actionPosX = _xPosCurrent;
|
||||
|
@ -116,6 +116,99 @@ enum Part {
|
||||
kPartThree = 3
|
||||
};
|
||||
|
||||
enum Location {
|
||||
kLocationNone = 0,
|
||||
|
||||
kLocationHotelRoom = 1,
|
||||
kLocationBackAlley = 2,
|
||||
kLocationSeedyStreet = 3,
|
||||
kLocationBakersShop = 4,
|
||||
kLocationBakersKitchen = 5,
|
||||
kLocationStripJoint = 6,
|
||||
kLocationPoliceHQ = 7,
|
||||
kLocationPoliceCell = 8,
|
||||
kLocationMall = 9,
|
||||
kLocationFishShop = 10,
|
||||
kLocationBurgerJoint = 11,
|
||||
kLocationRecordShop = 12,
|
||||
kLocationDentist = 13,
|
||||
kLocationPlugShop = 14,
|
||||
kLocationTouristInfo = 15,
|
||||
kLocationPark = 16,
|
||||
kLocationRoystonsHomeHallway = 17,
|
||||
kLocationRoystonsHomeBoxroom = 18,
|
||||
kLocationDocks = 19,
|
||||
kLocationOutsideMuseum = 20,
|
||||
kLocationInsideMuseum = 21,
|
||||
kLocationFishingTrawler = 22,
|
||||
kLocationWarehouseCutscene = 23,
|
||||
kLocationStoreRoom = 24,
|
||||
kLocationVentSystem = 25,
|
||||
kLocationSubwayTunnel = 26,
|
||||
kLocationStrangeRoom = 27,
|
||||
kLocationTopCorridor = 28,
|
||||
kLocationSubmarineHangar = 29,
|
||||
kLocationBunkRoom = 30,
|
||||
kLocationBottomCorridor = 31,
|
||||
kLocationKitchen = 32,
|
||||
kLocationCommandCentre = 33,
|
||||
kLocationSubmarineHatch = 34,
|
||||
kLocationSubmarineWalkway = 35,
|
||||
kLocationSubmarineBridge = 36,
|
||||
kLocationSubmarineOffice = 37,
|
||||
kLocationSubmarineEngineRoom = 38,
|
||||
kLocationLuxuryApartment = 39,
|
||||
kLocationFarDocks = 40,
|
||||
kLocationAlleyway = 41,
|
||||
kLocationBasement = 42,
|
||||
kLocationTateTowerEntrance = 43,
|
||||
kLocationRooftop = 44,
|
||||
kLocationConferenceRoom = 45,
|
||||
kLocationAnteChamber = 46,
|
||||
kLocationHelipad = 47,
|
||||
kLocationCorridor = 48,
|
||||
kLocationWaitingRoom = 49,
|
||||
kLocationkLocationCorridorCutscene = 50,
|
||||
kLocationCells = 51,
|
||||
kLocationMachineRoom = 52,
|
||||
kLocationRecordShopPartThree = 53,
|
||||
kLocationPlugShopPartThree = 54,
|
||||
kLocationTouristInfoPartThree = 55,
|
||||
kLocationDentistPartThree = 56,
|
||||
kLocationFishShopPartThree = 57,
|
||||
kLocationInsideMuseumPartThree = 58,
|
||||
kLocationBakersShopPartThree = 59,
|
||||
kLocationStripJointPartThree = 60,
|
||||
kLocationParkPartThree = 61,
|
||||
kLocationDocksPartThree = 62,
|
||||
kLocationTV = 63,
|
||||
kLocationSewer = 64,
|
||||
kLocationSeedyStreetPartThree = 65,
|
||||
kLocationMallPartThree = 66,
|
||||
kLocationBurgerJointPartThree = 67,
|
||||
kLocationOutsideMuseumPartThree = 68,
|
||||
kLocation69Cutscene = 69,
|
||||
kLocationComputerScreen = 70,
|
||||
kLocationParkCutscene = 71,
|
||||
kLocationSeedyStreetCutscene = 72,
|
||||
kLocationJesusCutscene1 = 73,
|
||||
kLocationCredits = 74,
|
||||
kLocation75Cutscene = 75,
|
||||
kLocationBeachCutscene = 76,
|
||||
kLocationHospitalCutscene = 77,
|
||||
kLocation78Cutscene = 78,
|
||||
kLocationElvisCutscene = 79,
|
||||
kLocationPyramidCutscene = 80,
|
||||
kLocationCleopatraCutscene = 81,
|
||||
kLocationJesusCutscene2 = 82,
|
||||
|
||||
kLocationNewPart = 98,
|
||||
kLocationMap = 99,
|
||||
|
||||
kLocationInit = 1,
|
||||
kLocationInitDemo = 9
|
||||
};
|
||||
|
||||
struct Action {
|
||||
int _key;
|
||||
int _testFlag1Num;
|
||||
@ -212,7 +305,7 @@ struct LocationObject {
|
||||
int _xSize;
|
||||
int _ySize;
|
||||
int _textNum;
|
||||
int _locationNum;
|
||||
Location _location;
|
||||
int _toX;
|
||||
int _toY;
|
||||
int _toX2;
|
||||
@ -251,8 +344,6 @@ enum {
|
||||
kScreenHeight = 200,
|
||||
kScreenPitch = 640,
|
||||
kFadePaletteStep = 5,
|
||||
kStartupLocationDemo = 9,
|
||||
kStartupLocationGame = 1,
|
||||
kDefaultCharSpeechSoundCounter = 1,
|
||||
kMaxSoundVolume = 127,
|
||||
kLastSaveSlot = 99,
|
||||
@ -719,8 +810,8 @@ protected:
|
||||
int _flagsTable[kFlagsTableSize];
|
||||
Part _part;
|
||||
Part _currentPart;
|
||||
int _locationNum;
|
||||
int _nextLocationNum;
|
||||
Location _location;
|
||||
Location _nextLocation;
|
||||
bool _gamePaused;
|
||||
bool _gameDebug;
|
||||
bool _displayGameHints;
|
||||
@ -850,7 +941,7 @@ protected:
|
||||
int _yDefaultPos;
|
||||
int _xPos;
|
||||
int _yPos;
|
||||
int _locationObjectLocationNum;
|
||||
Location _locationObjectLocation;
|
||||
int _locationObjectToX;
|
||||
int _locationObjectToY;
|
||||
int _locationObjectToX2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user