EMI: Allow actors to be hidden by a call to set_wear_chore(nil).

This commit is contained in:
Joseph Jezak josejx@gentoo.org 2014-04-05 23:12:17 -04:00
parent 8d8b8c186d
commit ed44e64369
3 changed files with 17 additions and 1 deletions

View File

@ -125,6 +125,9 @@ void EMICostume::load(Common::SeekableReadStream *data) {
for (int i = 0; i < _numComponents; ++i) {
_components[i] = components[i];
}
// The wearChore is active by default
_isWearChoreActive = true;
}
void EMICostume::playChore(int num) {
@ -196,7 +199,7 @@ void EMICostume::draw() {
}
}
if (_wearChore && !drewMesh) {
if (_wearChore && !drewMesh && _isWearChoreActive) {
_wearChore->getMesh()->draw();
}
}
@ -291,4 +294,8 @@ void EMICostume::setWearChore(EMIChore *chore) {
}
}
void EMICostume::setWearChoreActive(bool isActive) {
_isWearChoreActive = isActive;
}
} // end of namespace Grim

View File

@ -71,11 +71,13 @@ public:
}
}
}
void setWearChoreActive(bool isActive);
public:
EMIChore *_wearChore;
EMISkelComponent *_emiSkel;
Common::List<Material *> _materials;
private:
bool _isWearChoreActive;
static bool compareChores(const Chore *c1, const Chore *c2);
virtual void sortPlayingChores();
Component *loadEMIComponent(Component *parent, int parentID, const char *name, Component *prevComponent);

View File

@ -705,6 +705,8 @@ void Lua_V2::PlayActorChore() {
EMIChore *chore = (EMIChore *)costume->getChore(choreName);
if (0 == strncmp("wear_", choreName, 5)) {
EMICostume *emiCostume = static_cast<EMICostume *>(costume);
emiCostume->setWearChoreActive(true);
actor->setLastWearChore(costume->getChoreId(choreName), costume);
}
@ -734,6 +736,11 @@ void Lua_V2::StopActorChores() {
return;
actor->stopAllChores(ignoreLoopingChores);
// Reset the wearChore as well
EMICostume *cost = static_cast<EMICostume *>(actor->getCurrentCostume());
if (cost != NULL)
cost->setWearChoreActive(false);
}
void Lua_V2::SetActorLighting() {