diff options
author | Paul Gilbert | 2007-04-22 22:42:01 +0000 |
---|---|---|
committer | Paul Gilbert | 2007-04-22 22:42:01 +0000 |
commit | 307506df9ce7537b1ecbb967fc165ac7548dfc25 (patch) | |
tree | 08a3fa8c530cd89e018ea684b5a9871664c4c459 /engines/lure | |
parent | fa99ffd26728197d2cae7adbc8722dca54c2416a (diff) | |
download | scummvm-rg350-307506df9ce7537b1ecbb967fc165ac7548dfc25.tar.gz scummvm-rg350-307506df9ce7537b1ecbb967fc165ac7548dfc25.tar.bz2 scummvm-rg350-307506df9ce7537b1ecbb967fc165ac7548dfc25.zip |
General bugfixes, added animation handlers for creating potion and freeing Goewin, and in-progress work on completing original game's action precheck code
svn-id: r26572
Diffstat (limited to 'engines/lure')
-rw-r--r-- | engines/lure/hotspots.cpp | 94 | ||||
-rw-r--r-- | engines/lure/hotspots.h | 1 | ||||
-rw-r--r-- | engines/lure/luredefs.h | 9 | ||||
-rw-r--r-- | engines/lure/res.h | 2 | ||||
-rw-r--r-- | engines/lure/scripts.cpp | 24 | ||||
-rw-r--r-- | engines/lure/scripts.h | 2 |
6 files changed, 109 insertions, 23 deletions
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index 5cf58e2ebb..1f734367fe 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -487,14 +487,26 @@ void Hotspot::setDirection(Direction dir) { // Makes the character face the given hotspot void Hotspot::faceHotspot(HotspotData *hotspot) { + Resources &res = Resources::getReference(); + Room &room = Room::getReference(); + Screen &screen = Screen::getReference(); + if (hotspot->hotspotId >= START_NONVISUAL_HOTSPOT_ID) { // Non visual hotspot setDirection(hotspot->nonVisualDirection()); } else { // Visual hotspot - int xp = x() - hotspot->startX; - int yp = y() + heightCopy() - (hotspot->startY + hotspot->heightCopy); + int xp, yp; + + HotspotOverrideData *hsEntry = res.getHotspotOverride(hotspot->hotspotId); + if (hsEntry != NULL) { + xp = x() - hsEntry->xs; + yp = y() + heightCopy() - (hsEntry->ys + hotspot->heightCopy); + } else { + xp = x() - hotspot->startX; + yp = y() + heightCopy() - (hotspot->startY + hotspot->heightCopy); + } if (ABS(yp) >= ABS(xp)) { if (yp < 0) setDirection(DOWN); @@ -506,8 +518,8 @@ void Hotspot::faceHotspot(HotspotData *hotspot) { } if (hotspotId() == PLAYER_ID) { - Room::getReference().update(); - Screen::getReference().update(); + room.update(); + screen.update(); } } @@ -819,7 +831,7 @@ HotspotPrecheckResult Hotspot::actionPrecheck(HotspotData *hotspot) { if (actionCtr() >= 6) { warning("actionCtr exceeded"); setActionCtr(0); - converse(0, 0xD); + converse(NOONE_ID, 0xD); return PC_EXCESS; } @@ -833,11 +845,12 @@ HotspotPrecheckResult Hotspot::actionPrecheck(HotspotData *hotspot) { } else { // loc_886 setActionCtr(0); - converse(0, 0xE); + converse(NOONE_ID, 0xE); return PC_FAILED; } } else { setActionCtr(1); + if ((hotspot->hotspotId >= FIRST_NONCHARACTER_ID) || ((hotspot->actionHotspotId != _hotspotId) && (hotspot->characterMode == CHARMODE_WAIT_FOR_PLAYER))) { @@ -846,15 +859,14 @@ HotspotPrecheckResult Hotspot::actionPrecheck(HotspotData *hotspot) { return PC_WAIT; } else if (hotspot->actionHotspotId != _hotspotId) { - if (fields.getField(88) == 2) { - // loc_882 - hotspot->talkGate = 0x2A; - hotspot->talkDestCharacterId = _hotspotId; - return PC_WAIT; - } else { + if (fields.getField(82) != 2) { converse(NOONE_ID, 5); setDelayCtr(4); } + + hotspot->talkGate = 0x2A; + hotspot->talkDestCharacterId = _hotspotId; + return PC_WAIT; } } @@ -1369,7 +1381,7 @@ void Hotspot::doGive(HotspotData *hotspot) { } else if (sequenceOffset == 0) { // Move item into character's inventory HotspotData *usedItem = res.getHotspot(usedId); - usedItem->roomNumber = hotspotId(); + usedItem->roomNumber = hotspot->hotspotId; } else if (sequenceOffset > 1) { showMessage(result); } @@ -1979,6 +1991,7 @@ void Hotspot::startTalk(HotspotData *charHotspot, uint16 id) { // Signal the character that they're being talked to charHotspot->talkDestCharacterId = _hotspotId; _data->talkDestCharacterId = charHotspot->hotspotId; + _data->talkGate = 0; // Set the active talk data res.setTalkStartEntry(0); @@ -2078,9 +2091,9 @@ HandlerMethodPtr HotspotTickHandlers::getHandler(uint16 procOffset) { return followerAnimHandler; case 0x7EFA: return skorlAnimHandler; - case 0x7F37: + case STANDARD_ANIM_2_TICK_PROC: return standardAnimHandler2; - case 0x7F3A: + case STANDARD_ANIM_TICK_PROC: return standardAnimHandler; case 0x7F54: return sonicRatAnimHandler; @@ -2090,6 +2103,8 @@ HandlerMethodPtr HotspotTickHandlers::getHandler(uint16 procOffset) { return playerSewerExitAnimHandler; case 0x8009: return fireAnimHandler; + case 0x80C6: + return sparkleAnimHandler; case 0x813F: return teaAnimHandler; case 0x8180: @@ -2907,6 +2922,46 @@ void HotspotTickHandlers::fireAnimHandler(Hotspot &h) { h.setOccupied(true); } +void HotspotTickHandlers::sparkleAnimHandler(Hotspot &h) { + Resources &res = Resources::getReference(); + Hotspot *player = res.getActiveHotspot(PLAYER_ID); + ValueTableData &fields = res.fieldList(); + + h.setRoomNumber(player->roomNumber()); + h.setPosition(player->x() - 14, player->y() - 10); + h.setActionCtr(h.actionCtr() + 1); + if (h.actionCtr() == 6) { + uint16 animId; + if ((fields.getField(11) == 2) || (fields.getField(28) != 0)) { + fields.setField(28, 0); + animId = PLAYER_ANIM_ID; + } else { + fields.setField(28, fields.getField(28) + 1); + animId = SELENA_ANIM_ID; + } + + player->setAnimation(animId); + } + + if (h.executeScript()) { + HotspotData *data = h.resource(); + res.deactivateHotspot(&h); + data->roomNumber = 0x1A8; + + if (fields.getField(28) != 0) { + Hotspot *ratpouch = res.getActiveHotspot(RATPOUCH_ID); + assert(ratpouch); + ratpouch->converse(NOONE_ID, 0x854, false); + + uint16 dataId = res.getCharOffset(4); + CharacterScheduleEntry *entry = res.charSchedules().getEntry(dataId); + + ratpouch->currentActions().addFront(DISPATCH_ACTION, entry, ratpouch->roomNumber()); + ratpouch->setActionCtr(0); + } + } +} + void HotspotTickHandlers::teaAnimHandler(Hotspot &h) { if (h.frameCtr() > 0) { h.decrFrameCtr(); @@ -3099,10 +3154,13 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { selectedLine, descId); // Get the response the destination character will say - if (descId != TALK_MAGIC_ID) + if (descId != TALK_MAGIC_ID) { // Set up to display the question and response in talk dialogs h.converse(talkDestCharacter, descId, false); - res.setTalkState(TALK_RESPOND_2); + res.setTalkState(TALK_RESPOND_2); + } else { + res.setTalkState(TALK_RESPOND_3); + } break; case TALK_RESPOND_2: @@ -3114,6 +3172,8 @@ void HotspotTickHandlers::talkAnimHandler(Hotspot &h) { if (res.getTalkingCharacter() != 0) return; + case TALK_RESPOND_3: + // Respond selectedLine = res.getTalkSelection(); entry = talkSelections[selectedLine-1]; diff --git a/engines/lure/hotspots.h b/engines/lure/hotspots.h index 25c8247a8e..1531c54467 100644 --- a/engines/lure/hotspots.h +++ b/engines/lure/hotspots.h @@ -69,6 +69,7 @@ private: static void droppingTorchAnimHandler(Hotspot &h); static void playerSewerExitAnimHandler(Hotspot &h); static void fireAnimHandler(Hotspot &h); + static void sparkleAnimHandler(Hotspot &h); static void teaAnimHandler(Hotspot &h); static void goewinCaptiveAnimHandler(Hotspot &h); static void prisonerAnimHandler(Hotspot &h); diff --git a/engines/lure/luredefs.h b/engines/lure/luredefs.h index 33089bdbe1..e775971cb4 100644 --- a/engines/lure/luredefs.h +++ b/engines/lure/luredefs.h @@ -31,7 +31,7 @@ namespace Lure { #define SUPPORT_FILENAME "lure.dat" #define LURE_DAT_MAJOR 1 -#define LURE_DAT_MINOR 17 +#define LURE_DAT_MINOR 18 #define LURE_DEBUG 1 @@ -231,6 +231,7 @@ enum Action { #define SACK_ID 0x40D #define PRISONER_ID 0x412 #define SID_ID 0x420 +#define OIL_BURNER_ID 0x424 #define TRANSFORM_ID 0x425 #define NELLIE_ID 0x429 #define EWAN_ID 0x436 @@ -245,10 +246,12 @@ enum Action { // Tick proc constants #define STANDARD_CHARACTER_TICK_PROC 0x4f82 -#define TALK_TICK_PROC_ID 0x8ABD #define PLAYER_TICK_PROC_ID 0x5E44 #define VOICE_TICK_PROC_ID 0x625E #define PUZZLED_TICK_PROC_ID 0x6571 +#define STANDARD_ANIM_2_TICK_PROC 0x7F37 +#define STANDARD_ANIM_TICK_PROC 0x7f3a +#define TALK_TICK_PROC_ID 0x8ABD // String constants #define STRANGER_ID 0x17A @@ -264,6 +267,8 @@ enum Action { #define BLACKSMITH_HAMMERING_ANIM_ID 0x9c11 #define EWAN_ANIM_ID 0x59E4 #define EWAN_ALT_ANIM_ID 0x59ED +#define PLAYER_ANIM_ID 0x5C80 +#define SELENA_ANIM_ID 0x5CAA #define CONVERSE_COUNTDOWN_SIZE 40 #define IDLE_COUNTDOWN_SIZE 15 diff --git a/engines/lure/res.h b/engines/lure/res.h index b2574a2c46..7ee89f57b9 100644 --- a/engines/lure/res.h +++ b/engines/lure/res.h @@ -34,7 +34,7 @@ namespace Lure { enum TalkState {TALK_NONE, TALK_START, TALK_SELECT, TALK_RESPOND, TALK_RESPONSE_WAIT, - TALK_RESPOND_2}; + TALK_RESPOND_2, TALK_RESPOND_3}; #define MAX_TALK_SELECTIONS 4 typedef TalkEntryData *TalkSelections[MAX_TALK_SELECTIONS]; diff --git a/engines/lure/scripts.cpp b/engines/lure/scripts.cpp index 6256bd018d..c12291dca5 100644 --- a/engines/lure/scripts.cpp +++ b/engines/lure/scripts.cpp @@ -57,8 +57,9 @@ void Script::activateHotspot(uint16 hotspotId, uint16 v2, uint16 v3) { void Script::setHotspotScript(uint16 hotspotId, uint16 scriptIndex, uint16 v3) { Resources &r = Resources::getReference(); uint16 offset = r.getHotspotScript(scriptIndex); - HotspotData *rsc = r.getHotspot(hotspotId); - rsc->sequenceOffset = offset; + Hotspot *hotspot = r.getActiveHotspot(hotspotId); + assert(hotspot); + hotspot->setScript(offset); } void Script::method2(uint16 v1, uint16 v2, uint16 v3) { @@ -330,6 +331,21 @@ void Script::enableHotspot(uint16 hotspotId, uint16 v2, uint16 v3) { hotspot->flags = (hotspot->flags & 0xdf) | 0x80; } +// Display a message + +void Script::displayMessage2(uint16 messageId, uint16 hotspotId, uint16 v3) { + Hotspot *hotspot = Resources::getReference().getActiveHotspot(hotspotId); + assert(hotspot); + hotspot->showMessage(messageId); +} + +void Script::startOilBurner(uint16 v1, uint16 v2, uint16 v3) { + Hotspot *hotspot = Resources::getReference().getActiveHotspot(OIL_BURNER_ID); + assert(hotspot); + hotspot->setPosition(152, hotspot->y()); + hotspot->setTickProc(STANDARD_ANIM_TICK_PROC); +} + // Transforms the player void Script::transformPlayer(uint16 v1, uint16 v2, uint16 v3) { @@ -556,7 +572,9 @@ SequenceMethodRecord scriptMethods[] = { {33, Script::cutSack}, {34, Script::increaseNumGroats}, {35, Script::enableHotspot}, - {37, Script::transformPlayer}, + {36, Script::displayMessage2}, + {37, Script::startOilBurner}, + {38, Script::transformPlayer}, {39, Script::jailClose}, {40, Script::checkDroppedDesc}, {42, Script::doorClose}, diff --git a/engines/lure/scripts.h b/engines/lure/scripts.h index 5977fc0b3e..3d742aaa6c 100644 --- a/engines/lure/scripts.h +++ b/engines/lure/scripts.h @@ -105,6 +105,8 @@ public: static void cutSack(uint16 hotspotId, uint16 v2, uint16 v3); static void increaseNumGroats(uint16 characterId, uint16 numGroats, uint16 v3); static void enableHotspot(uint16 hotspotId, uint16 v2, uint16 v3); + static void displayMessage2(uint16 messageId, uint16 hotspotId, uint16 v3); + static void startOilBurner(uint16 v1, uint16 v2, uint16 v3); static void transformPlayer(uint16 v1, uint16 v2, uint16 v3); static void jailClose(uint16 v1, uint16 v2, uint16 v3); static void checkDroppedDesc(uint16 hotspotId, uint16 v2, uint16 v3); |