EMI: Remember last wear chore, restore it upon entering overworld

This commit is contained in:
Dries Harnie 2013-07-29 10:02:36 +02:00
parent 71be744000
commit a5038cd57f
3 changed files with 20 additions and 1 deletions

View File

@ -1013,6 +1013,18 @@ void Actor::setMumbleChore(int chore, Costume *cost) {
_mumbleChore = Chore(cost, chore);
}
bool Actor::playLastWearChore() {
if (!_lastWearChore.isValid())
return false;
_lastWearChore.playLooping(false, 0);
return true;
}
void Actor::setLastWearChore(int chore, Costume *cost) {
_lastWearChore = Chore(cost, chore);
}
void Actor::turn(int dir) {
_walking = false;
float delta = g_grim->getPerSecond(_turnRate) * dir;

View File

@ -440,6 +440,8 @@ public:
int getTalkChore(int index) const;
Costume *getTalkCostume(int index) const;
void setMumbleChore(int choreNumber, Costume *cost);
bool playLastWearChore();
void setLastWearChore(int choreNumber, Costume *cost);
void setColormap(const char *map);
void pushCostume(const char *name);
@ -628,7 +630,7 @@ private:
Chore _talkChore[10];
int _talkAnim;
Chore _mumbleChore;
Chore _mumbleChore, _lastWearChore;
Shadow *_shadowArray;
int _activeShadowSlot;

View File

@ -84,6 +84,7 @@ void Lua_V2::PutActorInOverworld() {
Actor *actor = getactor(actorObj);
actor->setInOverworld(true);
actor->playLastWearChore();
}
void Lua_V2::RemoveActorFromOverworld() {
@ -649,6 +650,10 @@ void Lua_V2::PlayActorChore() {
}
PoolChore *chore = (PoolChore *)costume->getChore(choreName);
if (0 == strncmp("wear_", choreName, 5)) {
actor->setLastWearChore(costume->getChoreId(choreName), costume);
}
if (mode) {
costume->playChoreLooping(choreName);
} else {