int ScummEngine::getObjectOrActorXY(int object, int &x, int &y) { Actor *act; if (object < _numActors) { act = derefActorSafe(object, "getObjectOrActorXY"); if (act && act->isInCurrentRoom()) { x = act->getRealPos().x; y = act->getRealPos().y; return 0; } else return -1; } switch (whereIsObject(object)) { case WIO_NOT_FOUND: return -1; case WIO_INVENTORY: if (_objectOwnerTable[object] < _numActors) { act = derefActor(_objectOwnerTable[object], "getObjectOrActorXY(2)"); if (act && act->isInCurrentRoom()) { x = act->getRealPos().x; y = act->getRealPos().y; return 0; } } return -1; } getObjectXYPos(object, x, y); return 0; }
void ScummEngine_v0::o_loadRoomWithEgo() { Actor_v0 *a; int obj, room, x, y, dir; obj = fetchScriptByte(); room = fetchScriptByte(); a = (Actor_v0 *)derefActor(VAR(VAR_EGO), "o_loadRoomWithEgo"); //0x634F if (a->_miscflags & kActorMiscFlagFreeze) { stopObjectCode(); return; } // The original interpreter sets the actors new room X/Y to the last rooms X/Y // This fixes a problem with MM: script 158 in room 12, the 'Oomph!' script // This scripts runs before the actor position is set to the correct room entry location a->putActor(a->getPos().x, a->getPos().y, room); _egoPositioned = false; startScene(a->_room, a, obj); getObjectXYPos(obj, x, y, dir); AdjustBoxResult r = a->adjustXYToBeInBox(x, y); x = r.x; y = r.y; a->putActor(x, y, _currentRoom); camera._dest.x = camera._cur.x = a->getPos().x; setCameraAt(a->getPos().x, a->getPos().y); setCameraFollows(a); _fullRedraw = true; resetSentence(); if (x >= 0 && y >= 0) { a->startWalkActor(x, y, -1); } }
void ScummEngine_v0::o_putActorAtObject() { int obj, x, y; Actor *a; a = derefActor(getVarOrDirectByte(PARAM_1), "o_putActorAtObject"); int objId = fetchScriptByte(); if (_opcode & 0x40) obj = OBJECT_V0(objId, kObjectV0TypeBG); else obj = OBJECT_V0(objId, kObjectV0TypeFG); if (whereIsObject(obj) != WIO_NOT_FOUND) { getObjectXYPos(obj, x, y); AdjustBoxResult r = a->adjustXYToBeInBox(x, y); x = r.x; y = r.y; } else { x = 30; y = 60; } a->putActor(x, y); }