diff options
author | David Corrales | 2007-08-05 19:34:20 +0000 |
---|---|---|
committer | David Corrales | 2007-08-05 19:34:20 +0000 |
commit | 6856535010bd2fa4449bcfde1c88dc06cd46e26f (patch) | |
tree | b81a2234c2beff0312c93e039d6cafda4babeca6 /engines/lure/hotspots.cpp | |
parent | 1400d28bfb37fc94f3c44dec0a4d0cef65fb8fb7 (diff) | |
parent | ec1803f838d5efc7decf75c05a1fb4a9633751e5 (diff) | |
download | scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.tar.gz scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.tar.bz2 scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.zip |
Merged fsnode with trunk: r27971:28460
svn-id: r28462
Diffstat (limited to 'engines/lure/hotspots.cpp')
-rw-r--r-- | engines/lure/hotspots.cpp | 88 |
1 files changed, 59 insertions, 29 deletions
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index 82b4725a70..7def0be9ab 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -689,7 +689,6 @@ void Hotspot::converse(uint16 destCharacterId, uint16 messageId, bool standStill if (standStill) { setDelayCtr(_data->talkCountdown); _data->characterMode = CHARMODE_CONVERSING; - //TODO: HS[3Eh]=character_hotspot_id, HS[40h]=active_hotspot_id } } @@ -1332,7 +1331,10 @@ void Hotspot::doUse(HotspotData *hotspot) { faceHotspot(hotspot); endAction(); - // TODO: If character=3E9h, HS[-1]=28h, HS[1Fh]=50h + if (hotspotId() == RATPOUCH_ID) { + _tempDest.position.x = 40; + setFrameCtr(80); + } uint16 sequenceOffset = res.getHotspotAction(hotspot->actionsOffset, USE); @@ -1727,7 +1729,6 @@ void Hotspot::doBribe(HotspotData *hotspot) { ++tempId; // Move over entry's sequence offset } - // TODO: call to talk_setup faceHotspot(hotspot); setActionCtr(0); endAction(); @@ -1738,8 +1739,8 @@ void Hotspot::doBribe(HotspotData *hotspot) { if (sequenceOffset != 0) return; } - // TODO: talk_record_index - showMessage(sequenceOffset); + uint16 talkIndex = res.fieldList().getField(TALK_INDEX); + showMessage((talkIndex == 6) ? 0x30 : 0x29); } void Hotspot::doExamine(HotspotData *hotspot) { @@ -1811,7 +1812,7 @@ void Hotspot::npcHeySir(HotspotData *hotspot) { return; } - // TODO: Check storage of hotspot Id in data_1090/data_1091=0 + // TODO: Check storage of hotspot Id in talk_first=player/talk_second=0 // Get the npc to say "Hey Sir" to player showMessage(0x22, PLAYER_ID); @@ -2059,6 +2060,9 @@ void Hotspot::saveToStream(Common::WriteStream *stream) { stream->writeSint16LE(_destX); stream->writeSint16LE(_destY); stream->writeUint16LE(_destHotspotId); + stream->writeByte(_tempDest.counter); + stream->writeSint16LE(_tempDest.position.x); + stream->writeSint16LE(_tempDest.position.y); stream->writeUint16LE(_frameWidth); stream->writeUint16LE(_height); stream->writeUint16LE(_width); @@ -2096,6 +2100,9 @@ void Hotspot::loadFromStream(Common::ReadStream *stream) { _destX = stream->readSint16LE(); _destY = stream->readSint16LE(); _destHotspotId = stream->readUint16LE(); + _tempDest.counter = stream->readByte(); + _tempDest.position.x = stream->readSint16LE(); + _tempDest.position.y = stream->readSint16LE(); _frameWidth = stream->readUint16LE(); _height = stream->readUint16LE(); _width = stream->readUint16LE(); @@ -2227,6 +2234,7 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { RoomPathsData &paths = Resources::getReference().getRoom(h.roomNumber())->paths; PathFinder &pathFinder = h.pathFinder(); CurrentActionStack &actions = h.currentActions(); + Hotspot *player = res.getActiveHotspot(PLAYER_ID); uint16 impingingList[MAX_NUM_IMPINGING]; int numImpinging; bool bumpedPlayer; @@ -2276,8 +2284,6 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { if (numImpinging > 0) { // Scan to check if the character has bumped into player - Hotspot *player = res.getActiveHotspot(PLAYER_ID); - if (bumpedPlayer && (player->characterMode() == CHARMODE_IDLE)) { // Signal the player to move out of the way automatically player->setBlockedState(BS_INITIAL); @@ -2300,8 +2306,12 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { h.setSkipFlag(false); } - // TODO: Handling of any set Tick Script Offset, as well as certain other - // as of yet unknown hotspot flags + if (h.resource()->scriptHotspotId != 0) { + // Character bumped against another + fields.setField(USE_HOTSPOT_ID, h.resource()->scriptHotspotId); + Script::execute(h.resource()->tickScriptOffset); + h.resource()->scriptHotspotId = 0; + } debugC(ERROR_DETAILED, kLureDebugAnimations, "Hotspot standard character point 4"); if (h.pauseCtr() != 0) { @@ -2332,13 +2342,14 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { // All other character modes if (h.delayCtr() > 0) { // There is some countdown left to do - bool decrementFlag = true; + h.updateMovement(); - if (!decrementFlag) { - HotspotData *hotspot = res.getHotspot(0); // TODO: HS[50h] - decrementFlag = (hotspot->roomNumber != h.roomNumber()) ? false : + bool decrementFlag = (h.resource()->actionHotspotId != 0); + if (decrementFlag) { + HotspotData *hotspot = res.getHotspot(h.resource()->actionHotspotId); + decrementFlag = (hotspot->roomNumber != h.hotspotId()) ? false : Support::charactersIntersecting(hotspot, h.resource()); - } + } if (decrementFlag) { h.setDelayCtr(h.delayCtr() - 1); @@ -2353,12 +2364,20 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { h.pathFinder().clear(); if ((currentMode == CHARMODE_WAIT_FOR_PLAYER) || (currentMode == CHARMODE_WAIT_FOR_INTERACT)) { - // TODO: HS[33h]=0 + h.resource()->talkOverride = 0; h.showMessage(1); } return; } + /* interactHotspotId never seems to be set + if ((h.resource()->interactHotspotId != 0) && !player->currentActions().isEmpty()) { + h.setActionCtr(99); + if (!actions.isEmpty()) + actions.top().setAction(DISPATCH_ACTION); + } + */ + debugC(ERROR_DETAILED, kLureDebugAnimations, "Hotspot standard character point 6"); CurrentAction action = actions.action(); PathFinderResult pfResult; @@ -2567,7 +2586,9 @@ void HotspotTickHandlers::puzzledAnimHandler(Hotspot &h) { } void HotspotTickHandlers::roomExitAnimHandler(Hotspot &h) { - RoomExitJoinData *rec = Resources::getReference().getExitJoin(h.hotspotId()); + Resources &res = Resources::getReference(); +// ValueTableData &fields = res.fieldList(); + RoomExitJoinData *rec = res.getExitJoin(h.hotspotId()); if (!rec) return; byte *currentFrame, *destFrame; @@ -2607,7 +2628,6 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) { RoomPathsData &paths = Resources::getReference().getRoom(h.roomNumber())->paths; PathFinder &pathFinder = h.pathFinder(); CurrentActionStack &actions = h.currentActions(); - ValueTableData &fields = res.fieldList(); uint16 impingingList[MAX_NUM_IMPINGING]; int numImpinging; Action hsAction; @@ -2637,7 +2657,17 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) { return; h.setSkipFlag(false); } - // TODO: HS[58h] check + + /* interactHotspotId never seems to be set + if (h.resource()->interactHotspotId != 0) { + h.resource()->interactHotspotId = 0; + Hotspot *hotspot = res.getActiveHotspot(h.resource()->interactHotspotId); + assert(hotspot); + if ((hotspot->characterMode() != CHARMODE_WAIT_FOR_INTERACT) && + !actions.isEmpty()) + actions.top().setAction(ACTION_NONE); + } + */ if (h.pauseCtr() > 0) { debugC(ERROR_DETAILED, kLureDebugAnimations, "Pause countdown = %d", h.pauseCtr()); @@ -2668,10 +2698,10 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) { debugC(ERROR_DETAILED, kLureDebugAnimations, "Character mode = %d", h.characterMode()); h.setOccupied(false); h.setCharacterMode(CHARMODE_NONE); - if (fields.playerPendingPos().isSet) { + if (h.tempDest().counter != 0) { // Start walking to the previously set destination - fields.playerPendingPos().isSet = false; - h.setDestPosition(fields.playerPendingPos().pos.x, fields.playerPendingPos().pos.y); + h.tempDest().counter = 0; + h.setDestPosition(h.tempDest().position.x, h.tempDest().position.y); h.currentActions().addFront(START_WALKING, h.roomNumber()); h.setWalkFlag(false); } @@ -2753,9 +2783,9 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) { return; } else if (h.blockedState() != BS_NONE) { - fields.playerPendingPos().pos.x = h.destX(); - fields.playerPendingPos().pos.y = h.destY(); - fields.playerPendingPos().isSet = true; + h.tempDest().position.x = h.destX(); + h.tempDest().position.y = h.destY(); + h.tempDest().counter = 1; h.setBlockedState((BlockedState) ((int) h.blockedState() + 1)); h.setRandomDest(); return; @@ -2795,7 +2825,7 @@ void HotspotTickHandlers::playerAnimHandler(Hotspot &h) { // Walking done if (room.cursorState() == CS_BUMPED) room.setCursorState(CS_NONE); - if (fields.playerPendingPos().isSet) { + if (h.tempDest().counter != 0) { h.setCharacterMode(CHARMODE_PLAYER_WAIT); h.setDelayCtr(IDLE_COUNTDOWN_SIZE); return; @@ -4474,9 +4504,9 @@ void Support::characterChangeRoom(Hotspot &h, uint16 roomNumber, // TODO: Double-check.. is it impinging in leaving room (right now) or entering room if (checkForIntersectingCharacter(h)) { - fields.playerPendingPos().pos.x = h.destX(); - fields.playerPendingPos().pos.y = h.destY(); - fields.playerPendingPos().isSet = true; + h.tempDest().position.x = h.destX(); + h.tempDest().position.y = h.destY(); + h.tempDest().counter = 1; Room::getReference().setCursorState(CS_BUMPED); h.setActionCtr(0); h.setBlockedState((BlockedState) ((int) h.blockedState() + 1)); |