From 8ec6ed9d968ed44a4b2a67ac6652c60f31c6492f Mon Sep 17 00:00:00 2001 From: Travis Howell Date: Fri, 18 Nov 2005 14:15:03 +0000 Subject: Updates to FF path finding. svn-id: r19641 --- simon/items.cpp | 26 ++++++++++++++++---------- simon/simon.cpp | 8 ++++++++ simon/simon.h | 10 +++++++++- simon/vga.cpp | 17 ++++++++++++----- 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/simon/items.cpp b/simon/items.cpp index 70d1e332a4..b9081ec04d 100644 --- a/simon/items.cpp +++ b/simon/items.cpp @@ -1096,25 +1096,31 @@ int SimonEngine::runScript() { // Feeble opcodes case 191: - warning("STUB: script opcode 191"); if (_bitArray[5] & 0x0008) { - // Clear some variables + _PVCount1 = 0; + _GPVCount1 = 0; } else { - // Clear some other variables + _PVCount = 0; + _GPVCount = 0; } break; case 192:{ - uint a = getVarOrByte(); - uint b = getVarOrByte(); - uint c = getVarOrByte(); - uint d = getVarOrByte(); + uint8 a = getVarOrByte(); + uint8 b = getVarOrByte(); + uint8 c = getVarOrByte(); + uint8 d = getVarOrByte(); if (_bitArray[5] & 0x0008) { - // Set some variables + _pathValues1[_PVCount1++] = a; + _pathValues1[_PVCount1++] = b; + _pathValues1[_PVCount1++] = c; + _pathValues1[_PVCount1++] = d; } else { - // Set some other variables + _pathValues[_PVCount++] = a; + _pathValues[_PVCount++] = b; + _pathValues[_PVCount++] = c; + _pathValues[_PVCount++] = d; } - warning("STUB: script opcode 192 (%d, %d, %d, %d)", a, b, c, d); } break; diff --git a/simon/simon.cpp b/simon/simon.cpp index 90c5f30520..485a83e48b 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -468,6 +468,14 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst) memset(_pathFindArray, 0, sizeof(_pathFindArray)); + memset(_pathValues, 0, sizeof(_pathValues)); + _PVCount = 0; + _GPVCount = 0; + + memset(_pathValues1, 0, sizeof(_pathValues1)); + _PVCount1 = 0; + _GPVCount1 = 0; + memset(_paletteBackup, 0, sizeof(_paletteBackup)); memset(_palette, 0, sizeof(_palette)); diff --git a/simon/simon.h b/simon/simon.h index 457fb4616f..ddb4c1123b 100644 --- a/simon/simon.h +++ b/simon/simon.h @@ -379,6 +379,14 @@ protected: const uint16 *_pathFindArray[100]; + uint8 _pathValues[100]; + uint8 _PVCount; + uint8 _GPVCount; + + uint8 _pathValues1[100]; + uint8 _PVCount1; + uint8 _GPVCount1; + uint8 _paletteBackup[1024]; uint8 _palette[1024]; @@ -753,7 +761,7 @@ public: void vc79_computePosNum(); void vc80_setOverlayImage(); void vc81_setRandom(); - void vc82_pathUnk3(); + void vc82_getPathValue(); void vc83_playSoundLoop(); void vc84_stopSoundLoop(); diff --git a/simon/vga.cpp b/simon/vga.cpp index 71ded468ef..bca0b8069f 100644 --- a/simon/vga.cpp +++ b/simon/vga.cpp @@ -114,7 +114,7 @@ void SimonEngine::setupVgaOpcodes() { &SimonEngine::vc79_computePosNum, &SimonEngine::vc80_setOverlayImage, &SimonEngine::vc81_setRandom, - &SimonEngine::vc82_pathUnk3, + &SimonEngine::vc82_getPathValue, &SimonEngine::vc83_playSoundLoop, &SimonEngine::vc84_stopSoundLoop, }; @@ -2163,11 +2163,18 @@ void SimonEngine::vc81_setRandom() { writeVariable(var, _rnd.getRandomNumber(value - 1)); } -void SimonEngine::vc82_pathUnk3() { - // Set var to path position - int var = vc_read_next_word(); +void SimonEngine::vc82_getPathValue() { + uint8 val; + + uint16 var = vc_read_next_word(); + + if (vc_get_bit(88) == true) { + val = _pathValues1[_GPVCount1++]; + } else { + val = _pathValues[_GPVCount++]; + } - debug(0, "STUB: vc82_pathUnk3: var %d", var); + writeVariable(var, val); } void SimonEngine::vc83_playSoundLoop() { -- cgit v1.2.3