Implemented a stub of ActorToClean.

Also, added a workaround for the bug that caused manny to be unable
to go outside the sets where ActorToClean is called. A real fix would
be needed, though.
This commit is contained in:
Giulio Camuffo 2011-03-30 20:15:29 +02:00
parent 12830c5c2e
commit c39f8ac580
3 changed files with 39 additions and 1 deletions

View File

@ -59,6 +59,7 @@ Actor::Actor(const char *actorName) :
_shadowArray = new Shadow[5];
_winX1 = _winY1 = 1000;
_winX2 = _winY2 = -1000;
_toClean = false;
for (int i = 0; i < 5; i++) {
_shadowArray[i].active = false;

View File

@ -168,6 +168,8 @@ public:
}
void setHead(int joint1, int joint2, int joint3, float maxRoll, float maxPitch, float maxYaw);
bool _toClean;
private:
Common::String _name;
Common::String _setName; // The actual current set

View File

@ -765,6 +765,21 @@ static void PutActorInSet() {
if (!lua_isstring(setObj) && !lua_isnil(setObj))
return;
if (actor->_toClean) {
actor->_toClean = false;
// FIXME HACK: This hack allows manny to exit from the sets where actors are freezed
// (and though ActorToClean is called), otherwise the set will never change and manny
// will be trapped inside. I'm aware this is really ugly, but i could not come up
// with a better solution, since the bug here seems to be inside the lua scripts, and
// not in the engine. If you want to have a look, the important bits are in:
// _system.LUA, TrackManny()
// _actors.LUA, put_in_set(), freeze() and stamp()
// Be aware that is not needed for the OpenGL renderer.
lua_call("reset_doorman");
return;
}
const char *set = lua_getstring(setObj);
// FIXME verify adding actor to set
@ -891,6 +906,22 @@ static void WalkActorTo() {
actor->walkTo(destVec);
}
static void ActorToClean() {
lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKID_BE('ACTR')) {
lua_pushnil();
return;
}
Actor *actor = static_cast<Actor *>(lua_getuserdata(actorObj));
// TODO: It seems this function should load/create an image to be used in place
// of the real actor until it is put in the set again.
// For now this Actor::_toClean is used to leave the actor in the set.
actor->_toClean = true;
}
static void IsActorMoving() {
lua_Object actorObj = lua_getparam(1);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKID_BE('ACTR'))
@ -3848,7 +3879,6 @@ STUB_FUNC(SetActorClipActive)
STUB_FUNC(SetActorCollisionScale)
STUB_FUNC(SetActorCollisionMode)
STUB_FUNC(FlushControls)
STUB_FUNC(ActorToClean)
STUB_FUNC(LightMgrStartup)
STUB_FUNC(SetLightIntensity)
STUB_FUNC(SetLightPosition)
@ -4273,6 +4303,11 @@ void register_lua() {
refTextObjectPan = lua_ref(true);
lua_pushstring("background");
refTextObjectBackground = lua_ref(true);
// FIXME: see PutActorInSet
const char *func = "function reset_doorman() doorman_in_hot_box = FALSE end";
lua_pushstring(func);
lua_call("dostring");
}
int bundle_dofile(const char *filename) {