mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
rewritten Logic::setupJoeInRoom(), in order to only get objectData(_entryObj) when necessary
svn-id: r12434
This commit is contained in:
parent
899843443f
commit
3c521dc288
@ -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() {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user