CGE2: Hopefully fix compilation for GCC

This commit is contained in:
Strangerke 2014-06-26 21:07:24 +02:00
parent 00c867f8ea
commit 014d6bd9f0
2 changed files with 6 additions and 3 deletions

View File

@ -619,7 +619,7 @@ void CGE2Engine::tick() {
void CGE2Engine::openPocket() {
for (int i = 0; i < 2; i++) {
for (int j = 0; j < kPocketMax + 1; j++) {
int ref = (int)_heroTab[i]->_pocket[j];
int ref = (int)_heroTab[i]->_downPocketId[j];
_heroTab[i]->_pocket[j] = (ref == -1) ? nullptr : _vga->_showQ->locate(ref);
}
}
@ -629,7 +629,7 @@ void CGE2Engine::closePocket() {
for (int i = 0; i < 2; i++) {
for (int j = 0; j < kPocketMax + 1; j++) {
Sprite *spr = _heroTab[i]->_pocket[j];
_heroTab[i]->_pocket[j] = (Sprite*)((spr) ? spr->_ref : -1);
_heroTab[i]->_downPocketId[j] = (spr) ? spr->_ref : -1;
}
}
}

View File

@ -41,13 +41,16 @@ struct HeroTab {
Hero *_ptr;
Sprite *_face;
Sprite *_pocket[kPocketMax + 1];
int _downPocketId[kPocketMax + 1];
int _pocPtr;
V2D *_posTab[kSceneMax];
HeroTab(CGE2Engine *vm) {
_ptr = nullptr;
_face = nullptr;
for (int i = 0; i < kPocketMax + 1; i++)
for (int i = 0; i < kPocketMax + 1; i++) {
_pocket[i] = nullptr;
_downPocketId[i] = -1;
}
_pocPtr = 0;
for (int i = 0; i < kSceneMax; i++)
_posTab[i] = nullptr;