diff options
author | Gregory Montoir | 2003-11-16 10:47:31 +0000 |
---|---|---|
committer | Gregory Montoir | 2003-11-16 10:47:31 +0000 |
commit | 74d8b6ef2831625ac6c84082b0a345fe5e8e711c (patch) | |
tree | 1237ff4bb00bbd425a392fb6c4f2527a2de7a88c /queen | |
parent | aed2a56e0c008966a8d9e5ce39d3b69eb50e4029 (diff) | |
download | scummvm-rg350-74d8b6ef2831625ac6c84082b0a345fe5e8e711c.tar.gz scummvm-rg350-74d8b6ef2831625ac6c84082b0a345fe5e8e711c.tar.bz2 scummvm-rg350-74d8b6ef2831625ac6c84082b0a345fe5e8e711c.zip |
fix some bugs :
- Joe being unable to grab oil during carbam scene (walking bug, when dest_pt == orig_pt)
- wrong Joe facing direction when opening plane door
updated handlePinnacleRoom() comment
svn-id: r11306
Diffstat (limited to 'queen')
-rw-r--r-- | queen/command.cpp | 4 | ||||
-rw-r--r-- | queen/logic.cpp | 49 | ||||
-rw-r--r-- | queen/walk.cpp | 41 | ||||
-rw-r--r-- | queen/walk.h | 4 |
4 files changed, 47 insertions, 51 deletions
diff --git a/queen/command.cpp b/queen/command.cpp index 8ad1135208..2374dfacda 100644 --- a/queen/command.cpp +++ b/queen/command.cpp @@ -525,7 +525,6 @@ int16 Command::makeJoeWalkTo(int16 x, int16 y, int16 objNum, const Verb &v, bool // Check to see if object is actually an exit to another // room. If so, then set up new room - ObjectData *objData = _logic->objectData(objNum); if (objData->x != 0 || objData->y != 0) { x = objData->x; @@ -550,6 +549,7 @@ int16 Command::makeJoeWalkTo(int16 x, int16 y, int16 objNum, const Verb &v, bool _logic->newRoom(0); } + debug(0, "Command::makeJoeWalkTo() - x=%d y=%d newRoom=%d", x, y, _logic->newRoom()); int16 p = 0; if (mustWalk) { @@ -1445,7 +1445,7 @@ void Command::look() { if (_selCmd.noun > 0 && _selCmd.noun <= _logic->currentRoomObjMax()) { uint16 objNum = _logic->currentRoomData() + _selCmd.noun; if (_logic->objectData(objNum)->entryObj == 0) { - if (makeJoeWalkTo(_selPosX, _selPosY, objNum, _selCmd.action, true) == -2) { // XXX inCutaway parameter + if (makeJoeWalkTo(_selPosX, _selPosY, objNum, _selCmd.action, false) == -2) { // XXX inCutaway parameter // 'I can't get close enough to have a look.' _logic->joeSpeak(13); } diff --git a/queen/logic.cpp b/queen/logic.cpp index a5929cc8df..bff4ceb4cc 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -1092,6 +1092,8 @@ uint16 Logic::roomRefreshObject(uint16 obj) { return curImage; } + debug(0, "Logic::roomRefreshObject(%X, %s)", obj, _objName[ABS(pod->name)]); + // check the object is in the current room if (pod->room != _currentRoom) { warning("Logic::roomRefreshObject() - Trying to display an object (%i=%s) that is not in room (object room=%i, current room=%i)", @@ -1620,7 +1622,7 @@ ObjectData *Logic::joeSetupInRoom(bool autoPosition, uint16 scale) { } } - debug(9, "Logic::joeSetupInRoom() - oldx=%d, oldy=%d", oldx, oldy); + debug(0, "Logic::joeSetupInRoom() - oldx=%d, oldy=%d", oldx, oldy); if (scale > 0 && scale < 100) { _joe.scale = scale; @@ -1738,10 +1740,10 @@ void Logic::joeGrabDirection(StateGrab grab, uint16 speed) { case STATE_GRAB_MID: if (_joe.facing == DIR_BACK) { - frame = 4; + frame = 6; } else if (_joe.facing == DIR_FRONT) { - frame = 6; + frame = 4; } else { frame = 2; @@ -2249,7 +2251,7 @@ void Logic::handlePinnacleRoom() { // camera does not follow Joe anymore _graphics->cameraBob(-1); - roomDisplay("m1", RDM_NOFADE_JOE, 100, 2, true); + roomDisplay(roomName(ROOM_JUNGLE_PINNACLE), RDM_NOFADE_JOE, 100, 2, true); BobSlot *joe = _graphics->bob(6); BobSlot *piton = _graphics->bob(7); @@ -2304,38 +2306,29 @@ void Logic::handlePinnacleRoom() { _input->clearMouseButton(); _newRoom = _objectData[_entryObj].room; - joe->active = piton->active = false; - _graphics->textClear(5, 5); - // There is quite a hack in original source code to handle properly this - // special room. The main problem is described in executed.c l.334-339. - // - // Below is how room switching is handled - // - // ACTION2=10; - // SUBJECT[1]=NOUN+ROOM_DATA[ROOM]; - // EXECUTE_ACTION(NO); + // Only a few commands can be triggered from this room : + // piton -> crash : 0x216 (obj=0x2a, song=3) + // piton -> floda : 0x217 (obj=0x29, song=16) + // piton -> bob : 0x219 (obj=0x2f, song=6) + // piton -> embark : 0x218 (obj=0x2c, song=7) + // piton -> jungle : 0x20B (obj=0x2b, song=3) + // piton -> amazon : 0x21A (obj=0x30, song=3) // - // None of the following commands updates gamestate/areas/objects/items : - // - // piton -> crash : 0x216 - // piton -> floda : 0x217 - // piton -> bob : 0x219 - // piton -> embark : 0x218 - // piton -> jungle : 0x20B - // - // But this list is surely not exhaustive... + // Because none of these update objects/areas/gamestate, the EXECUTE_ACTION() + // call, as the original does, is useless. All we have to do is the playsong + // call (all songs have the PLAY_BEFORE type). This way we could get rid of + // the hack described in execute.c l.334-339. // - // So basically, EXECUTE_ACTION only performs the playsong calls... // XXX if (com->song > 0) { playsong(com->song); } + joe->active = piton->active = false; + _graphics->textClear(5, 5); + // camera follows Joe again _graphics->cameraBob(0); - - // XXX COMPANEL=1; - // _display->panel(true); // cyx: to me, that's completely useless - _display->palFadeOut(0, 223, 7); + _display->palFadeOut(0, 223, ROOM_JUNGLE_PINNACLE); } diff --git a/queen/walk.cpp b/queen/walk.cpp index 36da69c4ee..6e938e41e4 100644 --- a/queen/walk.cpp +++ b/queen/walk.cpp @@ -28,7 +28,7 @@ namespace Queen { -const MovePersonData Walk::MOVE_DATA[] = { +const MovePersonData Walk::_moveData[] = { {"COMPY", -1, -6, 1, 6, 0, 0, 0, 0, 12, 12, 1, 14}, {"DEINO", -1, -8, 1, 8, 0, 0, 0, 0, 11, 11, 1, 10}, {"FAYE", -1, -6, 1, 6, 13, 18, 7, 12, 19, 22, 2, 5}, @@ -311,20 +311,20 @@ int16 Walk::joeMove(int direction, int16 endx, int16 endy, bool inCutaway) { incWalkData(oldx, oldy, endx, endy, oldPos); } else { - calc(oldPos, newPos, oldx, oldy, endx, endy); - } - - if (_walkDataCount > 0) { - animateJoePrepare(); - if(animateJoe()) { + if (calc(oldPos, newPos, oldx, oldy, endx, endy)) { + if (_walkDataCount > 0) { + animateJoePrepare(); + if(animateJoe()) { + can = -1; + } + } + } + else { + // path has been blocked, make Joe say so + _logic->joeSpeak(4); can = -1; } } - else { - // path has been blocked, make Joe say so - _logic->joeSpeak(4); - can = -1; - } _graphics->bob(0)->animating = false; // cyx: the NEW_ROOM = 0 is done in Command::grabCurrentSelection() @@ -375,10 +375,8 @@ int16 Walk::personMove(const Person *pp, int16 endx, int16 endy, uint16 curImage debug(9, "Walk::personMove(%d, %d, %d, %d, %d) - old = %d, new = %d", direction, oldx, oldy, endx, endy, oldPos, newPos); - calc(oldPos, newPos, oldx, oldy, endx, endy); - // find MovePersonData associated to Person - const MovePersonData *mpd = MOVE_DATA; + const MovePersonData *mpd = _moveData; while (mpd->name[0] != '*') { if (scumm_stricmp(mpd->name, pp->name) == 0) { break; @@ -386,9 +384,11 @@ int16 Walk::personMove(const Person *pp, int16 endx, int16 endy, uint16 curImage ++mpd; } - if (_walkDataCount > 0) { - animatePersonPrepare(mpd, direction); - animatePerson(mpd, curImage, bobNum, bankNum, direction); + if (calc(oldPos, newPos, oldx, oldy, endx, endy)) { + if (_walkDataCount > 0) { + animatePersonPrepare(mpd, direction); + animatePerson(mpd, curImage, bobNum, bankNum, direction); + } } else { can = -1; @@ -427,7 +427,7 @@ int16 Walk::personMove(const Person *pp, int16 endx, int16 endy, uint16 curImage } -void Walk::calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, int16 y) { +bool Walk::calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, int16 y) { // if newPos is outside of an AREA then traverse Y axis until an AREA is found if (newPos == 0) { @@ -442,6 +442,7 @@ void Walk::calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, i if (oldPos == newPos) { incWalkData(oldx, oldy, x, y, newPos); + return true; } else if (calcPath(oldPos, newPos)) { uint16 i; @@ -459,7 +460,9 @@ void Walk::calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, i py = y1; } incWalkData(px, py, x, y, newPos); + return true; } + return false; } diff --git a/queen/walk.h b/queen/walk.h index ca2b46a243..879e81364f 100644 --- a/queen/walk.h +++ b/queen/walk.h @@ -109,7 +109,7 @@ private: void incWalkData(int16 px, int16 py, int16 x, int16 y, uint16 area); //! compute path (and populates _walkData) from current position to the new one - void calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, int16 y); + bool calc(uint16 oldPos, uint16 newPos, int16 oldx, int16 oldy, int16 x, int16 y); WalkData _walkData[MAX_WALK_DATA]; @@ -128,7 +128,7 @@ private: Graphics *_graphics; - static const MovePersonData MOVE_DATA[]; + static const MovePersonData _moveData[]; }; |