GRIM: Make the ObjectState handling more straightforward and similar to original.

This commit is contained in:
Giulio Camuffo 2011-07-14 16:11:14 +02:00
parent 4e41869b54
commit 93001ecf1b
3 changed files with 12 additions and 11 deletions

View File

@ -930,7 +930,7 @@ void L1_SendObjectToBack() {
lua_Object param = lua_getparam(1);
if (lua_isuserdata(param) && lua_tag(param) == MKTAG('S','T','A','T')) {
ObjectState *state = getobjectstate(param);
g_grim->getCurrScene()->moveObjectStateToFirst(state);
g_grim->getCurrScene()->moveObjectStateToBack(state);
}
}
@ -938,7 +938,7 @@ void L1_SendObjectToFront() {
lua_Object param = lua_getparam(1);
if (lua_isuserdata(param) && lua_tag(param) == MKTAG('S','T','A','T')) {
ObjectState *state = getobjectstate(param);
g_grim->getCurrScene()->moveObjectStateToLast(state);
g_grim->getCurrScene()->moveObjectStateToFront(state);
}
}

View File

@ -524,7 +524,7 @@ void Scene::drawBackground() const {
}
void Scene::drawBitmaps(ObjectState::Position stage) {
for (StateList::iterator i = _states.begin(); i != _states.end(); ++i) {
for (StateList::iterator i = _states.reverse_begin(); i != _states.end(); --i) {
if ((*i)->getPos() == stage && _currSetup == _setups + (*i)->getSetupID())
(*i)->draw();
}
@ -699,12 +699,16 @@ void Scene::getSoundParameters(int *minVolume, int *maxVolume) {
*maxVolume = _maxVolume;
}
void Scene::moveObjectStateToFirst(ObjectState *s) {
void Scene::addObjectState(ObjectState *s) {
_states.push_front(s);
}
void Scene::moveObjectStateToFront(ObjectState *s) {
_states.remove(s);
_states.push_front(s);
}
void Scene::moveObjectStateToLast(ObjectState *s) {
void Scene::moveObjectStateToBack(ObjectState *s) {
_states.remove(s);
_states.push_back(s);
}

View File

@ -92,16 +92,13 @@ public:
void shrinkBoxes(float radius);
void unshrinkBoxes();
void addObjectState(ObjectState *s) {
_states.push_back(s);
}
void addObjectState(ObjectState *s);
void deleteObjectState(ObjectState *s) {
_states.remove(s);
}
void moveObjectStateToFirst(ObjectState *s);
void moveObjectStateToLast(ObjectState *s);
void moveObjectStateToFront(ObjectState *s);
void moveObjectStateToBack(ObjectState *s);
ObjectState *findState(const char *filename);