aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorGregory Montoir2004-01-16 15:03:52 +0000
committerGregory Montoir2004-01-16 15:03:52 +0000
commit3c521dc28858ef845ae0f0deae8f708fd1320421 (patch)
tree91b13473d3dc9a1a4018ce005475c5246eb12789 /queen
parent899843443f6ff6f92ea86fd0ddfbe682abf04b01 (diff)
downloadscummvm-rg350-3c521dc28858ef845ae0f0deae8f708fd1320421.tar.gz
scummvm-rg350-3c521dc28858ef845ae0f0deae8f708fd1320421.tar.bz2
scummvm-rg350-3c521dc28858ef845ae0f0deae8f708fd1320421.zip
rewritten Logic::setupJoeInRoom(), in order to only get objectData(_entryObj) when necessary
svn-id: r12434
Diffstat (limited to 'queen')
-rw-r--r--queen/logic.cpp32
-rw-r--r--queen/logic.h4
2 files changed, 18 insertions, 18 deletions
diff --git a/queen/logic.cpp b/queen/logic.cpp
index dac66f6547..56eba6566f 100644
--- a/queen/logic.cpp
+++ b/queen/logic.cpp
@@ -411,7 +411,7 @@ uint16 Logic::objectForPerson(uint16 bobNum) const {
return 0;
}
-WalkOffData *Logic::walkOffPointForObject(uint16 obj) const {
+WalkOffData *Logic::walkOffPointForObject(int16 obj) const {
uint16 i;
for (i = 1; i <= _numWalkOffs; ++i) {
if (_walkOffData[i].entryObj == obj) {
@@ -511,9 +511,8 @@ void Logic::displayRoom(uint16 room, RoomDisplayMode mode, uint16 scale, int com
_credits->nextRoom();
setupRoom(roomName(room), comPanel, inCutaway);
- ObjectData *pod = NULL;
if (mode != RDM_FADE_NOJOE) {
- pod = setupJoeInRoom(mode != RDM_FADE_JOE_XY, scale);
+ setupJoeInRoom(mode != RDM_FADE_JOE_XY, scale);
}
if (mode != RDM_NOFADE_JOE) {
_vm->update();
@@ -521,8 +520,11 @@ void Logic::displayRoom(uint16 room, RoomDisplayMode mode, uint16 scale, int com
int end = isIntroRoom(_currentRoom) ? 255 : 223;
_vm->display()->palFadeIn(0, end, _currentRoom, joe->active, joe->x, joe->y);
}
- if (pod != NULL) {
- _vm->walk()->moveJoe(0, pod->x, pod->y, inCutaway);
+ if (mode != RDM_FADE_NOJOE && joeX() != 0 && joeY() != 0) {
+ int16 jx = joeX();
+ int16 jy = joeY();
+ joePos(0, 0);
+ _vm->walk()->moveJoe(0, jx, jy, inCutaway);
}
}
@@ -604,30 +606,34 @@ void Logic::setupJoe() {
joeFacing(DIR_FRONT);
}
-ObjectData *Logic::setupJoeInRoom(bool autoPosition, uint16 scale) {
+void Logic::setupJoeInRoom(bool autoPosition, uint16 scale) {
debug(9, "Logic::setupJoeInRoom(%d, %d) joe.x=%d joe.y=%d", autoPosition, scale, _joe.x, _joe.y);
WalkOffData *pwo = NULL;
- ObjectData *pod = objectData(_entryObj);
- uint16 oldx, oldy;
+ int16 oldx, oldy;
if (!autoPosition || joeX() != 0 || joeY() != 0) {
oldx = joeX();
oldy = joeY();
+ joePos(0, 0);
} else {
+ ObjectData *pod = objectData(_entryObj);
// find the walk off point for the entry object and make
// Joe walking to that point
pwo = walkOffPointForObject(_entryObj);
if (pwo != NULL) {
oldx = pwo->x;
oldy = pwo->y;
+ // entryObj has a walk off point, then walk from there to object x,y
+ joePos(pod->x, pod->y);
} else {
// no walk off point, use object position
oldx = pod->x;
oldy = pod->y;
+ joePos(0, 0);
}
}
- debug(6, "Logic::joeSetupInRoom() - oldx=%d, oldy=%d scale=%d", oldx, oldy, scale);
+ debug(6, "Logic::setupJoeInRoom() - oldx=%d, oldy=%d scale=%d", oldx, oldy, scale);
if (scale > 0 && scale < 100) {
joeScale(scale);
@@ -645,6 +651,7 @@ ObjectData *Logic::setupJoeInRoom(bool autoPosition, uint16 scale) {
joeCutFacing(0);
} else {
// check to see which way Joe entered room
+ ObjectData *pod = objectData(_entryObj);
switch (State::findDirection(pod->state)) {
case DIR_BACK:
joeFacing(DIR_FRONT);
@@ -680,13 +687,6 @@ ObjectData *Logic::setupJoeInRoom(bool autoPosition, uint16 scale) {
joeFace();
pbs->curPos(oldx, oldy);
pbs->frameNum = 29 + FRAMES_JOE_XTRA;
- joePos(0, 0);
-
- if (pwo != NULL) {
- // entryObj has a walk off point, then walk from there to object x,y
- return pod;
- }
- return NULL;
}
uint16 Logic::joeFace() {
diff --git a/queen/logic.h b/queen/logic.h
index f2a6ffdce1..e857b2647d 100644
--- a/queen/logic.h
+++ b/queen/logic.h
@@ -83,7 +83,7 @@ public:
uint16 findBob(uint16 obj);
uint16 findFrame(uint16 obj);
uint16 objectForPerson(uint16 bobnum) const;
- WalkOffData *walkOffPointForObject(uint16 obj) const;
+ WalkOffData *walkOffPointForObject(int16 obj) const;
uint16 walkOffCount() const { return _numWalkOffs; }
WalkOffData *walkOffData(int index) const { return &_walkOffData[index]; }
@@ -138,7 +138,7 @@ public:
void setupJoe();
//! Setup Joe at the right place when entering a room
- ObjectData *setupJoeInRoom(bool autoPosition, uint16 scale);
+ void setupJoeInRoom(bool autoPosition, uint16 scale);
uint16 joeFace();
void joeGrab(int16 grabState);