aboutsummaryrefslogtreecommitdiff
path: root/engines/tucker
diff options
context:
space:
mode:
Diffstat (limited to 'engines/tucker')
-rw-r--r--engines/tucker/console.cpp6
-rw-r--r--engines/tucker/console.h4
-rw-r--r--engines/tucker/detection.cpp4
-rw-r--r--engines/tucker/graphics.cpp36
-rw-r--r--engines/tucker/graphics.h14
-rw-r--r--engines/tucker/locations.cpp1243
-rw-r--r--engines/tucker/resource.cpp235
-rw-r--r--engines/tucker/saveload.cpp8
-rw-r--r--engines/tucker/sequences.cpp34
-rw-r--r--engines/tucker/staticres.cpp4
-rw-r--r--engines/tucker/tucker.cpp893
-rw-r--r--engines/tucker/tucker.h268
12 files changed, 1393 insertions, 1356 deletions
diff --git a/engines/tucker/console.cpp b/engines/tucker/console.cpp
index 17ba2038d0..49e0ac479f 100644
--- a/engines/tucker/console.cpp
+++ b/engines/tucker/console.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/tucker/console.h b/engines/tucker/console.h
index 6be56d5594..22f4d5803f 100644
--- a/engines/tucker/console.h
+++ b/engines/tucker/console.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/tucker/detection.cpp b/engines/tucker/detection.cpp
index e4a74f6c37..3d7859e4fd 100644
--- a/engines/tucker/detection.cpp
+++ b/engines/tucker/detection.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/tucker/graphics.cpp b/engines/tucker/graphics.cpp
index e6fb70ac16..b9c184e2bb 100644
--- a/engines/tucker/graphics.cpp
+++ b/engines/tucker/graphics.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -163,13 +163,13 @@ void Graphics::copyRect(uint8 *dst, int dstPitch, uint8 *src, int srcPitch, int
}
void Graphics::drawStringChar(uint8 *dst, int xDst, int yDst, int pitch, uint8 chr, uint8 chrColor, const uint8 *src) {
- if (chr < 32 || chr - 32 >= _charset.xCount * _charset.yCount) {
+ if (chr < 32 || chr - 32 >= _charset._xCount * _charset._yCount) {
return;
}
- const int h = MIN(_charset.charH, 200 - yDst);
- const int w = MIN(_charset.charW, pitch - xDst);
+ const int h = MIN(_charset._charH, 200 - yDst);
+ const int w = MIN(_charset._charW, pitch - xDst);
dst += yDst * pitch + xDst;
- int offset = (chr - 32) * _charset.charH * _charset.charW;
+ int offset = (chr - 32) * _charset._charH * _charset._charW;
for (int y = 0; y < h; ++y) {
for (int x = 0; x < w; ++x) {
const int color = src[offset++];
@@ -189,22 +189,22 @@ void Graphics::setCharset(CharsetType type) {
_charsetType = type;
switch (type) {
case kCharsetTypeDefault:
- _charset.charW = 10;
- _charset.charH = 10;
- _charset.xCount = 32;
- _charset.yCount = 7;
+ _charset._charW = 10;
+ _charset._charH = 10;
+ _charset._xCount = 32;
+ _charset._yCount = 7;
break;
case kCharsetTypeEng:
- _charset.charW = 10;
- _charset.charH = 8;
- _charset.xCount = 32;
- _charset.yCount = 3;
+ _charset._charW = 10;
+ _charset._charH = 8;
+ _charset._xCount = 32;
+ _charset._yCount = 3;
break;
case kCharsetTypeCredits:
- _charset.charW = 19;
- _charset.charH = 10;
- _charset.xCount = 16;
- _charset.yCount = 7;
+ _charset._charW = 19;
+ _charset._charH = 10;
+ _charset._xCount = 16;
+ _charset._yCount = 7;
break;
}
}
diff --git a/engines/tucker/graphics.h b/engines/tucker/graphics.h
index 2b4a57d65d..3e48179a30 100644
--- a/engines/tucker/graphics.h
+++ b/engines/tucker/graphics.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -34,16 +34,14 @@ enum CharsetType {
};
struct Charset {
- int charW;
- int charH;
- int xCount;
- int yCount;
+ int _charW;
+ int _charH;
+ int _xCount;
+ int _yCount;
};
class Graphics {
public:
-
-
static int encodeRLE(const uint8 *src, uint8 *dst, int w, int h);
static int encodeRAW(const uint8 *src, uint8 *dst, int w, int h);
diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp
index f6d34c295b..b5fb10c59e 100644
--- a/engines/tucker/locations.cpp
+++ b/engines/tucker/locations.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -33,8 +33,8 @@ static const int _data3UpdateLocation1_yTable[] = { 152, 8, 95 };
void TuckerEngine::execData3PreUpdate_locationNum1() {
if (_flagsTable[1] == 1) {
_flagsTable[1] = 2;
- _locationSoundsTable[3].type = 2;
- startSound(_locationSoundsTable[3].offset, 3, _locationSoundsTable[3].volume);
+ _locationSoundsTable[3]._type = 2;
+ startSound(_locationSoundsTable[3]._offset, 3, _locationSoundsTable[3]._volume);
}
_mapSequenceFlagsLocationTable[0] = (_flagsTable[1] > 0) ? 1 : 0;
if (_updateLocationCounter == 0) {
@@ -66,7 +66,7 @@ void TuckerEngine::execData3PreUpdate_locationNum1Helper1() {
}
}
if (_updateLocationFlagsTable[0] == 1 && _updateLocationCounter == 0) {
- setVolumeSound(12, _locationSoundsTable[12].volume);
+ setVolumeSound(12, _locationSoundsTable[12]._volume);
} else {
setVolumeSound(12, 0);
}
@@ -122,7 +122,7 @@ void TuckerEngine::execData3PostUpdate_locationNum1() {
if (_flagsTable[63] == 0) {
if (getRandomNumber() < 400) {
_flagsTable[63] = 1;
- startSound(_locationSoundsTable[2].offset, 2, _locationSoundsTable[2].volume);
+ startSound(_locationSoundsTable[2]._offset, 2, _locationSoundsTable[2]._volume);
}
}
_locationHeightTable[1] = (_yPosCurrent > 104) ? 60 : 0;
@@ -130,48 +130,48 @@ void TuckerEngine::execData3PostUpdate_locationNum1() {
void TuckerEngine::updateSprite_locationNum2() {
if (_flagsTable[9] == 2) {
- _spritesTable[0].state = -1;
+ _spritesTable[0]._state = -1;
return;
}
if (_flagsTable[9] == 1) {
if (_flagsTable[10] == 1) {
- _spritesTable[0].state = -1;
+ _spritesTable[0]._state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == 0) {
- _spritesTable[0].state = 4;
- _spritesTable[0].needUpdate = 1;
+ _spritesTable[0]._state = 4;
+ _spritesTable[0]._needUpdate = true;
} else {
- _spritesTable[0].needUpdate = 0;
- _spritesTable[0].state = 5;
+ _spritesTable[0]._needUpdate = false;
+ _spritesTable[0]._state = 5;
_flagsTable[10] = 1;
- _spritesTable[0].gfxBackgroundOffset = 0;
+ _spritesTable[0]._gfxBackgroundOffset = 0;
}
return;
}
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == 0) {
- _spritesTable[0].state = 3;
- _spritesTable[0].needUpdate = 1;
+ _spritesTable[0]._state = 3;
+ _spritesTable[0]._needUpdate = true;
return;
}
if (_csDataHandled) {
- _spritesTable[0].needUpdate = 0;
+ _spritesTable[0]._needUpdate = false;
if (_flagsTable[199] == 0) {
_flagsTable[199] = 1;
setCharacterAnimation(0, 0);
} else if (getRandomNumber() > 20000) {
- _spritesTable[0].state = 6;
+ _spritesTable[0]._state = 6;
} else {
- _spritesTable[0].state = 3;
- _spritesTable[0].updateDelay = 5;
+ _spritesTable[0]._state = 3;
+ _spritesTable[0]._updateDelay = 5;
}
} else {
if (_flagsTable[199] == 0) {
_flagsTable[199] = 1;
setCharacterAnimation(1, 0);
} else if (getRandomNumber() < 20000) {
- _spritesTable[0].state = 1;
- _spritesTable[0].updateDelay = 5;
+ _spritesTable[0]._state = 1;
+ _spritesTable[0]._updateDelay = 5;
} else {
- _spritesTable[0].state = 1;
+ _spritesTable[0]._state = 1;
}
}
}
@@ -199,7 +199,7 @@ void TuckerEngine::execData3PreUpdate_locationNum2() {
if (_updateLocationYPosTable2[i] > _updateLocationYMaxTable[i]) {
_updateLocationYPosTable2[i] = 0;
const int num = (getRandomNumber() < 16000) ? 2 : 3;
- startSound(_locationSoundsTable[num].offset, num, _locationSoundsTable[num].volume);
+ startSound(_locationSoundsTable[num]._offset, num, _locationSoundsTable[num]._volume);
}
} else if (getRandomNumber() > 32000) {
const int num = getRandomNumber() / 8192;
@@ -243,9 +243,9 @@ void TuckerEngine::updateSprite_locationNum3_0(int i) {
int num;
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
num = 5;
- _spritesTable[i].needUpdate = 1;
- } else if (_spritesTable[i].prevState == 5 && _spritesTable[i].animationFrame == 1) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = true;
+ } else if (_spritesTable[i]._prevState == 5 && _spritesTable[i]._animationFrame == 1) {
+ _spritesTable[i]._needUpdate = false;
int r = getRandomNumber();
if (r < 12000) {
num = 3;
@@ -256,11 +256,11 @@ void TuckerEngine::updateSprite_locationNum3_0(int i) {
}
} else {
num = 5;
- _spritesTable[i].animationFrame = 1;
- _spritesTable[i].updateDelay = 10;
+ _spritesTable[i]._animationFrame = 1;
+ _spritesTable[i]._updateDelay = 10;
}
- _spritesTable[i].state = num;
- _spritesTable[i].prevAnimationFrame = 1;
+ _spritesTable[i]._state = num;
+ _spritesTable[i]._prevAnimationFrame = true;
}
void TuckerEngine::updateSprite_locationNum3_1(int i) {
@@ -268,44 +268,44 @@ void TuckerEngine::updateSprite_locationNum3_1(int i) {
if (_flagsTable[207] == 1) {
num = -1;
} else if (_flagsTable[203] == 1) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
num = 20;
_flagsTable[203] = 2;
} else if (_flagsTable[203] == 2) {
num = 12;
} else if (_flagsTable[203] == 3) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
num = 19;
_flagsTable[203] = 0;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
if (_flagsTable[21] == 0) {
num = 7;
} else {
num = 8;
}
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
if (_csDataHandled) {
num = 6;
if (getRandomNumber() < 32000) {
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
}
- } else if (_spritesTable[i].state == 6 && _spritesTable[i].animationFrame == 1) {
+ } else if (_spritesTable[i]._state == 6 && _spritesTable[i]._animationFrame == 1) {
if (getRandomNumber() < 20000) {
num = 11;
- _spritesTable[i].defaultUpdateDelay = 5;
+ _spritesTable[i]._defaultUpdateDelay = 5;
} else {
num = 10;
}
} else {
num = 6;
- _spritesTable[i].animationFrame = 1;
- _spritesTable[i].updateDelay = 10;
+ _spritesTable[i]._animationFrame = 1;
+ _spritesTable[i]._updateDelay = 10;
}
}
- _spritesTable[i].state = num;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = num;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::updateSprite_locationNum3_2(int i) {
@@ -314,32 +314,32 @@ void TuckerEngine::updateSprite_locationNum3_2(int i) {
_flagsTable[205] = 0;
num = 18;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
num = 17;
} else if (_flagsTable[45] == 1) {
_flagsTable[45] = 2;
num = 16;
} else if (_flagsTable[45] == 2) {
num = 17;
- _spritesTable[i].updateDelay = 5;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._updateDelay = 5;
+ _spritesTable[i]._needUpdate = false;
} else if (_flagsTable[45] == 3) {
_flagsTable[45] = 0;
num = 16;
- _updateSpriteFlag2 = 1;
+ _updateSpriteFlag2 = true;
} else {
- _spritesTable[i].needUpdate = 0;
- ++_spritesTable[i].counter;
- if (_spritesTable[i].counter <= 5) {
+ _spritesTable[i]._needUpdate = false;
+ ++_spritesTable[i]._counter;
+ if (_spritesTable[i]._counter <= 5) {
num = 14;
} else {
- if (_spritesTable[i].counter > 8) {
- _spritesTable[i].counter = 0;
+ if (_spritesTable[i]._counter > 8) {
+ _spritesTable[i]._counter = 0;
}
num = 15;
}
}
- _spritesTable[i].state = num;
+ _spritesTable[i]._state = num;
}
void TuckerEngine::execData3PreUpdate_locationNum3() {
@@ -362,36 +362,36 @@ void TuckerEngine::updateSprite_locationNum4(int i) {
if (_flagsTable[9] == 2) {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
state = 1;
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
} else {
state = 2;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
}
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum4() {
if (_flagsTable[6] == 0) {
setVolumeSound(0, 0);
} else {
- setVolumeSound(0, _locationSoundsTable[0].volume);
+ setVolumeSound(0, _locationSoundsTable[0]._volume);
}
}
void TuckerEngine::updateSprite_locationNum5_0() {
- ++_spritesTable[0].counter;
- if (_spritesTable[0].counter > 100) {
- _spritesTable[0].counter = 0;
- _spritesTable[0].state = 1;
- _locationSoundsTable[1].type = 2;
- startSound(_locationSoundsTable[1].offset, 1, _locationSoundsTable[1].volume);
- } else if (_spritesTable[0].counter == 50) {
- _locationSoundsTable[1].type = 2;
- _spritesTable[0].state = 2;
- startSound(_locationSoundsTable[1].offset, 1, _locationSoundsTable[1].volume);
- } else {
- _spritesTable[0].state = -1;
+ ++_spritesTable[0]._counter;
+ if (_spritesTable[0]._counter > 100) {
+ _spritesTable[0]._counter = 0;
+ _spritesTable[0]._state = 1;
+ _locationSoundsTable[1]._type = 2;
+ startSound(_locationSoundsTable[1]._offset, 1, _locationSoundsTable[1]._volume);
+ } else if (_spritesTable[0]._counter == 50) {
+ _locationSoundsTable[1]._type = 2;
+ _spritesTable[0]._state = 2;
+ startSound(_locationSoundsTable[1]._offset, 1, _locationSoundsTable[1]._volume);
+ } else {
+ _spritesTable[0]._state = -1;
if (isSoundPlaying(1)) {
stopSound(1);
}
@@ -399,7 +399,7 @@ void TuckerEngine::updateSprite_locationNum5_0() {
}
void TuckerEngine::updateSprite_locationNum5_1(int i) {
- _spritesTable[i].state = 3;
+ _spritesTable[i]._state = 3;
}
void TuckerEngine::updateSprite_locationNum6_0(int i) {
@@ -410,29 +410,29 @@ void TuckerEngine::updateSprite_locationNum6_0(int i) {
state = 14;
} else if (_flagsTable[26] == 4 || _flagsTable[26] == 5) {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == 0) {
- _spritesTable[0].needUpdate = 1;
+ _spritesTable[0]._needUpdate = true;
state = 3;
- _spritesTable[0].counter = 0;
+ _spritesTable[0]._counter = 0;
} else if (_xPosCurrent < 370 && _flagsTable[26] == 4) {
state = 2;
- } else if (_spritesTable[0].counter == 0) {
+ } else if (_spritesTable[0]._counter == 0) {
setCharacterAnimation(0, 0);
- _updateSpriteFlag1 = 1;
- ++_spritesTable[0].counter;
+ _updateSpriteFlag1 = true;
+ ++_spritesTable[0]._counter;
return;
} else {
state = 1;
- _spritesTable[0].updateDelay = 2;
- ++_spritesTable[0].counter;
- if (_spritesTable[0].counter > 100) {
- _spritesTable[0].counter = 0;
+ _spritesTable[0]._updateDelay = 2;
+ ++_spritesTable[0]._counter;
+ if (_spritesTable[0]._counter > 100) {
+ _spritesTable[0]._counter = 0;
}
}
} else {
state = -1;
}
- _spritesTable[i].state = state;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = state;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::updateSprite_locationNum6_1(int i) {
@@ -440,18 +440,18 @@ void TuckerEngine::updateSprite_locationNum6_1(int i) {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
if (_flagsTable[209] == 1) {
state = 9;
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
} else {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 10;
}
} else {
if (getRandomNumber() < 30000 || (_csDataHandled && _xPosCurrent == 248)) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 7;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 7;
_miscSoundFxNum[0] = 3;
_miscSoundFxDelayCounter[0] = 70;
@@ -459,7 +459,7 @@ void TuckerEngine::updateSprite_locationNum6_1(int i) {
_miscSoundFxDelayCounter[1] = 25;
}
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum6_2(int i) {
@@ -467,13 +467,13 @@ void TuckerEngine::updateSprite_locationNum6_2(int i) {
if (_flagsTable[26] < 5 || _flagsTable[207] > 0) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 12;
} else {
state = 12;
- _spritesTable[i].updateDelay = 2;
+ _spritesTable[i]._updateDelay = 2;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum6() {
@@ -483,11 +483,11 @@ void TuckerEngine::execData3PreUpdate_locationNum6() {
if (_flagsTable[26] == 2) {
_currentSpriteAnimationLength = 2;
_currentSpriteAnimationFrame = 112;
- if (_spritesTable[0].xSource < 45) {
+ if (_spritesTable[0]._xSource < 45) {
_currentSpriteAnimationFrame2 = 144;
- } else if (_spritesTable[0].xSource > 80) {
+ } else if (_spritesTable[0]._xSource > 80) {
_currentSpriteAnimationFrame2 = 147;
- } else if (_spritesTable[0].xSource < 60) {
+ } else if (_spritesTable[0]._xSource < 60) {
_currentSpriteAnimationFrame2 = 145;
} else {
_currentSpriteAnimationFrame2 = 146;
@@ -500,24 +500,24 @@ void TuckerEngine::execData3PreUpdate_locationNum6Helper1() {
if (_flagsTable[26] == 1) {
if (_flagsTable[27] < 15) {
if (_flagsTable[27] == 0) {
- startSound(_locationSoundsTable[2].offset, 2, _locationSoundsTable[2].volume);
- startSound(_locationSoundsTable[1].offset, 1, _locationSoundsTable[1].volume);
+ startSound(_locationSoundsTable[2]._offset, 2, _locationSoundsTable[2]._volume);
+ startSound(_locationSoundsTable[1]._offset, 1, _locationSoundsTable[1]._volume);
}
++_flagsTable[27];
- setVolumeSound(0, _locationSoundsTable[0].volume - _flagsTable[27] * 5);
- setVolumeMusic(0, _locationMusicsTable[0].volume - _flagsTable[27] * 5);
+ setVolumeSound(0, _locationSoundsTable[0]._volume - _flagsTable[27] * 5);
+ setVolumeMusic(0, _locationMusicsTable[0]._volume - _flagsTable[27] * 5);
}
} else if (_flagsTable[26] == 3) {
if (_flagsTable[27] > 0) {
if (_flagsTable[27] == 15) {
- startSound(_locationSoundsTable[2].offset, 2, _locationSoundsTable[2].volume);
+ startSound(_locationSoundsTable[2]._offset, 2, _locationSoundsTable[2]._volume);
}
--_flagsTable[27];
- setVolumeSound(0, _locationSoundsTable[0].volume - _flagsTable[27] * 5);
- setVolumeMusic(0, _locationMusicsTable[0].volume - _flagsTable[27] * 5);
+ setVolumeSound(0, _locationSoundsTable[0]._volume - _flagsTable[27] * 5);
+ setVolumeMusic(0, _locationMusicsTable[0]._volume - _flagsTable[27] * 5);
int volume = _flagsTable[27];
- if (volume < _locationSoundsTable[1].volume) {
- volume = _locationSoundsTable[1].volume;
+ if (volume < _locationSoundsTable[1]._volume) {
+ volume = _locationSoundsTable[1]._volume;
}
setVolumeSound(1, volume);
}
@@ -538,12 +538,12 @@ void TuckerEngine::execData3PreUpdate_locationNum6Helper1() {
x2 = 15 - _flagsTable[27];
}
for (int i = 0; i < x1; ++i) {
- execData3PreUpdate_locationNum6Helper2(20 * 640 + 325 + i * 8, _data3GfxBuf + _dataTable[238].sourceOffset);
- execData3PreUpdate_locationNum6Helper2(20 * 640 + 445 - i * 8, _data3GfxBuf + _dataTable[238].sourceOffset);
+ execData3PreUpdate_locationNum6Helper2(20 * 640 + 325 + i * 8, _data3GfxBuf + _dataTable[238]._sourceOffset);
+ execData3PreUpdate_locationNum6Helper2(20 * 640 + 445 - i * 8, _data3GfxBuf + _dataTable[238]._sourceOffset);
}
for (int i = 0; i < x2; ++i) {
- execData3PreUpdate_locationNum6Helper3(20 * 640 + 325 + x1 * 8 + i * 4, _data3GfxBuf + _dataTable[238].sourceOffset);
- execData3PreUpdate_locationNum6Helper3(20 * 640 + 449 - x1 * 8 - i * 4, _data3GfxBuf + _dataTable[238].sourceOffset);
+ execData3PreUpdate_locationNum6Helper3(20 * 640 + 325 + x1 * 8 + i * 4, _data3GfxBuf + _dataTable[238]._sourceOffset);
+ execData3PreUpdate_locationNum6Helper3(20 * 640 + 449 - x1 * 8 - i * 4, _data3GfxBuf + _dataTable[238]._sourceOffset);
}
addDirtyRect(0, 20, 640, 51);
}
@@ -583,37 +583,37 @@ void TuckerEngine::execData3PostUpdate_locationNum6() {
void TuckerEngine::updateSprite_locationNum7_0(int i) {
int state;
- ++_spritesTable[i].counter;
+ ++_spritesTable[i]._counter;
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 4;
} else {
- _spritesTable[i].needUpdate = 0;
- if (_spritesTable[i].counter > 0) {
+ _spritesTable[i]._needUpdate = false;
+ if (_spritesTable[i]._counter > 0) {
state = 2;
- _spritesTable[i].counter = 0;
+ _spritesTable[i]._counter = 0;
} else {
state = 1;
}
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum7_1(int i) {
int state;
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 5;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 5;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum8_0(int i) {
- _spritesTable[i].state = (_flagsTable[28] < 20) ? -1 : 7;
+ _spritesTable[i]._state = (_flagsTable[28] < 20) ? -1 : 7;
}
void TuckerEngine::updateSprite_locationNum8_1(int i) {
@@ -622,20 +622,20 @@ void TuckerEngine::updateSprite_locationNum8_1(int i) {
state = -1;
} else if (_flagsTable[28] == 18) {
state = 6;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
} else if (_flagsTable[29] == 0) {
state = 1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == 1) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 5;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 3;
}
if (_flagsTable[28] == 19) {
_flagsTable[28] = 20;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PostUpdate_locationNum8() {
@@ -662,7 +662,7 @@ void TuckerEngine::execData3PostUpdate_locationNum8() {
_updateLocationYPosTable2[0] += 2;
if (_updateLocationYPosTable2[0] > 120) {
_updateLocationYPosTable2[0] = 0;
- startSound(_locationSoundsTable[2].offset, 2, _locationSoundsTable[2].volume);
+ startSound(_locationSoundsTable[2]._offset, 2, _locationSoundsTable[2]._volume);
}
}
if (_flagsTable[28] > 1 && _flagsTable[28] < 5) {
@@ -674,82 +674,82 @@ void TuckerEngine::execData3PostUpdate_locationNum8() {
void TuckerEngine::updateSprite_locationNum9_0(int i) {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == 0) {
- _spritesTable[i].needUpdate = 1;
- _spritesTable[i].state = 3;
+ _spritesTable[i]._needUpdate = true;
+ _spritesTable[i]._state = 3;
} else if (_updateLocationCounter2 > 0 || getRandomNumber() > 30000) {
- _spritesTable[i].state = 1;
+ _spritesTable[i]._state = 1;
if (_updateLocationCounter2 == 0) {
_updateLocationCounter2 = 6;
}
} else if (getRandomNumber() > 30000) {
- _spritesTable[i].state = 2;
- _spritesTable[i].defaultUpdateDelay = 5;
+ _spritesTable[i]._state = 2;
+ _spritesTable[i]._defaultUpdateDelay = 5;
} else {
- _spritesTable[i].state = 1;
- _spritesTable[i].animationFrame = 1;
- _spritesTable[i].updateDelay = 10;
+ _spritesTable[i]._state = 1;
+ _spritesTable[i]._animationFrame = 1;
+ _spritesTable[i]._updateDelay = 10;
}
}
void TuckerEngine::updateSprite_locationNum9_1(int i) {
- ++_spritesTable[i].counter;
- if (_spritesTable[i].counter > 10) {
- _spritesTable[i].counter = 0;
- _spritesTable[i].state = 5;
- _spritesTable[i].defaultUpdateDelay = 5;
+ ++_spritesTable[i]._counter;
+ if (_spritesTable[i]._counter > 10) {
+ _spritesTable[i]._counter = 0;
+ _spritesTable[i]._state = 5;
+ _spritesTable[i]._defaultUpdateDelay = 5;
} else {
- _spritesTable[i].state = 4;
+ _spritesTable[i]._state = 4;
}
}
void TuckerEngine::updateSprite_locationNum9_2(int i) {
- _spritesTable[i].state = 6;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = 6;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::execData3PreUpdate_locationNum9() {
if (_flagsTable[7] < 2) {
_flagsTable[7] = 2;
}
- if (_flagsTable[8] == 0 && _locationMusicsTable[0].volume != 0) {
- _locationMusicsTable[0].volume = 0;
+ if (_flagsTable[8] == 0 && _locationMusicsTable[0]._volume != 0) {
+ _locationMusicsTable[0]._volume = 0;
} else {
- _locationMusicsTable[0].volume = _xPosCurrent / 40;
+ _locationMusicsTable[0]._volume = _xPosCurrent / 40;
}
- setVolumeMusic(0, _locationMusicsTable[0].volume);
+ setVolumeMusic(0, _locationMusicsTable[0]._volume);
if (!isSoundPlaying(1) && getRandomNumber() > 32000) {
int i = getRandomNumber() / 5500 + 3;
assert(i >= 0 && i < kLocationSoundsTableSize);
- startSound(_locationSoundsTable[i].offset, i, _locationSoundsTable[i].volume);
+ startSound(_locationSoundsTable[i]._offset, i, _locationSoundsTable[i]._volume);
}
if (_flagsTable[8] == 2 && _locationMaskType == 0) {
_flagsTable[8] = 0;
- startSound(_locationSoundsTable[7].offset, 7, _locationSoundsTable[7].volume);
+ startSound(_locationSoundsTable[7]._offset, 7, _locationSoundsTable[7]._volume);
}
}
void TuckerEngine::execData3PostUpdate_locationNum9() {
- if (_spritesTable[1].state == 4) {
- if (_spritesTable[1].flipX == 1) {
+ if (_spritesTable[1]._state == 4) {
+ if (_spritesTable[1]._flipX) {
--_updateLocationXPosTable2[0];
if (_updateLocationXPosTable2[0] < -50) {
- _spritesTable[1].flipX = 0;
+ _spritesTable[1]._flipX = false;
_updateLocationXPosTable2[0] = -50;
}
} else {
++_updateLocationXPosTable2[0];
if (_updateLocationXPosTable2[0] > 500) {
- _spritesTable[1].flipX = 1;
+ _spritesTable[1]._flipX = true;
_updateLocationXPosTable2[0] = 500;
}
}
}
- _spritesTable[1].gfxBackgroundOffset = _updateLocationXPosTable2[0] + 8320;
+ _spritesTable[1]._gfxBackgroundOffset = _updateLocationXPosTable2[0] + 8320;
for (int i = 1; i < 3; ++i) {
- _spritesTable[i].colorType = 1;
- _spritesTable[i].yMaxBackground = 60;
+ _spritesTable[i]._colorType = 1;
+ _spritesTable[i]._yMaxBackground = 60;
drawSprite(i);
- _spritesTable[i].colorType = 0;
+ _spritesTable[i]._colorType = 0;
}
}
@@ -759,7 +759,7 @@ void TuckerEngine::updateSprite_locationNum10() {
if (_flagsTable[99] == 1) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == 0) {
- _spritesTable[0].needUpdate = 1;
+ _spritesTable[0]._needUpdate = true;
if (r < 26000) {
state = 1;
} else if (r < 29000) {
@@ -769,12 +769,12 @@ void TuckerEngine::updateSprite_locationNum10() {
}
} else if (_csDataHandled) {
state = 2;
- _spritesTable[0].updateDelay = 4;
+ _spritesTable[0]._updateDelay = 4;
} else {
- _spritesTable[0].needUpdate = 0;
+ _spritesTable[0]._needUpdate = false;
if (r > 26000) {
state = 5;
- _spritesTable[0].prevAnimationFrame = 1;
+ _spritesTable[0]._prevAnimationFrame = true;
} else if (r > 24000) {
state = 6;
_miscSoundFxDelayCounter[0] = 120;
@@ -783,7 +783,7 @@ void TuckerEngine::updateSprite_locationNum10() {
setCharacterAnimation(0, 0);
}
}
- _spritesTable[0].state = state;
+ _spritesTable[0]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum10() {
@@ -797,8 +797,8 @@ void TuckerEngine::execData3PreUpdate_locationNum10() {
if (_flagsTable[47] == 1 && _inventoryItemsState[26] == 1) {
_flagsTable[47] = 2;
}
- if (_spritesTable[0].state == 6 && _spritesTable[0].animationFrame == 18 && !isSoundPlaying(0)) {
- startSound(_locationSoundsTable[0].offset, 0, _locationSoundsTable[0].volume);
+ if (_spritesTable[0]._state == 6 && _spritesTable[0]._animationFrame == 18 && !isSoundPlaying(0)) {
+ startSound(_locationSoundsTable[0]._offset, 0, _locationSoundsTable[0]._volume);
}
if (_flagsTable[230] == 1 && getRandomNumber() > 32000) {
_flagsTable[230] = 0;
@@ -808,52 +808,52 @@ void TuckerEngine::execData3PreUpdate_locationNum10() {
void TuckerEngine::updateSprite_locationNum11_0(int i) {
const int r = getRandomNumber();
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
- _spritesTable[i].state = 2;
+ _spritesTable[i]._needUpdate = true;
+ _spritesTable[i]._state = 2;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
if (r > 28000) {
- _spritesTable[i].state = 3;
+ _spritesTable[i]._state = 3;
} else if (r > 20000) {
- _spritesTable[i].state = 4;
+ _spritesTable[i]._state = 4;
} else {
- _spritesTable[i].state = 3;
- _spritesTable[i].animationFrame = 1;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._state = 3;
+ _spritesTable[i]._animationFrame = 1;
+ _spritesTable[i]._updateDelay = 5;
}
}
}
void TuckerEngine::updateSprite_locationNum11_1(int i) {
if (getRandomNumber() > 20000) {
- _spritesTable[i].state = 5;
+ _spritesTable[i]._state = 5;
} else {
- _spritesTable[i].animationFrame = 14;
- _updateSpriteFlag1 = 1;
- _spritesTable[i].state = 5;
+ _spritesTable[i]._animationFrame = 14;
+ _updateSpriteFlag1 = true;
+ _spritesTable[i]._state = 5;
}
}
void TuckerEngine::updateSprite_locationNum11_2(int i) {
if (getRandomNumber() > 20000) {
- _spritesTable[i].state = 6;
+ _spritesTable[i]._state = 6;
} else {
- _spritesTable[i].animationFrame = 17;
- _spritesTable[i].state = 6;
- _updateSpriteFlag1 = 1;
+ _spritesTable[i]._animationFrame = 17;
+ _spritesTable[i]._state = 6;
+ _updateSpriteFlag1 = true;
}
}
void TuckerEngine::updateSprite_locationNum11_3(int i) {
- _spritesTable[i].state = 7;
+ _spritesTable[i]._state = 7;
}
void TuckerEngine::updateSprite_locationNum11_4(int i) {
if (getRandomNumber() > 30000 && _flagsTable[55] < 2) {
- _spritesTable[i].state = 1;
- startSound(_locationSoundsTable[6].offset, 6, _locationSoundsTable[6].volume);
+ _spritesTable[i]._state = 1;
+ startSound(_locationSoundsTable[6]._offset, 6, _locationSoundsTable[6]._volume);
} else {
- _spritesTable[i].state = -1;
+ _spritesTable[i]._state = -1;
}
}
@@ -866,10 +866,10 @@ void TuckerEngine::updateSprite_locationNum12_0(int i) {
if (_flagsTable[207] > 0) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 5;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
if (_updateLocationCounter2 < 4) {
state = 1;
} else if (_updateLocationCounter2 < 8) {
@@ -878,7 +878,7 @@ void TuckerEngine::updateSprite_locationNum12_0(int i) {
state = 4;
}
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum12_1(int i) {
@@ -891,7 +891,7 @@ void TuckerEngine::updateSprite_locationNum12_1(int i) {
} else {
state = 8;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum12() {
@@ -899,13 +899,13 @@ void TuckerEngine::execData3PreUpdate_locationNum12() {
_flagsTable[38] = 1;
}
if (_flagsTable[41] == 0) {
- if (_locationMusicsTable[0].volume != 100) {
- _locationMusicsTable[0].volume = 100;
+ if (_locationMusicsTable[0]._volume != 100) {
+ _locationMusicsTable[0]._volume = 100;
setVolumeMusic(0, 100);
}
} else {
- if (_locationMusicsTable[0].volume != 20) {
- _locationMusicsTable[0].volume = 20;
+ if (_locationMusicsTable[0]._volume != 20) {
+ _locationMusicsTable[0]._volume = 20;
setVolumeMusic(0, 20);
}
}
@@ -917,44 +917,44 @@ void TuckerEngine::updateSprite_locationNum13(int i) {
if (_flagsTable[202] == 0) {
_flagsTable[202] = 1;
state = 3;
- _spritesTable[i].stateIndex = -1;
+ _spritesTable[i]._stateIndex = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
state = 4;
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 5;
}
} else if (_flagsTable[202] == 1) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
_flagsTable[202] = 0;
state = 6;
} else {
setCharacterAnimation(0, 0);
return;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum13() {
if (_flagsTable[69] == 0) {
if (getRandomNumber() > 31000) {
_flagsTable[69] = 1;
- startSound(_locationSoundsTable[1].offset, 1, _locationSoundsTable[1].volume);
+ startSound(_locationSoundsTable[1]._offset, 1, _locationSoundsTable[1]._volume);
} else if (isSoundPlaying(1)) {
stopSound(1);
}
}
_flagsTable[8] = 2;
- if (_spritesTable[0].state == 1) {
- if (_spritesTable[0].animationFrame > 10 && _spritesTable[0].animationFrame < 20) {
+ if (_spritesTable[0]._state == 1) {
+ if (_spritesTable[0]._animationFrame > 10 && _spritesTable[0]._animationFrame < 20) {
if (!isSoundPlaying(0)) {
- startSound(_locationSoundsTable[0].offset, 0, _locationSoundsTable[0].volume);
+ startSound(_locationSoundsTable[0]._offset, 0, _locationSoundsTable[0]._volume);
}
}
}
if (isSoundPlaying(0)) {
- if (_spritesTable[0].animationFrame > 10 && _spritesTable[0].animationFrame < 20) {
+ if (_spritesTable[0]._animationFrame > 10 && _spritesTable[0]._animationFrame < 20) {
stopSound(0);
}
}
@@ -963,12 +963,12 @@ void TuckerEngine::execData3PreUpdate_locationNum13() {
void TuckerEngine::updateSprite_locationNum14(int i) {
int state = 2;
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = (getRandomNumber() < 12000) ? 1 : 3;
} else if (getRandomNumber() < 26000) {
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum14() {
@@ -988,7 +988,7 @@ void TuckerEngine::execData3PreUpdate_locationNum14() {
num = 7;
}
if (num != -1) {
- startSound(_locationSoundsTable[num].offset, num, _locationSoundsTable[num].volume);
+ startSound(_locationSoundsTable[num]._offset, num, _locationSoundsTable[num]._volume);
}
}
_locationHeightTable[14] = (_xPosCurrent < 100) ? 0 : 60;
@@ -1008,11 +1008,11 @@ void TuckerEngine::execData3PreUpdate_locationNum14() {
}
const int num = _updateLocation14ObjNum[i];
if (num > 0) {
- const int w = _dataTable[num].xSize;
- const int h = _dataTable[num].ySize;
+ const int w = _dataTable[num]._xSize;
+ const int h = _dataTable[num]._ySize;
const int x = _updateLocationXPosTable2[i] - w / 2;
const int y = _updateLocationYPosTable2[i] / 16 - h / 2;
- Graphics::decodeRLE_248(_locationBackgroundGfxBuf + y * 640 + x, _data3GfxBuf + _dataTable[num].sourceOffset, w, h, 0, 0, false);
+ Graphics::decodeRLE_248(_locationBackgroundGfxBuf + y * 640 + x, _data3GfxBuf + _dataTable[num]._sourceOffset, w, h, 0, 0, false);
addDirtyRect(x, y, w, h);
}
}
@@ -1063,41 +1063,41 @@ void TuckerEngine::execData3PostUpdate_locationNum14() {
}
void TuckerEngine::updateSprite_locationNum15_0(int i) {
- _spritesTable[i].state = -1;
+ _spritesTable[i]._state = -1;
}
void TuckerEngine::updateSprite_locationNum15_1(int i) {
int state;
int r = getRandomNumber();
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 6;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
if (r < 26000) {
state = 5;
} else if (r < 29000) {
state = 2;
- _spritesTable[i].prevAnimationFrame = 1;
+ _spritesTable[i]._prevAnimationFrame = true;
} else {
state = 4;
- _spritesTable[4].counter = 1;
+ _spritesTable[4]._counter = 1;
}
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum15_2(int i) {
- _spritesTable[i].state = 3;
- if (_spritesTable[4].counter > 0) {
- ++_spritesTable[4].counter;
- if (_spritesTable[4].counter > 6) {
- _spritesTable[4].counter = 0;
+ _spritesTable[i]._state = 3;
+ if (_spritesTable[4]._counter > 0) {
+ ++_spritesTable[4]._counter;
+ if (_spritesTable[4]._counter > 6) {
+ _spritesTable[4]._counter = 0;
} else {
- _spritesTable[i].updateDelay = 2;
+ _spritesTable[i]._updateDelay = 2;
}
} else {
- _spritesTable[i].updateDelay = 2;
+ _spritesTable[i]._updateDelay = 2;
}
}
@@ -1106,7 +1106,7 @@ void TuckerEngine::execData3PreUpdate_locationNum15() {
if (_updateLocationFadePaletteCounter > 500) {
if (!isSoundPlaying(1) && getRandomNumber() > 31000) {
const int i = getRandomNumber() / 4714;
- startSound(_locationSoundsTable[i].offset, i, _locationSoundsTable[i].volume);
+ startSound(_locationSoundsTable[i]._offset, i, _locationSoundsTable[i]._volume);
_updateLocationFadePaletteCounter = 0;
}
}
@@ -1123,21 +1123,21 @@ void TuckerEngine::updateSprite_locationNum16_0(int i) {
} else if (_flagsTable[82] == 2) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == 0) {
- if (_spritesTable[0].needUpdate == 0) {
- _spritesTable[0].needUpdate = 1;
+ if (!_spritesTable[0]._needUpdate) {
+ _spritesTable[0]._needUpdate = true;
state = 1;
} else {
state = 1;
- _spritesTable[0].animationFrame = 2;
- _updateSpriteFlag1 = 1;
+ _spritesTable[0]._animationFrame = 2;
+ _updateSpriteFlag1 = true;
}
} else if (_csDataHandled) {
- _spritesTable[0].needUpdate = 0;
+ _spritesTable[0]._needUpdate = false;
state = 4;
- _spritesTable[0].updateDelay = 5;
+ _spritesTable[0]._updateDelay = 5;
} else if (r < 30000) {
state = 4;
- _spritesTable[0].updateDelay = 5;
+ _spritesTable[0]._updateDelay = 5;
} else if (r < 31000) {
state = 4;
if (_xPosCurrent < 300) {
@@ -1149,7 +1149,7 @@ void TuckerEngine::updateSprite_locationNum16_0(int i) {
} else {
state = 6;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum16_1(int i) {
@@ -1164,18 +1164,18 @@ void TuckerEngine::updateSprite_locationNum16_1(int i) {
} else if (_flagsTable[60] == 0) {
state = 10;
if (isSoundPlaying(1)) {
- _locationSoundsTable[1].type = 2;
- startSound(_locationSoundsTable[1].offset, 1, _locationSoundsTable[1].volume);
+ _locationSoundsTable[1]._type = 2;
+ startSound(_locationSoundsTable[1]._offset, 1, _locationSoundsTable[1]._volume);
}
} else {
state = 9;
if (isSoundPlaying(0)) {
- _locationSoundsTable[0].type = 2;
- startSound(_locationSoundsTable[0].offset, 0, _locationSoundsTable[0].volume);
+ _locationSoundsTable[0]._type = 2;
+ startSound(_locationSoundsTable[0]._offset, 0, _locationSoundsTable[0]._volume);
}
}
- _spritesTable[i].state = state;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = state;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::updateSprite_locationNum16_2(int i) {
@@ -1183,27 +1183,27 @@ void TuckerEngine::updateSprite_locationNum16_2(int i) {
if (_flagsTable[78] == 0) {
if (_flagsTable[60] == 1 && _flagsTable[61] == 1) {
_flagsTable[78] = 1;
- startSound(_locationSoundsTable[5].offset, 5, _locationSoundsTable[5].volume);
+ startSound(_locationSoundsTable[5]._offset, 5, _locationSoundsTable[5]._volume);
state = 7;
}
} else if (_flagsTable[78] == 1) {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 8;
} else {
if (getRandomNumber() > 32000) {
state = 7;
} else if (getRandomNumber() > 10000) {
state = 13;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
} else {
state = 13;
}
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
}
}
- _spritesTable[i].state = state;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = state;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::execData3PreUpdate_locationNum16() {
@@ -1218,26 +1218,26 @@ void TuckerEngine::updateSprite_locationNum17() {
} else if (_flagsTable[82] == 2) {
_flagsTable[82] = 3;
_disableCharactersPath = true;
- _spritesTable[0].gfxBackgroundOffset = 100;
+ _spritesTable[0]._gfxBackgroundOffset = 100;
state = 1;
- _spritesTable[0].backgroundOffset = -1;
- } else if (_spritesTable[0].gfxBackgroundOffset < -160) {
+ _spritesTable[0]._backgroundOffset = -1;
+ } else if (_spritesTable[0]._gfxBackgroundOffset < -160) {
state = -1;
} else {
state = 1;
- _spritesTable[0].yMaxBackground = 0;
- _spritesTable[0].colorType = 1;
+ _spritesTable[0]._yMaxBackground = 0;
+ _spritesTable[0]._colorType = 1;
}
- _spritesTable[0].state = state;
+ _spritesTable[0]._state = state;
}
void TuckerEngine::updateSprite_locationNum18() {
int state;
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == 0) {
- _spritesTable[0].needUpdate = 1;
+ _spritesTable[0]._needUpdate = true;
state = 2;
} else {
- _spritesTable[0].needUpdate = 0;
+ _spritesTable[0]._needUpdate = false;
state = 1;
const int r = getRandomNumber();
if (r > 31000) {
@@ -1246,54 +1246,54 @@ void TuckerEngine::updateSprite_locationNum18() {
state = 4;
}
}
- _spritesTable[0].gfxBackgroundOffset = 0;
- _spritesTable[0].backgroundOffset = 0;
- _spritesTable[0].state = state;
+ _spritesTable[0]._gfxBackgroundOffset = 0;
+ _spritesTable[0]._backgroundOffset = 0;
+ _spritesTable[0]._state = state;
}
void TuckerEngine::updateSprite_locationNum19_0(int i) {
int state;
if (_flagsTable[206] == 1) {
state = 7;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
_flagsTable[206] = 0;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- ++_spritesTable[i].counter;
- _spritesTable[i].needUpdate = 1;
- if (_spritesTable[i].counter > 10) {
- _spritesTable[i].counter = 0;
+ ++_spritesTable[i]._counter;
+ _spritesTable[i]._needUpdate = true;
+ if (_spritesTable[i]._counter > 10) {
+ _spritesTable[i]._counter = 0;
state = 2;
} else {
state = 1;
}
} else {
- _spritesTable[i].needUpdate = 0;
- if (_spritesTable[i].counter > 10) {
- _spritesTable[i].counter = 0;
+ _spritesTable[i]._needUpdate = false;
+ if (_spritesTable[i]._counter > 10) {
+ _spritesTable[i]._counter = 0;
}
- if (_spritesTable[i].counter == 2) {
+ if (_spritesTable[i]._counter == 2) {
state = 4;
- _spritesTable[i].prevAnimationFrame = 1;
- } else if (_spritesTable[i].counter == 5) {
+ _spritesTable[i]._prevAnimationFrame = true;
+ } else if (_spritesTable[i]._counter == 5) {
state = 5;
- _spritesTable[i].prevAnimationFrame = 1;
+ _spritesTable[i]._prevAnimationFrame = true;
} else {
state = 5;
- _spritesTable[i].updateDelay = 6;
+ _spritesTable[i]._updateDelay = 6;
}
}
- _spritesTable[i].state = state;
- _spritesTable[i].prevAnimationFrame = 1;
+ _spritesTable[i]._state = state;
+ _spritesTable[i]._prevAnimationFrame = true;
}
void TuckerEngine::updateSprite_locationNum19_1(int i) {
- _spritesTable[i].state = 9;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = 9;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::updateSprite_locationNum19_2(int i) {
- _spritesTable[i].gfxBackgroundOffset = 320;
- _spritesTable[i].state = -1;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = -1;
}
void TuckerEngine::updateSprite_locationNum19_3(int i) {
@@ -1313,36 +1313,36 @@ void TuckerEngine::updateSprite_locationNum21() {
} else if (_flagsTable[58] == 3) {
state = 6;
_flagsTable[58] = 4;
- _locationSoundsTable[0].volume = 60;
- _locationSoundsTable[5].volume = 60;
+ _locationSoundsTable[0]._volume = 60;
+ _locationSoundsTable[5]._volume = 60;
} else if (_flagsTable[58] == 4) {
state = 7;
- _locationSoundsTable[4].volume = 60;
+ _locationSoundsTable[4]._volume = 60;
} else if (_flagsTable[59] == 4) {
- _spritesTable[0].needUpdate = 1;
+ _spritesTable[0]._needUpdate = true;
_flagsTable[59] = 2;
state = 2;
setVolumeSound(2, 0);
} else if (_flagsTable[59] == 3) {
_flagsTable[59] = 0;
state = 4;
- setVolumeSound(2, _locationSoundsTable[2].volume);
+ setVolumeSound(2, _locationSoundsTable[2]._volume);
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == 0) {
- _spritesTable[0].needUpdate = 1;
+ _spritesTable[0]._needUpdate = true;
state = 3;
} else if (_flagsTable[59] == 2) {
- _spritesTable[0].needUpdate = 0;
+ _spritesTable[0]._needUpdate = false;
state = 3;
- _spritesTable[0].updateDelay = 5;
+ _spritesTable[0]._updateDelay = 5;
} else if (_flagsTable[15] == 1) {
state = 3;
- _spritesTable[0].updateDelay = 5;
+ _spritesTable[0]._updateDelay = 5;
} else {
- _spritesTable[0].needUpdate = 0;
+ _spritesTable[0]._needUpdate = false;
state = 1;
}
- _spritesTable[0].state = state;
- _spritesTable[0].gfxBackgroundOffset = 320;
+ _spritesTable[0]._state = state;
+ _spritesTable[0]._gfxBackgroundOffset = 320;
}
void TuckerEngine::execData3PreUpdate_locationNum21() {
@@ -1351,7 +1351,7 @@ void TuckerEngine::execData3PreUpdate_locationNum21() {
_pendingActionDelay = 0;
_flagsTable[59] = 1;
_nextAction = 2;
- _csDataLoaded = 0;
+ _csDataLoaded = false;
}
if (_flagsTable[58] > 0 && !isSoundPlaying(0)) {
const int r = getRandomNumber();
@@ -1364,17 +1364,17 @@ void TuckerEngine::execData3PreUpdate_locationNum21() {
} else {
num = 5;
}
- startSound(_locationSoundsTable[num].offset, num, _locationSoundsTable[num].volume);
+ startSound(_locationSoundsTable[num]._offset, num, _locationSoundsTable[num]._volume);
}
}
- if (_spritesTable[0].state == 6) {
- if (_spritesTable[0].animationFrame < 18) {
- _spritesTable[0].gfxBackgroundOffset = 320 + _spritesTable[0].animationFrame * 638;
+ if (_spritesTable[0]._state == 6) {
+ if (_spritesTable[0]._animationFrame < 18) {
+ _spritesTable[0]._gfxBackgroundOffset = 320 + _spritesTable[0]._animationFrame * 638;
} else {
- _spritesTable[0].gfxBackgroundOffset = 11840 - _spritesTable[0].animationFrame * 2;
+ _spritesTable[0]._gfxBackgroundOffset = 11840 - _spritesTable[0]._animationFrame * 2;
}
} else {
- _spritesTable[0].gfxBackgroundOffset = 320;
+ _spritesTable[0]._gfxBackgroundOffset = 320;
}
if (_inventoryItemsState[19] > 0) {
_flagsTable[43] = 1;
@@ -1397,20 +1397,20 @@ void TuckerEngine::execData3PreUpdate_locationNum22() {
}
if (_flagsTable[210] < 2 && !_csDataHandled && _flagsTable[54] == 1) {
_nextAction = 25;
- _csDataLoaded = 0;
+ _csDataLoaded = false;
_flagsTable[210] = 2;
}
}
void TuckerEngine::updateSprite_locationNum22() {
if (_flagsTable[207] == 1) {
- _spritesTable[0].state = -1;
+ _spritesTable[0]._state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == 0) {
- _spritesTable[0].needUpdate = 1;
- _spritesTable[0].state = 2;
+ _spritesTable[0]._needUpdate = true;
+ _spritesTable[0]._state = 2;
} else {
- _spritesTable[0].needUpdate = 0;
- _spritesTable[0].state = 1;
+ _spritesTable[0]._needUpdate = false;
+ _spritesTable[0]._state = 1;
}
}
@@ -1421,37 +1421,37 @@ void TuckerEngine::updateSprite_locationNum23_0(int i) {
} else {
state = -1;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum23_1(int i) {
int state;
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 14;
} else if (getRandomNumber() < 30000) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 25;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 13;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum23_2(int i) {
int state = 0;
if (_flagsTable[210] == 0) {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 6;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = (getRandomNumber() < 25000) ? 4 : 5;
}
} else if (_flagsTable[210] == 1) {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
if (_flagsTable[211] == 10) {
state = 34;
} else if (_flagsTable[211] == 0) {
@@ -1461,7 +1461,7 @@ void TuckerEngine::updateSprite_locationNum23_2(int i) {
state = 31;
}
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
if (_flagsTable[211] == 1) {
state = 32;
_flagsTable[211] = 0;
@@ -1471,10 +1471,10 @@ void TuckerEngine::updateSprite_locationNum23_2(int i) {
}
} else if (_flagsTable[210] == 2) {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 33;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
if (_flagsTable[212] == 0) {
state = 3;
_flagsTable[212] = 1;
@@ -1488,7 +1488,7 @@ void TuckerEngine::updateSprite_locationNum23_2(int i) {
} else {
state = 24;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum23_3(int i) {
@@ -1496,13 +1496,13 @@ void TuckerEngine::updateSprite_locationNum23_3(int i) {
if (_flagsTable[210] == 0 || _flagsTable[210] == 2) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 8;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 9;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum24_0(int i) {
@@ -1512,40 +1512,40 @@ void TuckerEngine::updateSprite_locationNum24_0(int i) {
state = 5;
} else if (_flagsTable[103] == 0) {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 2;
} else {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 1;
if (getRandomNumber() < 30000) {
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
}
}
} else if (_flagsTable[103] == 1 || _flagsTable[103] == 3) {
state = -1;
} else {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 4;
} else {
if (getRandomNumber() < 30000) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 6;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 6;
}
}
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum24_1(int i) {
if (_flagsTable[103] > 1) {
- _spritesTable[i].state = 3;
+ _spritesTable[i]._state = 3;
} else {
- _spritesTable[i].state = -1;
+ _spritesTable[i]._state = -1;
}
}
@@ -1554,11 +1554,11 @@ void TuckerEngine::updateSprite_locationNum24_2(int i) {
if (_flagsTable[214] > 1) {
state = -1;
} else if (_flagsTable[214] == 1) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
_flagsTable[214] = 2;
state = 9;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
if (_flagsTable[213] == 1) {
state = 10;
} else if (_flagsTable[213] == 2) {
@@ -1567,10 +1567,10 @@ void TuckerEngine::updateSprite_locationNum24_2(int i) {
state = 8;
}
} else {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 7;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum24_3(int i) {
@@ -1585,18 +1585,18 @@ void TuckerEngine::updateSprite_locationNum24_3(int i) {
} else {
state = 11;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum24() {
- _characterPrevBackFrontFacing = 0;
+ _characterPrevBackFrontFacing = false;
if (_flagsTable[112] == 0) {
_yPosCurrent = 132;
_xPosCurrent = 112;
} else if (_inventoryItemsState[2] == 1 && _inventoryItemsState[11] == 1 && _flagsTable[156] == 1 && _flagsTable[145] == 3) {
_flagsTable[156] = 2;
_nextAction = 61;
- _csDataLoaded = 0;
+ _csDataLoaded = false;
}
if (_flagsTable[103] > 0 && (_inventoryItemsState[2] > 0 || _inventoryItemsState[11] > 0 || _flagsTable[156] > 0 || _flagsTable[145] == 3) && _flagsTable[217] == 0) {
_flagsTable[217] = 1;
@@ -1619,9 +1619,9 @@ void TuckerEngine::updateSprite_locationNum26_0(int i) {
if (_flagsTable[125] > 0 && _flagsTable[125] < 300) {
_flagsTable[126] = 1;
}
- _spritesTable[i].gfxBackgroundOffset = _flagsTable[125];
- _spritesTable[i].state = 1;
- _spritesTable[i].colorType = 99;
+ _spritesTable[i]._gfxBackgroundOffset = _flagsTable[125];
+ _spritesTable[i]._state = 1;
+ _spritesTable[i]._colorType = 99;
}
void TuckerEngine::updateSprite_locationNum26_1(int i) {
@@ -1630,23 +1630,23 @@ void TuckerEngine::updateSprite_locationNum26_1(int i) {
state = -1;
} else if (_flagsTable[125] > 299) {
state = 2;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
} else {
state = 2;
}
- _spritesTable[i].gfxBackgroundOffset = _flagsTable[125];
- _spritesTable[i].colorType = 1;
- _spritesTable[i].state = state;
+ _spritesTable[i]._gfxBackgroundOffset = _flagsTable[125];
+ _spritesTable[i]._colorType = 1;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum26() {
- _characterPrevBackFrontFacing = 1;
- _spritesTable[1].gfxBackgroundOffset = _flagsTable[125];
- _spritesTable[0].gfxBackgroundOffset = _flagsTable[125];
+ _characterPrevBackFrontFacing = true;
+ _spritesTable[1]._gfxBackgroundOffset = _flagsTable[125];
+ _spritesTable[0]._gfxBackgroundOffset = _flagsTable[125];
if (_flagsTable[125] > 0 && _flagsTable[125] < 300) {
if (!isSoundPlaying(5)) {
- startSound(_locationSoundsTable[5].offset, 5, _locationSoundsTable[5].volume);
- startSound(_locationSoundsTable[6].offset, 6, _locationSoundsTable[6].volume);
+ startSound(_locationSoundsTable[5]._offset, 5, _locationSoundsTable[5]._volume);
+ startSound(_locationSoundsTable[6]._offset, 6, _locationSoundsTable[6]._volume);
}
++_flagsTable[125];
_flagsTable[126] = 1;
@@ -1656,7 +1656,7 @@ void TuckerEngine::execData3PreUpdate_locationNum26() {
stopSound(6);
}
}
- if (_panelLockedFlag == 0) {
+ if (!_panelLockedFlag) {
if (_xPosCurrent > 207 && _xPosCurrent < 256) {
_objectKeysLocationTable[26] = 0;
_objectKeysPosXTable[26] = 260;
@@ -1674,21 +1674,21 @@ void TuckerEngine::updateSprite_locationNum27(int i) {
state = 1;
_flagsTable[155] = 4;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 2;
} else if (getRandomNumber() < 30000) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 3;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 3;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum27() {
- _characterPrevBackFrontFacing = 0;
+ _characterPrevBackFrontFacing = false;
}
void TuckerEngine::execData3PostUpdate_locationNum27() {
@@ -1701,36 +1701,36 @@ void TuckerEngine::updateSprite_locationNum28_0(int i) {
int state;
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
state = 4;
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
} else {
- _spritesTable[i].needUpdate = 0;
- ++_spritesTable[i].counter;
- if (_spritesTable[i].counter > 30) {
- _spritesTable[i].counter = 0;
+ _spritesTable[i]._needUpdate = false;
+ ++_spritesTable[i]._counter;
+ if (_spritesTable[i]._counter > 30) {
+ _spritesTable[i]._counter = 0;
}
if (_flagsTable[86] == 1) {
- if (_spritesTable[i].counter == 16 || _spritesTable[i].counter == 27) {
+ if (_spritesTable[i]._counter == 16 || _spritesTable[i]._counter == 27) {
state = 3;
} else {
state = 3;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
}
} else {
- if (_spritesTable[i].counter == 5 || _spritesTable[i].counter == 11) {
+ if (_spritesTable[i]._counter == 5 || _spritesTable[i]._counter == 11) {
state = 5;
- } else if (_spritesTable[i].counter == 16 || _spritesTable[i].counter == 27) {
+ } else if (_spritesTable[i]._counter == 16 || _spritesTable[i]._counter == 27) {
state = 6;
} else {
state = 6;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
}
}
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum28_1(int i) {
- _spritesTable[i].state = (_flagsTable[86] == 1) ? 1 : -1;
+ _spritesTable[i]._state = (_flagsTable[86] == 1) ? 1 : -1;
}
void TuckerEngine::updateSprite_locationNum28_2(int i) {
@@ -1741,14 +1741,14 @@ void TuckerEngine::updateSprite_locationNum28_2(int i) {
} else {
state = -1;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum28() {
if (_flagsTable[86] == 0 && _xPosCurrent > 265 && _nextAction == 0) {
- _panelLockedFlag = 0;
+ _panelLockedFlag = false;
_nextAction = 21;
- _csDataLoaded = 0;
+ _csDataLoaded = false;
_pendingActionDelay = 0;
_pendingActionIndex = 0;
_currentActionVerb = 0;
@@ -1762,21 +1762,21 @@ void TuckerEngine::execData3PostUpdate_locationNum28() {
}
void TuckerEngine::updateSprite_locationNum29_0(int i) {
- _spritesTable[i].state = (getRandomNumber() < 32000) ? -1 : 2;
+ _spritesTable[i]._state = (getRandomNumber() < 32000) ? -1 : 2;
}
void TuckerEngine::updateSprite_locationNum29_1(int i) {
int state = -1;
if (getRandomNumber() >= 32000) {
state = 1;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum29_2(int i) {
- _spritesTable[i].state = 3;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = 3;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::execData3PreUpdate_locationNum29() {
@@ -1797,22 +1797,22 @@ void TuckerEngine::execData3PreUpdate_locationNum29() {
}
_system->getPaletteManager()->setPalette(scrollPal, 118, 5);
if (_flagsTable[143] == 1) {
- _locationObjectsTable[2].xPos = 999;
- _locationObjectsTable[3].xPos = 187;
+ _locationObjectsTable[2]._xPos = 999;
+ _locationObjectsTable[3]._xPos = 187;
} else {
- _locationObjectsTable[2].xPos = 187;
- _locationObjectsTable[3].xPos = 999;
+ _locationObjectsTable[2]._xPos = 187;
+ _locationObjectsTable[3]._xPos = 999;
}
}
}
void TuckerEngine::updateSprite_locationNum30_34(int i) {
- _spritesTable[i].state = i + 1;
+ _spritesTable[i]._state = i + 1;
}
void TuckerEngine::execData3PreUpdate_locationNum30() {
if (!isSoundPlaying(1) && getRandomNumber() > 32500) {
- startSound(_locationSoundsTable[1].offset, 1, _locationSoundsTable[1].volume);
+ startSound(_locationSoundsTable[1]._offset, 1, _locationSoundsTable[1]._volume);
}
}
@@ -1829,7 +1829,7 @@ void TuckerEngine::execData3PreUpdate_locationNum31() {
}
void TuckerEngine::execData3PreUpdate_locationNum32() {
- if (_spritesTable[0].state == 12 && _spritesTable[0].animationFrame < 22) {
+ if (_spritesTable[0]._state == 12 && _spritesTable[0]._animationFrame < 22) {
_flagsTable[113] = 1;
} else {
_flagsTable[113] = 0;
@@ -1843,16 +1843,16 @@ void TuckerEngine::execData3PostUpdate_locationNum32() {
}
void TuckerEngine::updateSprite_locationNum31_0(int i) {
- _spritesTable[i].state = (getRandomNumber() < 32000) ? 3 : 1;
+ _spritesTable[i]._state = (getRandomNumber() < 32000) ? 3 : 1;
}
void TuckerEngine::updateSprite_locationNum31_1(int i) {
- _spritesTable[i].state = (_flagsTable[86] == 1) ? 2 : -1;
+ _spritesTable[i]._state = (_flagsTable[86] == 1) ? 2 : -1;
}
void TuckerEngine::updateSprite_locationNum32_0(int i) {
static const uint8 stateTable[] = { 12, 1, 11, 1, 11, 2, 1, 5, 5, 11, 1, 5, 5, 5 };
- ++_spritesTable[i].counter;
+ ++_spritesTable[i]._counter;
if (_flagsTable[123] == 2) {
_flagsTable[123] = 0;
}
@@ -1862,42 +1862,42 @@ void TuckerEngine::updateSprite_locationNum32_0(int i) {
_flagsTable[222] = 2;
} else if (_flagsTable[222] == 2) {
state = 19;
- _spritesTable[i].animationFrame = 23;
- _updateSpriteFlag1 = 1;
+ _spritesTable[i]._animationFrame = 23;
+ _updateSpriteFlag1 = true;
} else if (_flagsTable[123] == 1) {
state = 17;
_flagsTable[123] = 2;
} else if (_flagsTable[222] == 3) {
state = 18;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 4;
} else if (_csDataHandled) {
state = 5;
} else {
- _spritesTable[i].needUpdate = 0;
- if (_spritesTable[i].counter > 13) {
- _spritesTable[i].counter = 0;
+ _spritesTable[i]._needUpdate = false;
+ if (_spritesTable[i]._counter > 13) {
+ _spritesTable[i]._counter = 0;
}
- state = stateTable[_spritesTable[i].counter];
+ state = stateTable[_spritesTable[i]._counter];
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum33_0(int i) {
int state = 5;
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 7;
} else if (_flagsTable[87] == 1) {
state = 8;
} else if (_flagsTable[222] == 5) {
state = 4;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = (getRandomNumber() < 30000) ? 5 : 6;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum33_1(int i) {
@@ -1909,7 +1909,7 @@ void TuckerEngine::updateSprite_locationNum33_1(int i) {
} else {
state = 1;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum33_2(int i) {
@@ -1921,37 +1921,37 @@ void TuckerEngine::updateSprite_locationNum33_2(int i) {
} else {
state = 9;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum33() {
if (_xPosCurrent < 90) {
if (_flagsTable[105] == 0) {
_flagsTable[105] = 3;
- startSound(_locationSoundsTable[5].offset, 5, _locationSoundsTable[5].volume);
+ startSound(_locationSoundsTable[5]._offset, 5, _locationSoundsTable[5]._volume);
}
} else {
if (_flagsTable[105] == 1) {
_flagsTable[105] = 2;
- startSound(_locationSoundsTable[5].offset, 5, _locationSoundsTable[5].volume);
+ startSound(_locationSoundsTable[5]._offset, 5, _locationSoundsTable[5]._volume);
}
}
if (_xPosCurrent > 230) {
if (_flagsTable[106] == 0) {
_flagsTable[106] = 3;
- startSound(_locationSoundsTable[5].offset, 5, _locationSoundsTable[5].volume);
+ startSound(_locationSoundsTable[5]._offset, 5, _locationSoundsTable[5]._volume);
}
} else {
if (_flagsTable[106] == 1) {
_flagsTable[106] = 2;
- startSound(_locationSoundsTable[5].offset, 5, _locationSoundsTable[5].volume);
+ startSound(_locationSoundsTable[5]._offset, 5, _locationSoundsTable[5]._volume);
}
}
}
void TuckerEngine::execData3PreUpdate_locationNum34() {
if (_flagsTable[143] == 1) {
- _locationObjectsTable[0].xPos = 0;
+ _locationObjectsTable[0]._xPos = 0;
}
}
@@ -1962,7 +1962,7 @@ void TuckerEngine::execData3PreUpdate_locationNum35() {
}
void TuckerEngine::updateSprite_locationNum36(int i) {
- _spritesTable[i].state = (getRandomNumber() < 32000) ? 1 : 2;
+ _spritesTable[i]._state = (getRandomNumber() < 32000) ? 1 : 2;
}
void TuckerEngine::execData3PreUpdate_locationNum36() {
@@ -1978,12 +1978,12 @@ void TuckerEngine::execData3PreUpdate_locationNum36() {
void TuckerEngine::updateSprite_locationNum37(int i) {
int j = i + 1;
int offset = 200 - i * 45;
- ++_spritesTable[i].counter;
- if (_spritesTable[i].counter > offset) {
- _spritesTable[i].state = j;
- _spritesTable[i].counter = 0;
+ ++_spritesTable[i]._counter;
+ if (_spritesTable[i]._counter > offset) {
+ _spritesTable[i]._state = j;
+ _spritesTable[i]._counter = 0;
} else {
- _spritesTable[i].state = -1;
+ _spritesTable[i]._state = -1;
}
}
@@ -2001,16 +2001,16 @@ void TuckerEngine::updateSprite_locationNum41(int i) {
state = 1;
_flagsTable[158] = 2;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 3;
} else if (getRandomNumber() < 30000) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 5;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 4;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum41() {
@@ -2020,10 +2020,10 @@ void TuckerEngine::execData3PreUpdate_locationNum41() {
} else if (_backgroundSpriteCurrentFrame == 7) {
_flagsTable[77] = 0;
}
- if (_changeBackgroundSprite == 0) {
+ if (!_changeBackgroundSprite) {
if (_backgroundSpriteCurrentFrame == 16 && !isSoundPlaying(4)) {
- _locationSoundsTable[4].type = 2;
- startSound(_locationSoundsTable[4].offset, 4, _locationSoundsTable[4].volume);
+ _locationSoundsTable[4]._type = 2;
+ startSound(_locationSoundsTable[4]._offset, 4, _locationSoundsTable[4]._volume);
} else {
if (_backgroundSpriteCurrentFrame == 28) {
stopSound(4);
@@ -2031,8 +2031,8 @@ void TuckerEngine::execData3PreUpdate_locationNum41() {
}
} else {
if (_backgroundSpriteCurrentFrame == 28 && !isSoundPlaying(4)) {
- _locationSoundsTable[4].type = 2;
- startSound(_locationSoundsTable[4].offset, 4, _locationSoundsTable[4].volume);
+ _locationSoundsTable[4]._type = 2;
+ startSound(_locationSoundsTable[4]._offset, 4, _locationSoundsTable[4]._volume);
} else {
if (_backgroundSpriteCurrentFrame == 18) {
stopSound(4);
@@ -2040,11 +2040,11 @@ void TuckerEngine::execData3PreUpdate_locationNum41() {
}
}
}
- if (_panelLockedFlag == 1 && _yPosCurrent > 130 && _selectedObject.yPos > 135 && _nextAction == 0 && _flagsTable[223] == 0) {
- _panelLockedFlag = 0;
+ if (_panelLockedFlag && _yPosCurrent > 130 && _selectedObject._yPos > 135 && _nextAction == 0 && _flagsTable[223] == 0) {
+ _panelLockedFlag = false;
_csDataLoaded = false;
_nextLocationNum = 0;
- _selectedObject.locationObject_locationNum = 0;
+ _selectedObject._locationObjectLocationNum = 0;
_locationMaskType = 0;
_nextAction = _flagsTable[163] + 32;
++_flagsTable[163];
@@ -2057,9 +2057,9 @@ void TuckerEngine::execData3PreUpdate_locationNum41() {
}
}
if (_flagsTable[77] == 0) {
- _locationObjectsTable[3].xPos = 230;
+ _locationObjectsTable[3]._xPos = 230;
} else {
- _locationObjectsTable[3].xPos = 930;
+ _locationObjectsTable[3]._xPos = 930;
}
}
}
@@ -2076,13 +2076,13 @@ void TuckerEngine::updateSprite_locationNum42(int i) {
_flagsTable[223] = 3;
} else if (_flagsTable[223] == 3) {
state = 5;
- _spritesTable[i].updateDelay = 5;
- _spritesTable[i].state = _spritesTable[i].firstFrame - 1; // FIXME: bug, fxNum ?
- _updateSpriteFlag1 = 1;
+ _spritesTable[i]._updateDelay = 5;
+ _spritesTable[i]._state = _spritesTable[i]._firstFrame - 1; // FIXME: bug, fxNum ?
+ _updateSpriteFlag1 = true;
} else {
state = 2;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum42() {
@@ -2094,18 +2094,18 @@ void TuckerEngine::updateSprite_locationNum43_2(int i) {
if (_flagsTable[237] > 0) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 5;
- } else if (_csDataHandled || _spritesTable[i].counter == 2) {
- _spritesTable[i].needUpdate = 0;
+ } else if (_csDataHandled || _spritesTable[i]._counter == 2) {
+ _spritesTable[i]._needUpdate = false;
state = 6;
- } else if (_spritesTable[i].counter == 0) {
+ } else if (_spritesTable[i]._counter == 0) {
state = 3;
} else {
state = 4;
- _spritesTable[i].counter = 2;
+ _spritesTable[i]._counter = 2;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum43_3(int i) {
@@ -2114,12 +2114,12 @@ void TuckerEngine::updateSprite_locationNum43_3(int i) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
state = 7;
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
} else {
state = 8;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum43_4(int i) {
@@ -2128,38 +2128,38 @@ void TuckerEngine::updateSprite_locationNum43_4(int i) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
state = 9;
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
} else {
state = 10;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum43_5(int i) {
- _spritesTable[i].state = (_flagsTable[236] < 4) ? -1 : 11;
+ _spritesTable[i]._state = (_flagsTable[236] < 4) ? -1 : 11;
}
void TuckerEngine::updateSprite_locationNum43_6(int i) {
- _spritesTable[i].state = (_flagsTable[236] < 4) ? -1 : 12;
+ _spritesTable[i]._state = (_flagsTable[236] < 4) ? -1 : 12;
}
void TuckerEngine::execData3PreUpdate_locationNum43() {
- if (_panelLockedFlag == 1 && _xPosCurrent > 67 && _selectedObject.xPos > 68 && _locationMaskType == 0) {
- _panelLockedFlag = 0;
- _csDataLoaded = 0;
+ if (_panelLockedFlag && _xPosCurrent > 67 && _selectedObject._xPos > 68 && _locationMaskType == 0) {
+ _panelLockedFlag = false;
+ _csDataLoaded = false;
_nextAction = 5;
}
- if (_xPosCurrent > 55 && _spritesTable[2].counter == 0) {
- _spritesTable[2].counter = 1;
+ if (_xPosCurrent > 55 && _spritesTable[2]._counter == 0) {
+ _spritesTable[2]._counter = 1;
}
}
void TuckerEngine::execData3PreUpdate_locationNum44() {
if (_backgroundSpriteCurrentAnimation == 1) {
if (!isSoundPlaying(3) && _backgroundSpriteCurrentFrame == 1) {
- _locationSoundsTable[3].type = 2;
- startSound(_locationSoundsTable[3].offset, 3, _locationSoundsTable[3].volume);
+ _locationSoundsTable[3]._type = 2;
+ startSound(_locationSoundsTable[3]._offset, 3, _locationSoundsTable[3]._volume);
}
if (_backgroundSpriteCurrentFrame == 21) {
_flagsTable[77] = 1;
@@ -2169,7 +2169,7 @@ void TuckerEngine::execData3PreUpdate_locationNum44() {
}
} else if (_backgroundSpriteCurrentAnimation == 4) {
if (_backgroundSpriteCurrentFrame == 20 && !isSoundPlaying(3)) {
- startSound(_locationSoundsTable[3].offset, 3, _locationSoundsTable[3].volume);
+ startSound(_locationSoundsTable[3]._offset, 3, _locationSoundsTable[3]._volume);
}
}
}
@@ -2182,14 +2182,14 @@ void TuckerEngine::updateSprite_locationNum48(int i) {
_flagsTable[160] = 3;
state = 3;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 2;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 2;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum49(int i) {
@@ -2211,20 +2211,20 @@ void TuckerEngine::updateSprite_locationNum49(int i) {
_flagsTable[185] = 0;
state = 4;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 2;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
if (getRandomNumber() < 30000 || _backgroundSpriteCurrentAnimation <= -1) {
state = 3;
- _spritesTable[i].updateDelay = 1;
+ _spritesTable[i]._updateDelay = 1;
} else if (getRandomNumber() < 16000) {
state = 5;
} else {
state = 6;
}
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum49() {
@@ -2272,38 +2272,38 @@ void TuckerEngine::updateSprite_locationNum50(int i) {
_flagsTable[240] = 1;
}
} else {
- _spritesTable[i].animationFrame = _spritesTable[i].firstFrame - 1;
- _spritesTable[i].updateDelay = 5;
- _updateSpriteFlag1 = 1;
+ _spritesTable[i]._animationFrame = _spritesTable[i]._firstFrame - 1;
+ _spritesTable[i]._updateDelay = 5;
+ _updateSpriteFlag1 = true;
state = i + 1;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum51(int i) {
if (i == 2) {
- _spritesTable[i].state = 1;
+ _spritesTable[i]._state = 1;
} else if (i == 0) {
static const int stateTable[] = { 3, 3, 4, 5, 3, 3, 5, 4, 3, 3, 4, 5, 4, 4 };
- ++_spritesTable[i].counter;
- if (_spritesTable[i].counter > 13) {
- _spritesTable[i].counter = 0;
+ ++_spritesTable[i]._counter;
+ if (_spritesTable[i]._counter > 13) {
+ _spritesTable[i]._counter = 0;
}
- _spritesTable[i].state = stateTable[_spritesTable[i].counter];
+ _spritesTable[i]._state = stateTable[_spritesTable[i]._counter];
} else {
i = 1;
- _spritesTable[i].state = 6;
+ _spritesTable[i]._state = 6;
}
- _spritesTable[i].colorType = 1;
- _spritesTable[i].yMaxBackground = 0;
+ _spritesTable[i]._colorType = 1;
+ _spritesTable[i]._yMaxBackground = 0;
}
void TuckerEngine::execData3PreUpdate_locationNum52() {
- if (_selectedObject.xPos > 108 && _panelLockedFlag > 0 && _nextAction == 0 && _locationMaskType == 0) {
+ if (_selectedObject._xPos > 108 && _panelLockedFlag && _nextAction == 0 && _locationMaskType == 0) {
_nextAction = 1;
- _csDataLoaded = 0;
+ _csDataLoaded = false;
}
}
@@ -2313,21 +2313,21 @@ void TuckerEngine::updateSprite_locationNum53_0(int i) {
}
int state;
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 1;
} else if (_flagsTable[197] == 1) {
state = 3;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
_flagsTable[197] = 2;
} else if (_flagsTable[192] == 1) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 5;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 5;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum53_1(int i) {
@@ -2339,14 +2339,14 @@ void TuckerEngine::updateSprite_locationNum53_1(int i) {
} else {
state = -1;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum53() {
if (_flagsTable[192] == 0 && _xPosCurrent < 200 && _nextAction == 0) {
- _panelLockedFlag = 0;
+ _panelLockedFlag = false;
_nextAction = 14;
- _csDataLoaded = 0;
+ _csDataLoaded = false;
_pendingActionDelay = 0;
_pendingActionIndex = 0;
_currentActionVerb = 0;
@@ -2354,55 +2354,52 @@ void TuckerEngine::execData3PreUpdate_locationNum53() {
}
void TuckerEngine::updateSprite_locationNum54(int i) {
- int state = 3;
if (_flagsTable[141] == 2) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
setCharacterAnimation(0, i);
_flagsTable[141] = 1;
- _spritesTable[i].counter = 0;
- } else if (_flagsTable[141] == 1 && _spritesTable[i].counter < 40) {
+ _spritesTable[i]._counter = 0;
+ } else if (_flagsTable[141] == 1 && _spritesTable[i]._counter < 40) {
setCharacterAnimation(1, i);
- ++_spritesTable[i].counter;
+ ++_spritesTable[i]._counter;
} else if (_flagsTable[141] == 1) {
setCharacterAnimation(2, i);
_flagsTable[141] = 3;
} else {
+ int state = 3;
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 2;
+ _spritesTable[i]._needUpdate = true;
state = (getRandomNumber() < 12000) ? 2 : 4;
} else if (_flagsTable[141] == 3) {
- state = 3;
_flagsTable[141] = 0;
_flagsTable[224] = 1;
- _spritesTable[i].counter = 0;
- if (_panelLockedFlag == 0 && _xPosCurrent > 130 && _inventoryItemsState[17] == 0) {
+ _spritesTable[i]._counter = 0;
+ if (!_panelLockedFlag && _xPosCurrent > 130 && _inventoryItemsState[17] == 0) {
_nextAction = 18;
_csDataLoaded = false;
}
} else if (getRandomNumber() < 26000) {
- state = 3;
- _spritesTable[i].needUpdate = 0;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._needUpdate = false;
+ _spritesTable[i]._updateDelay = 5;
} else {
- state = 3;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
}
if (_inventoryItemsState[17] == 1) {
_flagsTable[224] = 2;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
}
void TuckerEngine::updateSprite_locationNum55(int i) {
if (_flagsTable[193] > 0 && _flagsTable[193] < 14) {
setCharacterAnimation(_flagsTable[193] - 1, i);
- _updateSpriteFlag1 = 1;
+ _updateSpriteFlag1 = true;
if (_flagsTable[193] == 1 || _flagsTable[193] == 3 || _flagsTable[193] == 5 || _flagsTable[193] == 7 || _flagsTable[193] == 11 || _flagsTable[193] == 13) {
++_flagsTable[193];
}
} else {
- _spritesTable[i].state = -1;
+ _spritesTable[i]._state = -1;
if (_flagsTable[193] == 14) {
_flagsTable[193] = 15;
}
@@ -2411,26 +2408,26 @@ void TuckerEngine::updateSprite_locationNum55(int i) {
void TuckerEngine::updateSprite_locationNum56(int i) {
int state;
- ++_spritesTable[i].counter;
+ ++_spritesTable[i]._counter;
if (_flagsTable[153] == 1) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 2;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 1;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum57_0(int i) {
int state;
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 5;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
if (getRandomNumber() < 30000) {
state = 1;
} else if (getRandomNumber() < 16000) {
@@ -2439,15 +2436,15 @@ void TuckerEngine::updateSprite_locationNum57_0(int i) {
state = 2;
}
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum57_1(int i) {
int state = 6;
if (getRandomNumber() < 30000) {
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum57() {
@@ -2472,20 +2469,20 @@ void TuckerEngine::updateSprite_locationNum58(int i) {
_flagsTable[190] = 3;
}
}
- _spritesTable[i].state = state;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = state;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::execData3PreUpdate_locationNum58() {
// workaround original game glitch #2872348: do not change position on location change
if (_nextLocationNum == 0 && _flagsTable[190] < 3 && _xPosCurrent > 310) {
_xPosCurrent = 310;
- _panelLockedFlag = 0;
+ _panelLockedFlag = false;
}
- if (_flagsTable[190] > 0 && _locationSoundsTable[0].volume > 0) {
- _locationSoundsTable[0].volume = 0;
- _locationSoundsTable[4].volume = 0;
- _locationSoundsTable[5].volume = 0;
+ if (_flagsTable[190] > 0 && _locationSoundsTable[0]._volume > 0) {
+ _locationSoundsTable[0]._volume = 0;
+ _locationSoundsTable[4]._volume = 0;
+ _locationSoundsTable[5]._volume = 0;
if (isSoundPlaying(0)) {
stopSound(0);
}
@@ -2498,27 +2495,27 @@ void TuckerEngine::updateSprite_locationNum59(int i) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
state = 3;
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
} else if (_csDataHandled) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
if (_flagsTable[199] == 0) {
_flagsTable[199] = 1;
setCharacterAnimation(0, 0);
return;
}
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 3;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
} else if (_flagsTable[199] == 1) {
_flagsTable[199] = 0;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
setCharacterAnimation(1, 0);
return;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 1;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum60_0(int i) {
@@ -2526,34 +2523,34 @@ void TuckerEngine::updateSprite_locationNum60_0(int i) {
if (_flagsTable[186] > 0) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 9;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = (getRandomNumber() > 32000) ? 8 : 7;
}
- _spritesTable[i].state = state;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = state;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::updateSprite_locationNum60_1(int i) {
int state;
if (_flagsTable[186] == 1) {
_flagsTable[186] = 2;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 2;
} else if (_flagsTable[186] == 2) {
state = 6;
_flagsTable[187] = 1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 1;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = (getRandomNumber() > 32000) ? 5 : 4;
}
- _spritesTable[i].state = state;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = state;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::execData3PostUpdate_locationNum60() {
@@ -2569,19 +2566,19 @@ void TuckerEngine::updateSprite_locationNum61_0(int i) {
} else if (_flagsTable[88] == 2) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == 0) {
- if (_spritesTable[i].needUpdate == 0) {
- _spritesTable[i].needUpdate = 1;
+ if (!_spritesTable[i]._needUpdate) {
+ _spritesTable[i]._needUpdate = true;
state = 2;
} else {
state = 2;
- _spritesTable[0].animationFrame = 2;
- _updateSpriteFlag1 = 1;
+ _spritesTable[0]._animationFrame = 2;
+ _updateSpriteFlag1 = true;
}
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
if (r < 30000) {
state = 7;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
} else if (r < 31000) {
state = 7;
} else if (r < 32000) {
@@ -2590,7 +2587,7 @@ void TuckerEngine::updateSprite_locationNum61_0(int i) {
state = 6;
}
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum61_1(int i) {
@@ -2598,19 +2595,19 @@ void TuckerEngine::updateSprite_locationNum61_1(int i) {
if (_flagsTable[151] == 1) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 14;
} else if (_csDataHandled || getRandomNumber() < 29000) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 12;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
} else if (getRandomNumber() < 20000) {
state = 12;
} else {
state = 13;
}
- _spritesTable[i].state = state;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = state;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::updateSprite_locationNum61_2(int i) {
@@ -2651,8 +2648,8 @@ void TuckerEngine::updateSprite_locationNum61_2(int i) {
if (_flagsTable[136] != 2) {
_flagsTable[150] = 0;
}
- _spritesTable[i].state = state;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = state;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::execData3PreUpdate_locationNum61() {
@@ -2676,13 +2673,13 @@ void TuckerEngine::updateSprite_locationNum63_0(int i) {
} else if (_flagsTable[132] != 2 || _flagsTable[133] != 1 || _flagsTable[136] > 0) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 6;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = -1;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum63_1(int i) {
@@ -2694,16 +2691,16 @@ void TuckerEngine::updateSprite_locationNum63_1(int i) {
state = 8;
}
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum63_2(int i) {
- ++_spritesTable[i].counter;
+ ++_spritesTable[i]._counter;
int state = -1;
if (_flagsTable[132] == 2 && _flagsTable[133] == 1 && _flagsTable[136] <= 0) {
if (_flagsTable[226] == 0) {
state = 9;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
} else if (_flagsTable[226] == 1) {
state = 9;
_flagsTable[226] = 2;
@@ -2714,16 +2711,16 @@ void TuckerEngine::updateSprite_locationNum63_2(int i) {
state = 10;
}
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum63_3(int i) {
- ++_spritesTable[i].counter;
+ ++_spritesTable[i]._counter;
int state = -1;
if (_flagsTable[132] == 2 && _flagsTable[133] == 1 && _flagsTable[136] <= 0) {
- if (_spritesTable[i].counter > 80) {
+ if (_spritesTable[i]._counter > 80) {
state = 7;
- _spritesTable[i].counter = 0;
+ _spritesTable[i]._counter = 0;
} else if (getRandomNumber() > 32000) {
state = 2;
} else if (getRandomNumber() > 32000) {
@@ -2732,7 +2729,7 @@ void TuckerEngine::updateSprite_locationNum63_3(int i) {
state = 8;
}
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum63_4(int i) {
@@ -2740,7 +2737,7 @@ void TuckerEngine::updateSprite_locationNum63_4(int i) {
if (_flagsTable[132] == 2 && _flagsTable[133] == 1 && _flagsTable[136] == 0) {
state = 1;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum63() {
@@ -2764,8 +2761,8 @@ void TuckerEngine::execData3PreUpdate_locationNum63() {
} else {
if (_flagsTable[132] == 0 || (_flagsTable[132] == 2 && _flagsTable[136] > 0)) {
if (!isSoundPlaying(1)) {
- _locationSoundsTable[1].type = 2;
- startSound(_locationSoundsTable[1].offset, 1, _locationSoundsTable[1].volume);
+ _locationSoundsTable[1]._type = 2;
+ startSound(_locationSoundsTable[1]._offset, 1, _locationSoundsTable[1]._volume);
}
} else {
if (isSoundPlaying(1)) {
@@ -2774,8 +2771,8 @@ void TuckerEngine::execData3PreUpdate_locationNum63() {
}
if (_flagsTable[132] == 1) {
if (!isSoundPlaying(0)) {
- _locationSoundsTable[0].type = 2;
- startSound(_locationSoundsTable[0].offset, 0, _locationSoundsTable[0].volume);
+ _locationSoundsTable[0]._type = 2;
+ startSound(_locationSoundsTable[0]._offset, 0, _locationSoundsTable[0]._volume);
}
} else {
if (isSoundPlaying(0)) {
@@ -2784,7 +2781,7 @@ void TuckerEngine::execData3PreUpdate_locationNum63() {
}
if (_flagsTable[132] == 2 && _flagsTable[136] == 0) {
if (!isSoundPlaying(2)) {
- startSound(_locationSoundsTable[2].offset, 2, _locationSoundsTable[2].volume);
+ startSound(_locationSoundsTable[2]._offset, 2, _locationSoundsTable[2]._volume);
}
} else {
if (isSoundPlaying(2)) {
@@ -2807,7 +2804,7 @@ void TuckerEngine::updateSprite_locationNum65(int i) {
if (_flagsTable[188] == 1) {
_flagsTable[188] = 2;
state = 1;
- _spritesTable[i].gfxBackgroundOffset = 100;
+ _spritesTable[i]._gfxBackgroundOffset = 100;
} else if (_flagsTable[188] > 0 && _flagsTable[189] > 0) {
state = -1;
if (_xPosCurrent < 150 || _yPosCurrent > 240) {
@@ -2826,7 +2823,7 @@ void TuckerEngine::updateSprite_locationNum65(int i) {
_flagsTable[189] = 0;
}
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum65() {
@@ -2836,66 +2833,66 @@ void TuckerEngine::execData3PreUpdate_locationNum65() {
void TuckerEngine::updateSprite_locationNum66_0(int i) {
int state;
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 2;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 2;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
}
- _spritesTable[i].state = state;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = state;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::updateSprite_locationNum66_1(int i) {
int state;
if (_flagsTable[191] == 0 && _xPosCurrent > 568) {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 8;
} else {
state = 10;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
}
} else {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 9;
} else if (getRandomNumber() > 30000) {
state = 6;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 7;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
}
}
- _spritesTable[i].state = state;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = state;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::updateSprite_locationNum66_2(int i) {
- _spritesTable[i].disabled = 1;
- _spritesTable[i].state = 3;
+ _spritesTable[i]._disabled = true;
+ _spritesTable[i]._state = 3;
}
void TuckerEngine::updateSprite_locationNum66_3(int i) {
- _spritesTable[i].state = 4;
+ _spritesTable[i]._state = 4;
}
void TuckerEngine::updateSprite_locationNum66_4(int i) {
- _spritesTable[i].state = 5;
- _spritesTable[i].gfxBackgroundOffset = 320;
+ _spritesTable[i]._state = 5;
+ _spritesTable[i]._gfxBackgroundOffset = 320;
}
void TuckerEngine::execData3PreUpdate_locationNum66() {
// FIXME: shouldn't be executed after using the map
_flagsTable[137] = 0;
if (_xPosCurrent > 583 && _flagsTable[191] == 0 && _nextAction == 0 && _locationMaskType == 0) {
- _panelLockedFlag = 0;
- _csDataLoaded = 0;
+ _panelLockedFlag = false;
+ _csDataLoaded = false;
_nextLocationNum = 0;
- _selectedObject.locationObject_locationNum = 0;
+ _selectedObject._locationObjectLocationNum = 0;
if (_flagsTable[131] == 0) {
_nextAction = 13;
} else if (_flagsTable[130] == 0) {
@@ -2907,25 +2904,25 @@ void TuckerEngine::execData3PreUpdate_locationNum66() {
}
void TuckerEngine::execData3PostUpdate_locationNum66() {
- if (_spritesTable[2].flipX == 1) {
+ if (_spritesTable[2]._flipX) {
--_updateLocationXPosTable2[0];
if (_updateLocationXPosTable2[0] < -50) {
- _spritesTable[2].flipX = 0;
+ _spritesTable[2]._flipX = false;
_updateLocationXPosTable2[0] = -50;
}
} else {
++_updateLocationXPosTable2[0];
if (_updateLocationXPosTable2[0] > 500) {
- _spritesTable[2].flipX = 1;
+ _spritesTable[2]._flipX = true;
_updateLocationXPosTable2[0] = 500;
}
}
- _spritesTable[2].gfxBackgroundOffset = _updateLocationXPosTable2[0] + 8320;
+ _spritesTable[2]._gfxBackgroundOffset = _updateLocationXPosTable2[0] + 8320;
const int spr = 2;
- _spritesTable[spr].colorType = 1;
- _spritesTable[spr].yMaxBackground = 0;
+ _spritesTable[spr]._colorType = 1;
+ _spritesTable[spr]._yMaxBackground = 0;
drawSprite(spr);
- _spritesTable[spr].colorType = 0;
+ _spritesTable[spr]._colorType = 0;
}
void TuckerEngine::updateSprite_locationNum69_1(int i) {
@@ -2939,10 +2936,10 @@ void TuckerEngine::updateSprite_locationNum69_1(int i) {
} else if (_flagsTable[236] == 4) {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
state = 9;
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
} else {
state = 14;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
}
} else if (_flagsTable[236] == 5) {
state = 7;
@@ -2950,7 +2947,7 @@ void TuckerEngine::updateSprite_locationNum69_1(int i) {
} else {
state = -1;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum69_2(int i) {
@@ -2966,10 +2963,10 @@ void TuckerEngine::updateSprite_locationNum69_2(int i) {
} else if (_flagsTable[237] == 4 || _flagsTable[237] == 2 || _flagsTable[237] == 3 || _flagsTable[237] == 7) {
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
state = 10;
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
} else {
state = 12;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
}
} else if (_flagsTable[237] == 5) {
state = 16;
@@ -2983,7 +2980,7 @@ void TuckerEngine::updateSprite_locationNum69_2(int i) {
} else {
state = -1;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum69_3(int i) {
@@ -2997,21 +2994,21 @@ void TuckerEngine::updateSprite_locationNum69_3(int i) {
_flagsTable[238] = 1;
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
state = 11;
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
} else {
state = 13;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
}
} else {
state = -1;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::execData3PreUpdate_locationNum70() {
const uint8 color = 103;
if (_execData3Counter == 0) {
- startSound(_locationSoundsTable[6].offset, 6, _locationSoundsTable[6].volume);
+ startSound(_locationSoundsTable[6]._offset, 6, _locationSoundsTable[6]._volume);
_execData3Counter = 1;
_flagsTable[143] = 0;
_updateLocation70StringLen = 0;
@@ -3041,7 +3038,7 @@ void TuckerEngine::execData3PreUpdate_locationNum70Helper() {
if (_lastKeyPressed == Common::KEYCODE_BACKSPACE || _lastKeyPressed == Common::KEYCODE_DELETE) {
if (_updateLocation70StringLen > 0) {
--_updateLocation70StringLen;
- startSound(_locationSoundsTable[0].offset, 0, _locationSoundsTable[0].volume);
+ startSound(_locationSoundsTable[0]._offset, 0, _locationSoundsTable[0]._volume);
}
} else if (_lastKeyPressed == Common::KEYCODE_RETURN) {
_flagsTable[143] = 1;
@@ -3052,7 +3049,7 @@ void TuckerEngine::execData3PreUpdate_locationNum70Helper() {
_flagsTable[143] = 2;
}
const int num = (_flagsTable[143] == 1) ? 4 : 5;
- startSound(_locationSoundsTable[num].offset, num, _locationSoundsTable[num].volume);
+ startSound(_locationSoundsTable[num]._offset, num, _locationSoundsTable[num]._volume);
} else if (_updateLocation70StringLen < 19) {
uint8 chr = 0;
switch (_lastKeyPressed) {
@@ -3089,7 +3086,7 @@ void TuckerEngine::execData3PreUpdate_locationNum70Helper() {
}
break;
}
- startSound(_locationSoundsTable[0].offset, 0, _locationSoundsTable[0].volume);
+ startSound(_locationSoundsTable[0]._offset, 0, _locationSoundsTable[0]._volume);
if (chr > 0) {
_updateLocation70String[_updateLocation70StringLen] = chr;
++_updateLocation70StringLen;
@@ -3104,17 +3101,17 @@ void TuckerEngine::updateSprite_locationNum71(int i) {
if (_flagsTable[155] != 6 || _flagsTable[207] == 1) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 1;
} else if (getRandomNumber() < 30000) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 2;
- _spritesTable[i].updateDelay = 5;
+ _spritesTable[i]._updateDelay = 5;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 2;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum72(int i) {
@@ -3122,28 +3119,28 @@ void TuckerEngine::updateSprite_locationNum72(int i) {
if (_flagsTable[155] == 7 || _flagsTable[207] == 1) {
state = -1;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 2;
} else {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 1;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum74(int i) {
static const uint8 stateTable[] = { 1, 3, 5, 5, 10, 16, 16 };
int num = _flagsTable[236] - 74;
if (stateTable[num] + i == 21) {
- if (_updateLocationFlag == 0) {
- _updateLocationFlag = 1;
+ if (!_updateLocationFlag) {
+ _updateLocationFlag = true;
} else {
- _spritesTable[i].animationFrame = _spritesTable[i].firstFrame - 1;
- _spritesTable[i].updateDelay = 5;
- _updateSpriteFlag1 = 1;
+ _spritesTable[i]._animationFrame = _spritesTable[i]._firstFrame - 1;
+ _spritesTable[i]._updateDelay = 5;
+ _updateSpriteFlag1 = true;
}
}
- _spritesTable[i].state = stateTable[num] + i;
+ _spritesTable[i]._state = stateTable[num] + i;
}
void TuckerEngine::updateSprite_locationNum79(int i) {
@@ -3153,43 +3150,43 @@ void TuckerEngine::updateSprite_locationNum79(int i) {
_flagsTable[227] = 1;
} else if (_flagsTable[227] == 1 && _charSpeechSoundCounter > 0) {
state = 2;
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
} else if (_flagsTable[227] == 2) {
state = 3;
_flagsTable[227] = 3;
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
} else {
- _spritesTable[i].animationFrame = _spritesTable[i].firstFrame - 1;
- _spritesTable[i].updateDelay = 5;
- _updateSpriteFlag1 = 1;
+ _spritesTable[i]._animationFrame = _spritesTable[i]._firstFrame - 1;
+ _spritesTable[i]._updateDelay = 5;
+ _updateSpriteFlag1 = true;
state = 3;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum81_0(int i) {
int state;
if (_charSpeechSoundCounter > 0 && _actionCharacterNum == i) {
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
state = 3;
_flagsTable[288] = 1;
} else if (_flagsTable[288] < 2) {
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
state = 2;
if (_flagsTable[288] == 1) {
_flagsTable[288] = 2;
}
} else {
- _spritesTable[i].animationFrame = _spritesTable[i].firstFrame - 1;
- _spritesTable[i].updateDelay = 5;
- _updateSpriteFlag1 = 1;
+ _spritesTable[i]._animationFrame = _spritesTable[i]._firstFrame - 1;
+ _spritesTable[i]._updateDelay = 5;
+ _updateSpriteFlag1 = true;
state = 2;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
void TuckerEngine::updateSprite_locationNum81_1(int i) {
- _spritesTable[i].state = 1;
+ _spritesTable[i]._state = 1;
}
void TuckerEngine::updateSprite_locationNum82(int i) {
@@ -3197,20 +3194,20 @@ void TuckerEngine::updateSprite_locationNum82(int i) {
if (_charSpeechSoundCounter > 0) {
state = 1;
_flagsTable[229] = 1;
- _spritesTable[i].needUpdate = 1;
+ _spritesTable[i]._needUpdate = true;
} else if (_flagsTable[229] == 0) {
state = 1;
} else if (_flagsTable[229] == 1) {
state = 2;
_flagsTable[229] = 2;
- _spritesTable[i].needUpdate = 0;
+ _spritesTable[i]._needUpdate = false;
} else {
- _spritesTable[i].animationFrame = _spritesTable[i].firstFrame - 1;
- _spritesTable[i].updateDelay = 5;
- _updateSpriteFlag1 = 1;
+ _spritesTable[i]._animationFrame = _spritesTable[i]._firstFrame - 1;
+ _spritesTable[i]._updateDelay = 5;
+ _updateSpriteFlag1 = true;
state = 2;
}
- _spritesTable[i].state = state;
+ _spritesTable[i]._state = state;
}
} // namespace Tucker
diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp
index 1b04f3fae9..5f06334720 100644
--- a/engines/tucker/resource.cpp
+++ b/engines/tucker/resource.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -30,7 +30,8 @@
#include "audio/decoders/wave.h"
#include "graphics/surface.h"
-#include "graphics/decoders/pcx.h"
+
+#include "image/pcx.h"
#include "tucker/tucker.h"
#include "tucker/graphics.h"
@@ -126,7 +127,7 @@ public:
}
bool findNextToken(DataToken t) {
- const char *token = 0;
+ const char *token = nullptr;
switch (t) {
case kDataTokenDw:
token = "dw";
@@ -278,7 +279,7 @@ Audio::RewindableAudioStream *CompressedSound::load(CompressedSoundType type, in
void TuckerEngine::loadImage(const char *fname, uint8 *dst, int type) {
char filename[80];
- strcpy(filename, fname);
+ Common::strlcpy(filename, fname, sizeof(filename));
Common::File f;
if (!f.open(filename)) {
@@ -302,7 +303,7 @@ void TuckerEngine::loadImage(const char *fname, uint8 *dst, int type) {
}
}
- ::Graphics::PCXDecoder pcx;
+ Image::PCXDecoder pcx;
if (!pcx.loadStream(f))
error("Error while reading PCX image");
@@ -350,11 +351,11 @@ void TuckerEngine::loadCharset2() {
}
void TuckerEngine::loadCharsetHelper() {
- const int charW = Graphics::_charset.charW;
- const int charH = Graphics::_charset.charH;
+ const int charW = Graphics::_charset._charW;
+ const int charH = Graphics::_charset._charH;
int offset = 0;
- for (int y = 0; y < Graphics::_charset.yCount; ++y) {
- for (int x = 0; x < Graphics::_charset.xCount; ++x) {
+ for (int y = 0; y < Graphics::_charset._yCount; ++y) {
+ for (int x = 0; x < Graphics::_charset._xCount; ++x) {
offset += Graphics::encodeRAW(_loadTempBuf + (y * 320) * charH + x * charW, _charsetGfxBuf + offset, charW, charH);
}
}
@@ -407,8 +408,8 @@ void TuckerEngine::loadBudSpr(int startOffset) {
loadImage(filename.c_str(), _loadTempBuf, 0);
++frame;
}
- int sz = Graphics::encodeRLE(_loadTempBuf + _spriteFramesTable[i].sourceOffset, _spritesGfxBuf + spriteOffset, _spriteFramesTable[i].xSize, _spriteFramesTable[i].ySize);
- _spriteFramesTable[i].sourceOffset = spriteOffset;
+ int sz = Graphics::encodeRLE(_loadTempBuf + _spriteFramesTable[i]._sourceOffset, _spritesGfxBuf + spriteOffset, _spriteFramesTable[i]._xSize, _spriteFramesTable[i]._ySize);
+ _spriteFramesTable[i]._sourceOffset = spriteOffset;
spriteOffset += sz;
}
}
@@ -430,16 +431,16 @@ int TuckerEngine::loadCTable01(int index, int firstSpriteNum, int *framesCount)
}
const int y = t.getNextInteger();
SpriteFrame *c = &_spriteFramesTable[lastSpriteNum++];
- c->sourceOffset = y * 320 + x;
- c->xSize = t.getNextInteger();
- c->ySize = t.getNextInteger();
- c->xOffset = t.getNextInteger();
- if (c->xOffset > 300) {
- c->xOffset -= 500;
+ c->_sourceOffset = y * 320 + x;
+ c->_xSize = t.getNextInteger();
+ c->_ySize = t.getNextInteger();
+ c->_xOffset = t.getNextInteger();
+ if (c->_xOffset > 300) {
+ c->_xOffset -= 500;
}
- c->yOffset = t.getNextInteger();
- if (c->yOffset > 300) {
- c->yOffset -= 500;
+ c->_yOffset = t.getNextInteger();
+ if (c->_yOffset > 300) {
+ c->_yOffset -= 500;
}
}
}
@@ -454,17 +455,17 @@ void TuckerEngine::loadCTable02(int fl) {
loadFile("ctable02.c", _loadTempBuf);
DataTokenizer t(_loadTempBuf, _fileLoadSize);
while (t.findNextToken(kDataTokenDw)) {
- _spriteAnimationsTable[entry].numParts = t.getNextInteger();
- if (_spriteAnimationsTable[entry].numParts < 1) {
+ _spriteAnimationsTable[entry]._numParts = t.getNextInteger();
+ if (_spriteAnimationsTable[entry]._numParts < 1) {
return;
}
- _spriteAnimationsTable[entry].rotateFlag = t.getNextInteger();
+ _spriteAnimationsTable[entry]._rotateFlag = t.getNextInteger();
int num = t.getNextInteger();
if (num != fl) {
continue;
}
int start = 0;
- _spriteAnimationsTable[entry].firstFrameIndex = i;
+ _spriteAnimationsTable[entry]._firstFrameIndex = i;
while (start != 999) {
start = t.getNextInteger();
if (start == 9999) { // end marker in the demo version
@@ -570,12 +571,12 @@ void TuckerEngine::loadData() {
const int x = t.getNextInteger();
const int y = t.getNextInteger();
Data *d = &_dataTable[_dataCount];
- d->sourceOffset = y * 320 + x;
- d->xSize = t.getNextInteger();
- d->ySize = t.getNextInteger();
- d->xDest = t.getNextInteger();
- d->yDest = t.getNextInteger();
- d->index = count;
+ d->_sourceOffset = y * 320 + x;
+ d->_xSize = t.getNextInteger();
+ d->_ySize = t.getNextInteger();
+ d->_xDest = t.getNextInteger();
+ d->_yDest = t.getNextInteger();
+ d->_index = count;
}
++objNum;
++count;
@@ -591,9 +592,9 @@ void TuckerEngine::loadData() {
int TuckerEngine::loadDataHelper(int offset, int index) {
for (int i = 0; i < _dataCount + 1; ++i) {
- if (_dataTable[i].index == index) {
- int sz = Graphics::encodeRLE(_loadTempBuf + _dataTable[i].sourceOffset, _data3GfxBuf + offset, _dataTable[i].xSize, _dataTable[i].ySize);
- _dataTable[i].sourceOffset = offset;
+ if (_dataTable[i]._index == index) {
+ int sz = Graphics::encodeRLE(_loadTempBuf + _dataTable[i]._sourceOffset, _data3GfxBuf + offset, _dataTable[i]._xSize, _dataTable[i]._ySize);
+ _dataTable[i]._sourceOffset = offset;
offset += sz;
}
}
@@ -625,7 +626,7 @@ void TuckerEngine::loadData3() {
}
assert(_locationAnimationsCount < kLocationAnimationsTableSize);
LocationAnimation *d = &_locationAnimationsTable[_locationAnimationsCount++];
- d->graphicNum = num;
+ d->_graphicNum = num;
const int seqNum = t.getNextInteger();
if (seqNum > 0) {
int anim = 0;
@@ -635,22 +636,22 @@ void TuckerEngine::loadData3() {
}
++anim;
}
- d->animCurrentCounter = d->animInitCounter = anim;
+ d->_animCurrentCounter = d->_animInitCounter = anim;
while (_staticData3Table[anim + 1] != 999) {
++anim;
}
- d->animLastCounter = anim;
+ d->_animLastCounter = anim;
} else {
- d->animLastCounter = 0;
+ d->_animLastCounter = 0;
}
- d->getFlag = t.getNextInteger();
- d->inventoryNum = t.getNextInteger();
- d->flagNum = t.getNextInteger();
- d->flagValue = t.getNextInteger();
- d->selectable = t.getNextInteger();
- d->standX = t.getNextInteger();
- d->standY = t.getNextInteger();
- d->drawFlag = 0;
+ d->_getFlag = t.getNextInteger();
+ d->_inventoryNum = t.getNextInteger();
+ d->_flagNum = t.getNextInteger();
+ d->_flagValue = t.getNextInteger();
+ d->_selectable = t.getNextInteger();
+ d->_standX = t.getNextInteger();
+ d->_standY = t.getNextInteger();
+ d->_drawFlag = false;
}
}
}
@@ -672,22 +673,22 @@ void TuckerEngine::loadData4() {
}
assert(_locationObjectsCount < kLocationObjectsTableSize);
LocationObject *d = &_locationObjectsTable[_locationObjectsCount++];
- d->xPos = i;
- d->yPos = t.getNextInteger();
- d->xSize = t.getNextInteger();
- d->ySize = t.getNextInteger();
- d->standX = t.getNextInteger();
- d->standY = t.getNextInteger();
- d->textNum = t.getNextInteger();
- d->cursorNum = t.getNextInteger();
- d->locationNum = t.getNextInteger();
- if (d->locationNum > 0) {
- d->toX = t.getNextInteger();
- d->toY = t.getNextInteger();
- d->toX2 = t.getNextInteger();
- d->toY2 = t.getNextInteger();
- d->toWalkX2 = t.getNextInteger();
- d->toWalkY2 = t.getNextInteger();
+ d->_xPos = i;
+ d->_yPos = t.getNextInteger();
+ d->_xSize = t.getNextInteger();
+ d->_ySize = t.getNextInteger();
+ d->_standX = t.getNextInteger();
+ d->_standY = t.getNextInteger();
+ d->_textNum = t.getNextInteger();
+ d->_cursorNum = t.getNextInteger();
+ d->_locationNum = t.getNextInteger();
+ if (d->_locationNum > 0) {
+ d->_toX = t.getNextInteger();
+ d->_toY = t.getNextInteger();
+ d->_toX2 = t.getNextInteger();
+ d->_toY2 = t.getNextInteger();
+ d->_toWalkX2 = t.getNextInteger();
+ d->_toWalkY2 = t.getNextInteger();
}
}
}
@@ -725,20 +726,20 @@ void TuckerEngine::loadActionFile() {
int keyD = t.getNextInteger();
int keyE = t.getNextInteger();
Action *action = &_actionsTable[_actionsCount++];
- action->key = keyE * 1000000 + keyD * 100000 + keyA * 10000 + keyB * 1000 + keyC;
- action->testFlag1Num = t.getNextInteger();
- action->testFlag1Value = t.getNextInteger();
- action->testFlag2Num = t.getNextInteger();
- action->testFlag2Value = t.getNextInteger();
- action->speech = t.getNextInteger();
- action->flipX = t.getNextInteger();
- action->index = t.getNextInteger();
- action->delay = t.getNextInteger();
- action->setFlagNum = t.getNextInteger();
- assert(action->setFlagNum >= 0 && action->setFlagNum < kFlagsTableSize);
- action->setFlagValue = t.getNextInteger();
- action->fxNum = t.getNextInteger();
- action->fxDelay = t.getNextInteger();
+ action->_key = keyE * 1000000 + keyD * 100000 + keyA * 10000 + keyB * 1000 + keyC;
+ action->_testFlag1Num = t.getNextInteger();
+ action->_testFlag1Value = t.getNextInteger();
+ action->_testFlag2Num = t.getNextInteger();
+ action->_testFlag2Value = t.getNextInteger();
+ action->_speech = t.getNextInteger();
+ action->_flipX = t.getNextInteger();
+ action->_index = t.getNextInteger();
+ action->_delay = t.getNextInteger();
+ action->_setFlagNum = t.getNextInteger();
+ assert(action->_setFlagNum >= 0 && action->_setFlagNum < kFlagsTableSize);
+ action->_setFlagValue = t.getNextInteger();
+ action->_fxNum = t.getNextInteger();
+ action->_fxDelay = t.getNextInteger();
}
}
}
@@ -755,17 +756,17 @@ void TuckerEngine::loadCharPos() {
}
assert(_charPosCount < 4);
CharPos *charPos = &_charPosTable[_charPosCount++];
- charPos->xPos = i;
- charPos->yPos = t.getNextInteger();
- charPos->xSize = t.getNextInteger();
- charPos->ySize = t.getNextInteger();
- charPos->xWalkTo = t.getNextInteger();
- charPos->yWalkTo = t.getNextInteger();
- charPos->flagNum = t.getNextInteger();
- charPos->flagValue = t.getNextInteger();
- charPos->direction = t.getNextInteger();
- charPos->name = t.getNextInteger();
- charPos->description = t.getNextInteger();
+ charPos->_xPos = i;
+ charPos->_yPos = t.getNextInteger();
+ charPos->_xSize = t.getNextInteger();
+ charPos->_ySize = t.getNextInteger();
+ charPos->_xWalkTo = t.getNextInteger();
+ charPos->_yWalkTo = t.getNextInteger();
+ charPos->_flagNum = t.getNextInteger();
+ charPos->_flagValue = t.getNextInteger();
+ charPos->_direction = t.getNextInteger();
+ charPos->_name = t.getNextInteger();
+ charPos->_description = t.getNextInteger();
}
int quitLoop = 0;
size_t count = 0;
@@ -818,9 +819,9 @@ void TuckerEngine::loadSprA02_01() {
void TuckerEngine::unloadSprA02_01() {
for (int i = 1; i < kSprA02TableSize; ++i) {
free(_sprA02Table[i]);
- _sprA02Table[i] = 0;
+ _sprA02Table[i] = nullptr;
}
- _sprA02Table[0] = 0;
+ _sprA02Table[0] = nullptr;
}
void TuckerEngine::loadSprC02_01() {
@@ -834,17 +835,17 @@ void TuckerEngine::loadSprC02_01() {
_spritesCount = _sprC02LookupTable2[_locationNum];
for (int i = 0; i < kMaxCharacters; ++i) {
memset(&_spritesTable[i], 0, sizeof(Sprite));
- _spritesTable[i].state = -1;
- _spritesTable[i].stateIndex = -1;
+ _spritesTable[i]._state = -1;
+ _spritesTable[i]._stateIndex = -1;
}
}
void TuckerEngine::unloadSprC02_01() {
for (int i = 1; i < kSprC02TableSize; ++i) {
free(_sprC02Table[i]);
- _sprC02Table[i] = 0;
+ _sprC02Table[i] = nullptr;
}
- _sprC02Table[0] = 0;
+ _sprC02Table[0] = nullptr;
}
void TuckerEngine::loadFx() {
@@ -856,35 +857,35 @@ void TuckerEngine::loadFx() {
_currentFxSet = 0;
for (int i = 0; i < _locationSoundsCount; ++i) {
LocationSound *s = &_locationSoundsTable[i];
- s->offset = 0;
- s->num = t.getNextInteger();
- s->volume = t.getNextInteger();
- s->type = t.getNextInteger();
- switch (s->type) {
+ s->_offset = 0;
+ s->_num = t.getNextInteger();
+ s->_volume = t.getNextInteger();
+ s->_type = t.getNextInteger();
+ switch (s->_type) {
case 5:
_currentFxSet = 1;
_currentFxIndex = i;
- _currentFxVolume = s->volume;
+ _currentFxVolume = s->_volume;
_currentFxDist = t.getNextInteger();
_currentFxScale = t.getNextInteger();
break;
case 6:
case 7:
case 8:
- s->startFxSpriteState = t.getNextInteger();
- s->startFxSpriteNum = t.getNextInteger();
- s->updateType = t.getNextInteger();
- if (s->type == 7) {
- s->flagNum = t.getNextInteger();
- s->flagValueStartFx = t.getNextInteger();
- s->stopFxSpriteState = t.getNextInteger();
- s->stopFxSpriteNum = t.getNextInteger();
- s->flagValueStopFx = t.getNextInteger();
+ s->_startFxSpriteState = t.getNextInteger();
+ s->_startFxSpriteNum = t.getNextInteger();
+ s->_updateType = t.getNextInteger();
+ if (s->_type == 7) {
+ s->_flagNum = t.getNextInteger();
+ s->_flagValueStartFx = t.getNextInteger();
+ s->_stopFxSpriteState = t.getNextInteger();
+ s->_stopFxSpriteNum = t.getNextInteger();
+ s->_flagValueStopFx = t.getNextInteger();
}
break;
}
- if (s->type == 8) {
- s->type = 6;
+ if (s->_type == 8) {
+ s->_type = 6;
}
}
t.findNextToken(kDataTokenDw);
@@ -895,10 +896,10 @@ void TuckerEngine::loadFx() {
int flagValue = t.getNextInteger();
if (flagValue == _flagsTable[flagNum]) {
LocationMusic *m = &_locationMusicsTable[_locationMusicsCount++];
- m->offset = 0;
- m->num = t.getNextInteger();
- m->volume = t.getNextInteger();
- m->flag = t.getNextInteger();
+ m->_offset = 0;
+ m->_num = t.getNextInteger();
+ m->_volume = t.getNextInteger();
+ m->_flag = t.getNextInteger();
} else {
for (int j = 0; j < 3; ++j) {
t.getNextInteger();
@@ -923,7 +924,7 @@ void TuckerEngine::loadSound(Audio::Mixer::SoundType type, int num, int volume,
return;
}
if (!stream) {
- const char *fmt = 0;
+ const char *fmt = nullptr;
switch (type) {
case Audio::Mixer::kSFXSoundType:
fmt = "fx/fx%d.wav";
@@ -1004,7 +1005,7 @@ void TuckerEngine::loadActionsTable() {
}
}
} else {
- if (_spritesTable[_csDataTableCount - 1].firstFrame - 1 != _spritesTable[_csDataTableCount - 1].animationFrame) {
+ if (_spritesTable[_csDataTableCount - 1]._firstFrame - 1 != _spritesTable[_csDataTableCount - 1]._animationFrame) {
break;
}
}
@@ -1030,7 +1031,7 @@ void TuckerEngine::loadActionsTable() {
_panelState = 0;
setCursorType(0);
_csDataHandled = false;
- _actionVerbLocked = 0;
+ _actionVerbLocked = false;
_mouseClick = 1;
}
}
diff --git a/engines/tucker/saveload.cpp b/engines/tucker/saveload.cpp
index 5133bc15e8..92da2d4d9b 100644
--- a/engines/tucker/saveload.cpp
+++ b/engines/tucker/saveload.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -64,8 +64,8 @@ void TuckerEngine::saveOrLoadGameStateData(S &s) {
saveOrLoadInt(s, _panelObjectsOffsetTable[i]);
}
saveOrLoadInt(s, _mainSpritesBaseOffset);
- saveOrLoadInt(s, _selectedObject.xPos);
- saveOrLoadInt(s, _selectedObject.yPos);
+ saveOrLoadInt(s, _selectedObject._xPos);
+ saveOrLoadInt(s, _selectedObject._yPos);
saveOrLoadInt(s, _locationNum);
saveOrLoadInt(s, _xPosCurrent);
saveOrLoadInt(s, _yPosCurrent);
diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp
index bd03eed00b..2fb881f77e 100644
--- a/engines/tucker/sequences.cpp
+++ b/engines/tucker/sequences.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -306,7 +306,7 @@ void TuckerEngine::handleMeanwhileSequence() {
void TuckerEngine::handleMapSequence() {
loadImage("map2.pcx", _quadBackgroundGfxBuf + 89600, 0);
loadImage("map1.pcx", _loadTempBuf, 1);
- _selectedObject.locationObject_locationNum = 0;
+ _selectedObject._locationObjectLocationNum = 0;
if (_flagsTable[7] > 0) {
copyMapRect(0, 0, 140, 86);
}
@@ -419,7 +419,7 @@ void TuckerEngine::copyMapRect(int x, int y, int w, int h) {
}
}
-int TuckerEngine::handleSpecialObjectSelectionSequence() {
+bool TuckerEngine::handleSpecialObjectSelectionSequence() {
char filename[40];
if (_partNum == 1 && _selectedObjectNum == 6) {
strcpy(filename, "news1.pcx");
@@ -436,7 +436,7 @@ int TuckerEngine::handleSpecialObjectSelectionSequence() {
} else if (_currentInfoString1SourceType == 1 && _currentActionObj1Num == 91) {
strcpy(filename, "memo.pcx");
} else {
- return 0;
+ return false;
}
while (_fadePaletteCounter > 0) {
fadeInPalette();
@@ -460,10 +460,10 @@ int TuckerEngine::handleSpecialObjectSelectionSequence() {
}
if (_partNum == 3 && _selectedObjectNum == 45) {
for (int i = 0; i < 13; ++i) {
- const int offset = _dataTable[204 + i].yDest * 640 + _dataTable[204 + i].xDest;
+ const int offset = _dataTable[204 + i]._yDest * 640 + _dataTable[204 + i]._xDest;
static const int itemsTable[] = { 15, 44, 25, 19, 21, 24, 12, 27, 20, 29, 35, 23, 3 };
if (_inventoryItemsState[itemsTable[i]] > 1) {
- Graphics::decodeRLE(_locationBackgroundGfxBuf + _scrollOffset + offset, _data3GfxBuf + _dataTable[204 + i].sourceOffset, _dataTable[204 + i].xSize, _dataTable[204 + i].ySize);
+ Graphics::decodeRLE(_locationBackgroundGfxBuf + _scrollOffset + offset, _data3GfxBuf + _dataTable[204 + i]._sourceOffset, _dataTable[204 + i]._xSize, _dataTable[204 + i]._ySize);
}
}
}
@@ -479,7 +479,7 @@ int TuckerEngine::handleSpecialObjectSelectionSequence() {
}
}
loadLoc();
- return 1;
+ return true;
}
AnimationSequencePlayer::AnimationSequencePlayer(OSystem *system, Audio::Mixer *mixer, Common::EventManager *event, CompressedSound *sound, int num)
@@ -487,11 +487,20 @@ AnimationSequencePlayer::AnimationSequencePlayer(OSystem *system, Audio::Mixer *
memset(_animationPalette, 0, sizeof(_animationPalette));
_soundSeqDataCount = 0;
_soundSeqDataIndex = 0;
- _soundSeqData = 0;
+ _soundSeqData = nullptr;
_offscreenBuffer = (uint8 *)malloc(kScreenWidth * kScreenHeight);
_updateScreenWidth = 0;
_updateScreenPicture = false;
- _picBufPtr = _pic2BufPtr = 0;
+ _picBufPtr = _pic2BufPtr = nullptr;
+
+ _changeToNextSequence = false;
+ _updateFunc = nullptr;
+ _updateFuncIndex = 0;
+ _updateScreenCounter = 0;
+ _updateScreenIndex = -1;
+ _frameCounter = 0;
+ _frameTime = 0;
+ _lastFrameTime = 1;
}
AnimationSequencePlayer::~AnimationSequencePlayer() {
@@ -722,13 +731,12 @@ void AnimationSequencePlayer::fadeOutPalette() {
void AnimationSequencePlayer::unloadAnimation() {
_mixer->stopAll();
free(_picBufPtr);
- _picBufPtr = 0;
free(_pic2BufPtr);
- _pic2BufPtr = 0;
+ _picBufPtr = _pic2BufPtr = nullptr;
}
uint8 *AnimationSequencePlayer::loadPicture(const char *fileName) {
- uint8 *p = 0;
+ uint8 *p = nullptr;
Common::File f;
if (f.open(fileName)) {
const int sz = f.size();
diff --git a/engines/tucker/staticres.cpp b/engines/tucker/staticres.cpp
index 388f5ba05c..b884851d7e 100644
--- a/engines/tucker/staticres.cpp
+++ b/engines/tucker/staticres.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp
index 04e83efbe5..adf4be6b65 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -43,6 +43,33 @@ namespace Tucker {
TuckerEngine::TuckerEngine(OSystem *system, Common::Language language, uint32 flags)
: Engine(system), _gameLang(language), _gameFlags(flags), _rnd("tucker") {
_console = new TuckerConsole(this);
+
+ resetVariables();
+
+ _execData3Counter = 0;
+ _currentSaveLoadGameState = 1;
+ _fileLoadSize = 0;
+ _csDataSize = 0;
+
+ _player = nullptr;
+ _loadTempBuf = nullptr;
+ _cursorGfxBuf = nullptr;
+ _charsetGfxBuf = nullptr;
+ _panelGfxBuf = nullptr;
+ _itemsGfxBuf = nullptr;
+ _spritesGfxBuf = nullptr;
+ _locationBackgroundGfxBuf = nullptr;
+ _data5Buf = nullptr;
+ _data3GfxBuf = nullptr;
+ _quadBackgroundGfxBuf = nullptr;
+ _objTxtBuf = nullptr;
+ _panelObjectsGfxBuf = nullptr;
+ _ptTextBuf = nullptr;
+ _infoBarBuf = nullptr;
+ _bgTextBuf = nullptr;
+ _charNameBuf = nullptr;
+ _locationBackgroundMaskBuf = nullptr;
+ _csDataBuf = nullptr;
}
TuckerEngine::~TuckerEngine() {
@@ -84,17 +111,17 @@ void TuckerEngine::allocateBuffers() {
_charsetGfxBuf = (uint8 *)calloc(1, 22400);
_cursorGfxBuf = (uint8 *)calloc(1, 256 * 7);
_infoBarBuf = (uint8 *)calloc(1, 1000);
- _charNameBuf = 0;
- _bgTextBuf = 0;
- _objTxtBuf = 0;
+ _charNameBuf = nullptr;
+ _bgTextBuf = nullptr;
+ _objTxtBuf = nullptr;
_panelObjectsGfxBuf = (uint8 *)calloc(1, 20000);
- _data5Buf = 0;
+ _data5Buf = nullptr;
_data3GfxBuf = (uint8 *)calloc(1, 250000);
_quadBackgroundGfxBuf = (uint8 *)calloc(1, 320 * 140 * 4);
_locationBackgroundMaskBuf = (uint8 *)calloc(1, 640 * 140);
- _csDataBuf = 0;
+ _csDataBuf = nullptr;
_spritesGfxBuf = (uint8 *)calloc(1, 160000);
- _ptTextBuf = 0;
+ _ptTextBuf = nullptr;
memset(_charWidthTable, 0, sizeof(_charWidthTable));
}
@@ -119,7 +146,7 @@ void TuckerEngine::freeBuffers() {
free(_ptTextBuf);
}
-void TuckerEngine::restart() {
+void TuckerEngine::resetVariables() {
_quitGame = false;
_fastMode = false;
_syncCounter = 0;
@@ -131,15 +158,16 @@ void TuckerEngine::restart() {
_nextLocationNum = (_gameFlags & kGameFlagDemo) == 0 ? kStartupLocationGame : kStartupLocationDemo;
_gamePaused = false;
_gameDebug = false;
- _displayGameHints = false;
_displaySpeechText = (_gameFlags & kGameFlagNoSubtitles) == 0 ? ConfMan.getBool("subtitles") : false;
memset(_flagsTable, 0, sizeof(_flagsTable));
_gameHintsIndex = 0;
_gameHintsCounter = 0;
- _gameHintsDisplayText = 0;
_gameHintsStringNum = 0;
+ _displayGameHints = false;
+ _displayHintsText = false;
+
if ((_gameFlags & kGameFlagDemo) == 0) {
_locationWidthTable = _locationWidthTableGame;
_locationHeightTable = _locationHeightTableGame;
@@ -189,7 +217,7 @@ void TuckerEngine::restart() {
_switchPanelCounter = 0;
_conversationOptionsCount = 0;
_fadedPanel = false;
- _panelLockedFlag = 0;
+ _panelLockedFlag = false;
_conversationOptionLinesCount = 0;
memset(_inventoryItemsState, 0, sizeof(_inventoryItemsState));
memset(_inventoryObjectsList, 0, sizeof(_inventoryObjectsList));
@@ -223,11 +251,11 @@ void TuckerEngine::restart() {
_selectedCharacterNum = 0;
_actionObj1Type = _actionObj2Type = 0;
_actionObj1Num = _actionObj2Num = 0;
- _actionRequiresTwoObjects = 0;
- _actionVerbLocked = 0;
+ _actionRequiresTwoObjects = false;
+ _actionVerbLocked = false;
_actionPosX = 0;
_actionPosY = 0;
- _selectedObjectLocationMask = 0;
+ _selectedObjectLocationMask = false;
memset(&_selectedObject, 0, sizeof(_selectedObject));
_selectedCharacterDirection = 0;
_selectedCharacter2Num = 0;
@@ -247,10 +275,10 @@ void TuckerEngine::restart() {
_nextTableToLoadIndex = 0;
memset(_nextTableToLoadTable, 0, sizeof(_nextTableToLoadTable));
_soundInstructionIndex = 0;
- _tableInstructionsPtr = 0;
+ _tableInstructionsPtr = nullptr;
memset(_tableInstructionObj1Table, 0, sizeof(_tableInstructionObj1Table));
memset(_tableInstructionObj2Table, 0, sizeof(_tableInstructionObj2Table));
- _tableInstructionFlag = 0;
+ _tableInstructionFlag = false;
_tableInstructionItemNum1 = _tableInstructionItemNum2 = 0;
memset(_instructionsActionsTable, 0, sizeof(_instructionsActionsTable));
_validInstructionId = false;
@@ -266,7 +294,7 @@ void TuckerEngine::restart() {
_skipCurrentCharacterDraw = false;
_yPosCurrent = 131;
_xPosCurrent = 160;
- _characterSpeechDataPtr = 0;
+ _characterSpeechDataPtr = nullptr;
_ptTextOffset = 0;
memset(_characterAnimationsTable, 0, sizeof(_characterAnimationsTable));
memset(_characterStateTable, 0, sizeof(_characterStateTable));
@@ -279,26 +307,26 @@ void TuckerEngine::restart() {
_currentSpriteAnimationFrame2 = 0;
_characterAnimationIndex = -1;
_characterFacingDirection = _characterPrevFacingDirection = 0;
- _characterBackFrontFacing = _characterPrevBackFrontFacing = 0;
+ _characterBackFrontFacing = _characterPrevBackFrontFacing = false;
_characterAnimationNum = 0;
_noCharacterAnimationChange = 0;
- _changeBackgroundSprite = 0;
_characterSpriteAnimationFrameCounter = 0;
- _locationMaskIgnore = 0;
+ _locationMaskIgnore = false;
_locationMaskType = 0;
_locationMaskCounter = 0;
- _updateSpriteFlag1 = 0;
- _updateSpriteFlag2 = 0;
_handleMapCounter = 0;
_noPositionChangeAfterMap = false;
+ _changeBackgroundSprite = false;
+ _updateSpriteFlag1 = false;
+ _updateSpriteFlag2 = false;
- _mirroredDrawing = 0;
- _loadLocBufPtr = 0;
- _backgroundSpriteDataPtr = 0;
+ _mirroredDrawing = false;
+ _loadLocBufPtr = nullptr;
+ _backgroundSpriteDataPtr = nullptr;
_locationHeight = 0;
_scrollOffset = 0;
_currentGfxBackgroundCounter = 0;
- _currentGfxBackground = 0;
+ _currentGfxBackground = nullptr;
_fadePaletteCounter = 0;
memset(_currentPalette, 0, sizeof(_currentPalette));
_fullRedraw = false;
@@ -319,14 +347,14 @@ void TuckerEngine::restart() {
memset(_updateLocation14ObjNum, 0, sizeof(_updateLocation14ObjNum));
memset(_updateLocation14Delay, 0, sizeof(_updateLocation14Delay));
_updateLocationCounter2 = 0;
- _updateLocationFlag = 0;
+ _updateLocationFlag = false;
_updateLocation70StringLen = 0;
memset(_updateLocation70String, 0, sizeof(_updateLocation70String));
}
void TuckerEngine::mainLoop() {
allocateBuffers();
- restart();
+ resetVariables();
loadCharSizeDta();
if ((_gameFlags & kGameFlagDemo) != 0) {
@@ -352,7 +380,7 @@ void TuckerEngine::mainLoop() {
_flagsTable[219] = 1;
_flagsTable[105] = 1;
- _spriteAnimationFrameIndex = _spriteAnimationsTable[14].firstFrameIndex;
+ _spriteAnimationFrameIndex = _spriteAnimationsTable[14]._firstFrameIndex;
if (ConfMan.hasKey("save_slot")) {
const int slot = ConfMan.getInt("save_slot");
@@ -412,7 +440,7 @@ void TuckerEngine::mainLoop() {
}
if (_flagsTable[158] == 1) {
_flagsTable[158] = 0;
- _skipCurrentCharacterDraw = 1;
+ _skipCurrentCharacterDraw = true;
}
_mainLoopCounter1 = 0;
}
@@ -440,7 +468,7 @@ void TuckerEngine::mainLoop() {
updateGameHints();
}
if (_panelState == 0) {
- if (_panelLockedFlag == 1 || _pendingActionDelay > 0) {
+ if (_panelLockedFlag || _pendingActionDelay > 0) {
if (!_fadedPanel) {
updateItemsGfxColors(0x60, 0x80);
_fadedPanel = true;
@@ -450,7 +478,7 @@ void TuckerEngine::mainLoop() {
clearItemsGfx();
if (_gamePaused) {
drawPausedInfoBar();
- } else if (_gameHintsDisplayText == 1 && _mouseIdleCounter > 1000) {
+ } else if (_displayHintsText && _mouseIdleCounter > 1000) {
drawGameHintString();
} else {
drawInfoString();
@@ -466,10 +494,10 @@ void TuckerEngine::mainLoop() {
}
_currentGfxBackground = _quadBackgroundGfxBuf + (_currentGfxBackgroundCounter / 10) * 44800;
if (_fadePaletteCounter < 34 && _locationNum == 22) {
- _spritesTable[0].gfxBackgroundOffset = (_currentGfxBackgroundCounter / 10) * 640;
+ _spritesTable[0]._gfxBackgroundOffset = (_currentGfxBackgroundCounter / 10) * 640;
_mainSpritesBaseOffset = _currentGfxBackgroundCounter / 10;
if (_locationNum == 22 && _currentGfxBackgroundCounter <= 29) {
- _spritesTable[0].gfxBackgroundOffset = 640;
+ _spritesTable[0]._gfxBackgroundOffset = 640;
_mainSpritesBaseOffset = 1;
}
}
@@ -489,11 +517,11 @@ void TuckerEngine::mainLoop() {
drawData3();
execData3PreUpdate();
for (int i = 0; i < _spritesCount; ++i) {
- if (!_spritesTable[i].disabled) {
+ if (!_spritesTable[i]._disabled) {
drawSprite(i);
}
}
- if (_skipCurrentCharacterDraw != 1) {
+ if (!_skipCurrentCharacterDraw) {
if (_backgroundSpriteCurrentAnimation > -1 && _backgroundSpriteCurrentFrame > 0) {
drawBackgroundSprites();
} else {
@@ -522,7 +550,7 @@ void TuckerEngine::mainLoop() {
--_miscSoundFxDelayCounter[num];
if (_miscSoundFxDelayCounter[num] == 0) {
const int index = _miscSoundFxNum[num];
- startSound(_locationSoundsTable[index].offset, index, _locationSoundsTable[index].volume);
+ startSound(_locationSoundsTable[index]._offset, index, _locationSoundsTable[index]._volume);
}
}
}
@@ -565,7 +593,7 @@ void TuckerEngine::mainLoop() {
}
if (_inputKeys[kInputKeyHelp]) {
_inputKeys[kInputKeyHelp] = false;
- if (_displayGameHints && _gameHintsDisplayText == 1) {
+ if (_displayGameHints && _displayHintsText) {
_gameHintsStringNum = _gameHintsIndex + 1;
_mouseIdleCounter = 1100;
}
@@ -689,14 +717,14 @@ void TuckerEngine::setupNewLocation() {
_mainLoopCounter2 = 0;
_mainLoopCounter1 = 0;
_characterFacingDirection = 0;
- _actionVerbLocked = 0;
- _locationMaskIgnore = 0;
+ _actionVerbLocked = false;
+ _locationMaskIgnore = false;
_backgroundSprOffset = 0;
if (_backgroundSpriteCurrentAnimation > 0 && _backgroundSpriteCurrentFrame > 0) {
_backgroundSpriteCurrentAnimation = -1;
_backgroundSpriteCurrentFrame = 0;
}
- if (_panelLockedFlag == 0 || (_backgroundSpriteCurrentAnimation > 0 && _locationNum != 25)) {
+ if (!_panelLockedFlag || (_backgroundSpriteCurrentAnimation > 0 && _locationNum != 25)) {
_locationMaskType = 0;
} else {
_locationMaskType = 3;
@@ -829,8 +857,8 @@ void TuckerEngine::updateCharPosition() {
updateCharPositionHelper();
return;
case 1:
- if (_locationAnimationsTable[_selectedCharacter2Num].getFlag == 1) {
- _speechSoundNum = _speechSoundBaseNum + _locationAnimationsTable[_selectedCharacter2Num].inventoryNum;
+ if (_locationAnimationsTable[_selectedCharacter2Num]._getFlag == 1) {
+ _speechSoundNum = _speechSoundBaseNum + _locationAnimationsTable[_selectedCharacter2Num]._inventoryNum;
_characterSpeechDataPtr = _ptTextBuf;
updateCharPositionHelper();
return;
@@ -842,8 +870,8 @@ void TuckerEngine::updateCharPosition() {
break;
case 2:
_characterSpeechDataPtr = _ptTextBuf;
- _speechSoundNum = 2175 + _charPosTable[_selectedCharacterNum].description;
- if (_charPosTable[_selectedCharacterNum].description != 0) {
+ _speechSoundNum = 2175 + _charPosTable[_selectedCharacterNum]._description;
+ if (_charPosTable[_selectedCharacterNum]._description != 0) {
updateCharPositionHelper();
return;
}
@@ -852,59 +880,61 @@ void TuckerEngine::updateCharPosition() {
}
int actionKey = _currentActionObj2Num * 1000000 + _currentInfoString2SourceType * 100000 + _currentActionVerb * 10000 + _currentInfoString1SourceType * 1000 + _currentActionObj1Num;
debug(3, "updateCharPosition() actionKey %d", actionKey);
- int skip = 0;
- Action *action = 0;
- for (int i = 0; i < _actionsCount && skip == 0; ++i) {
+ bool skip = false;
+ Action *action = nullptr;
+ for (int i = 0; i < _actionsCount && !skip; ++i) {
action = &_actionsTable[i];
- if (action->key == actionKey) {
- skip = 1;
- if (action->testFlag1Num != 0) {
- if (action->testFlag1Num < 500) {
- if (_flagsTable[action->testFlag1Num] != action->testFlag1Value) {
- skip = 0;
+ if (action->_key == actionKey) {
+ skip = true;
+ if (action->_testFlag1Num != 0) {
+ if (action->_testFlag1Num < 500) {
+ if (action->_testFlag1Num >= 300)
+ error("updateCharPosition() - Unexpected value for _testFlag1Num : %d", action->_testFlag1Num);
+ if (_flagsTable[action->_testFlag1Num] != action->_testFlag1Value) {
+ skip = false;
}
- } else if (_inventoryItemsState[action->testFlag1Num - 500] != action->testFlag1Value) {
- skip = 0;
+ } else if (_inventoryItemsState[action->_testFlag1Num - 500] != action->_testFlag1Value) {
+ skip = false;
}
- debug(3, "updateCharPosition() flag1 %d value %d", action->testFlag1Num, action->testFlag1Value);
+ debug(3, "updateCharPosition() flag1 %d value %d", action->_testFlag1Num, action->_testFlag1Value);
}
- if (action->testFlag2Num != 0) {
- if (action->testFlag2Num < 500) {
- if (_flagsTable[action->testFlag2Num] != action->testFlag2Value) {
- skip = 0;
+ if (action->_testFlag2Num != 0) {
+ if (action->_testFlag2Num < 500) {
+ if (_flagsTable[action->_testFlag2Num] != action->_testFlag2Value) {
+ skip = false;
}
- } else if (_inventoryItemsState[action->testFlag2Num - 500] != action->testFlag2Value) {
- skip = 0;
+ } else if (_inventoryItemsState[action->_testFlag2Num - 500] != action->_testFlag2Value) {
+ skip = false;
}
- debug(3, "updateCharPosition() flag2 %d value %d", action->testFlag2Num, action->testFlag2Value);
+ debug(3, "updateCharPosition() flag2 %d value %d", action->_testFlag2Num, action->_testFlag2Value);
}
}
}
- if (skip == 0) {
+ if (!skip) {
playSpeechForAction(_currentActionVerb);
_currentActionVerb = 0;
return;
}
assert(action);
- if (action->speech != 6) {
- if (action->speech < 100) {
- _spriteAnimationFrameIndex = _spriteAnimationsTable[action->speech].firstFrameIndex;
- _currentSpriteAnimationLength = _spriteAnimationsTable[action->speech].numParts;
- _mirroredDrawing = action->flipX;
+ if (action->_speech != 6) {
+ if (action->_speech < 100) {
+ _spriteAnimationFrameIndex = _spriteAnimationsTable[action->_speech]._firstFrameIndex;
+ _currentSpriteAnimationLength = _spriteAnimationsTable[action->_speech]._numParts;
+ _mirroredDrawing = (action->_flipX != 0);
_characterFacingDirection = 5;
_mainLoopCounter2 = 0;
} else {
- _backgroundSpriteCurrentAnimation = action->speech - 100;
+ _backgroundSpriteCurrentAnimation = action->_speech - 100;
_backgroundSpriteCurrentFrame = 0;
- _mirroredDrawing = 0;
+ _mirroredDrawing = false;
}
}
- _pendingActionDelay = action->delay;
- _charPositionFlagNum = action->setFlagNum;
- _charPositionFlagValue = action->setFlagValue;
- _pendingActionIndex = action->index;
- _characterSoundFxDelayCounter = action->fxDelay;
- _characterSoundFxNum = action->fxNum;
+ _pendingActionDelay = action->_delay;
+ _charPositionFlagNum = action->_setFlagNum;
+ _charPositionFlagValue = action->_setFlagValue;
+ _pendingActionIndex = action->_index;
+ _characterSoundFxDelayCounter = action->_fxDelay;
+ _characterSoundFxNum = action->_fxNum;
_previousActionVerb = _currentActionVerb;
_currentActionVerb = 0;
}
@@ -980,10 +1010,10 @@ void TuckerEngine::setBlackPalette() {
void TuckerEngine::updateCursor() {
setCursorNum(0);
- if (_backgroundSpriteCurrentAnimation == -1 && _panelLockedFlag == 0 && _selectedObject.locationObject_locationNum > 0) {
- _selectedObject.locationObject_locationNum = 0;
+ if (_backgroundSpriteCurrentAnimation == -1 && !_panelLockedFlag && _selectedObject._locationObjectLocationNum > 0) {
+ _selectedObject._locationObjectLocationNum = 0;
}
- if (_locationMaskType > 0 || _selectedObject.locationObject_locationNum > 0 || _pendingActionDelay > 0) {
+ if (_locationMaskType > 0 || _selectedObject._locationObjectLocationNum > 0 || _pendingActionDelay > 0) {
return;
}
if (_rightMouseButtonPressed) {
@@ -993,13 +1023,13 @@ void TuckerEngine::updateCursor() {
_actionVerb = 0;
}
_updateCursorFlag = true;
- _actionVerbLocked = 1;
+ _actionVerbLocked = true;
_actionRequiresTwoObjects = false;
}
} else {
_updateCursorFlag = false;
}
- if (_actionVerbLocked == 0) {
+ if (!_actionVerbLocked) {
setActionVerbUnderCursor();
if (_actionVerb == 0 && _locationNum == 63) {
_actionVerb = 8;
@@ -1016,7 +1046,7 @@ void TuckerEngine::updateCursor() {
} else {
num = getObjectUnderCursor();
if (num > -1) {
- _selectedObjectNum = _locationObjectsTable[num].textNum;
+ _selectedObjectNum = _locationObjectsTable[num]._textNum;
}
}
handleMouseClickOnInventoryObject();
@@ -1027,7 +1057,7 @@ void TuckerEngine::updateCursor() {
_selectedObjectNum = 0;
_selectedObjectType = 0;
}
- if (_actionVerbLocked == 0 && _selectedObjectType == 2 && _selectedObjectNum != 21) {
+ if (!_actionVerbLocked && _selectedObjectType == 2 && _selectedObjectNum != 21) {
_actionVerb = 2;
}
if (!_actionRequiresTwoObjects) {
@@ -1055,7 +1085,7 @@ void TuckerEngine::updateCursor() {
if (_mousePosY >= 150 && _mousePosX < 212) {
if (_mousePosX < 200) {
setActionVerbUnderCursor();
- _actionVerbLocked = 1;
+ _actionVerbLocked = true;
_actionRequiresTwoObjects = false;
} else if (_mousePosY < 175) {
moveDownInventoryObjects();
@@ -1066,13 +1096,13 @@ void TuckerEngine::updateCursor() {
if (_selectedObjectType == 3) {
setActionForInventoryObject();
} else if (_actionVerb != 0) {
- _actionVerbLocked = 0;
+ _actionVerbLocked = false;
setActionState();
} else if (_actionObj1Num == 261 || (_actionObj1Num == 205 && _flagsTable[143] == 0)) {
- _actionVerbLocked = 0;
+ _actionVerbLocked = false;
setActionState();
} else {
- _actionVerbLocked = 0;
+ _actionVerbLocked = false;
_actionRequiresTwoObjects = false;
_currentActionVerb = 0;
setSelectedObjectKey();
@@ -1092,26 +1122,26 @@ void TuckerEngine::stopSounds() {
void TuckerEngine::playSounds() {
for (int i = 0; i < _locationSoundsCount; ++i) {
- if (_locationSoundsTable[i].type == 1 || _locationSoundsTable[i].type == 2 || _locationSoundsTable[i].type == 5 ||
- (_locationSoundsTable[i].type == 7 && _flagsTable[_locationSoundsTable[i].flagNum] == _locationSoundsTable[i].flagValueStartFx)) {
- startSound(_locationSoundsTable[i].offset, i, _locationSoundsTable[i].volume);
+ if (_locationSoundsTable[i]._type == 1 || _locationSoundsTable[i]._type == 2 || _locationSoundsTable[i]._type == 5 ||
+ (_locationSoundsTable[i]._type == 7 && _flagsTable[_locationSoundsTable[i]._flagNum] == _locationSoundsTable[i]._flagValueStartFx)) {
+ startSound(_locationSoundsTable[i]._offset, i, _locationSoundsTable[i]._volume);
}
}
for (int i = 0; i < _locationMusicsCount; ++i) {
- if (_locationMusicsTable[i].flag > 0) {
- startMusic(_locationMusicsTable[i].offset, i, _locationMusicsTable[i].volume);
+ if (_locationMusicsTable[i]._flag > 0) {
+ startMusic(_locationMusicsTable[i]._offset, i, _locationMusicsTable[i]._volume);
}
}
}
void TuckerEngine::updateCharactersPath() {
- if (_panelLockedFlag == 0) {
+ if (!_panelLockedFlag) {
return;
}
if (_backgroundSpriteCurrentAnimation != -1 && _locationNum != 25) {
- if (_xPosCurrent == _selectedObject.xPos && _yPosCurrent == _selectedObject.yPos) {
+ if (_xPosCurrent == _selectedObject._xPos && _yPosCurrent == _selectedObject._yPos) {
_locationMaskCounter = 1;
- _panelLockedFlag = 0;
+ _panelLockedFlag = false;
}
return;
}
@@ -1120,68 +1150,68 @@ void TuckerEngine::updateCharactersPath() {
if (_characterFacingDirection == 5) {
_characterPrevFacingDirection = 5;
}
- int flag = 0;
- if (_yPosCurrent > _selectedObject.yPos) {
- if (testLocationMask(_xPosCurrent, _yPosCurrent - 1) == 1) {
+ bool flag = false;
+ if (_yPosCurrent > _selectedObject._yPos) {
+ if (testLocationMask(_xPosCurrent, _yPosCurrent - 1)) {
--_yPosCurrent;
_characterFacingDirection = 4;
- flag = 1;
+ flag = true;
}
- } else if (_yPosCurrent < _selectedObject.yPos) {
- if (testLocationMask(_xPosCurrent, _yPosCurrent + 1) == 1) {
+ } else if (_yPosCurrent < _selectedObject._yPos) {
+ if (testLocationMask(_xPosCurrent, _yPosCurrent + 1)) {
++_yPosCurrent;
_characterFacingDirection = 2;
- flag = 1;
+ flag = true;
}
}
- if (_xPosCurrent > _selectedObject.xPos) {
- if (testLocationMask(_xPosCurrent - 1, _yPosCurrent) == 1) {
+ if (_xPosCurrent > _selectedObject._xPos) {
+ if (testLocationMask(_xPosCurrent - 1, _yPosCurrent)) {
--_xPosCurrent;
_characterFacingDirection = 3;
- _characterBackFrontFacing = 0;
- flag = 1;
+ _characterBackFrontFacing = false;
+ flag = true;
}
- } else if (_xPosCurrent < _selectedObject.xPos) {
- if (testLocationMask(_xPosCurrent + 1, _yPosCurrent) == 1) {
+ } else if (_xPosCurrent < _selectedObject._xPos) {
+ if (testLocationMask(_xPosCurrent + 1, _yPosCurrent)) {
++_xPosCurrent;
_characterFacingDirection = 1;
- _characterBackFrontFacing = 1;
- flag = 1;
+ _characterBackFrontFacing = true;
+ flag = true;
}
}
- if (flag == 0) {
- if (_selectedObjectLocationMask == 1) {
- _selectedObjectLocationMask = 0;
- _selectedObject.xPos = _selectedObject.xDefaultPos;
- _selectedObject.yPos = _selectedObject.yDefaultPos;
+ if (!flag) {
+ if (_selectedObjectLocationMask) {
+ _selectedObjectLocationMask = false;
+ _selectedObject._xPos = _selectedObject._xDefaultPos;
+ _selectedObject._yPos = _selectedObject._yDefaultPos;
} else {
- _panelLockedFlag = 0;
+ _panelLockedFlag = false;
_characterFacingDirection = 0;
- if (_xPosCurrent == _selectedObject.xPos && _yPosCurrent == _selectedObject.yPos) {
+ if (_xPosCurrent == _selectedObject._xPos && _yPosCurrent == _selectedObject._yPos) {
_locationMaskCounter = 1;
}
}
}
if (_locationNum == 25) {
- if ((_backgroundSpriteCurrentAnimation != 3 || _characterBackFrontFacing != 0) && (_backgroundSpriteCurrentAnimation != 6 || _characterBackFrontFacing != 1)) {
+ if ((_backgroundSpriteCurrentAnimation != 3 || _characterBackFrontFacing) && (_backgroundSpriteCurrentAnimation != 6 || !_characterBackFrontFacing)) {
_xPosCurrent = xPos;
_yPosCurrent = yPos;
return;
}
}
- if (_xPosCurrent != _selectedObject.xPos || _yPosCurrent != _selectedObject.yPos) {
+ if (_xPosCurrent != _selectedObject._xPos || _yPosCurrent != _selectedObject._yPos) {
return;
}
- if (_selectedObjectLocationMask != 0) {
+ if (_selectedObjectLocationMask) {
return;
}
_locationMaskCounter = 1;
- _panelLockedFlag = 0;
- _locationMaskIgnore = 0;
+ _panelLockedFlag = false;
+ _locationMaskIgnore = false;
if (_characterPrevFacingDirection <= 0 || _characterPrevFacingDirection >= 5) {
return;
}
- if (_selectedObject.locationObject_locationNum == 0) {
+ if (_selectedObject._locationObjectLocationNum == 0) {
_characterFacingDirection = 5;
while (_spriteAnimationFramesTable[_spriteAnimationFrameIndex] != 999) {
++_spriteAnimationFrameIndex;
@@ -1200,12 +1230,12 @@ void TuckerEngine::setSoundVolumeDistance() {
void TuckerEngine::updateData3DrawFlag() {
for (int i = 0; i < _locationAnimationsCount; ++i) {
LocationAnimation *a = &_locationAnimationsTable[i];
- if (a->flagNum > 0 && a->flagValue != _flagsTable[a->flagNum]) {
- a->drawFlag = 0;
- } else if (a->getFlag == 0) {
- a->drawFlag = 1;
+ if (a->_flagNum > 0 && a->_flagValue != _flagsTable[a->_flagNum]) {
+ a->_drawFlag = false;
+ } else if (a->_getFlag == 0) {
+ a->_drawFlag = true;
} else {
- a->drawFlag = (_inventoryItemsState[a->inventoryNum] == 0) ? 1 : 0;
+ a->_drawFlag = (_inventoryItemsState[a->_inventoryNum] == 0);
}
}
}
@@ -1214,26 +1244,26 @@ void TuckerEngine::updateData3() {
updateData3DrawFlag();
for (int i = 0; i < _locationAnimationsCount; ++i) {
LocationAnimation *a = &_locationAnimationsTable[i];
- if (a->animLastCounter != 0 && a->drawFlag != 0) {
- if (a->animLastCounter == a->animCurrentCounter) {
- a->animCurrentCounter = a->animInitCounter;
+ if (a->_animLastCounter != 0 && a->_drawFlag) {
+ if (a->_animLastCounter == a->_animCurrentCounter) {
+ a->_animCurrentCounter = a->_animInitCounter;
} else {
- ++a->animCurrentCounter;
+ ++a->_animCurrentCounter;
}
- const int index = a->animCurrentCounter;
+ const int index = a->_animCurrentCounter;
if (_staticData3Table[index] == 998) {
_flagsTable[_staticData3Table[index + 1]] = _staticData3Table[index + 2];
- a->animCurrentCounter = a->animInitCounter;
- a->drawFlag = 0;
+ a->_animCurrentCounter = a->_animInitCounter;
+ a->_drawFlag = false;
}
if (_locationNum == 24 && i == 0) {
// workaround bug #2872385: update fish animation sequence for correct
// position in aquarium.
- if (a->animInitCounter == 505 && a->animCurrentCounter == 513) {
- a->animCurrentCounter = 525;
+ if (a->_animInitCounter == 505 && a->_animCurrentCounter == 513) {
+ a->_animCurrentCounter = 525;
}
}
- a->graphicNum = _staticData3Table[a->animCurrentCounter];
+ a->_graphicNum = _staticData3Table[a->_animCurrentCounter];
}
}
updateData3DrawFlag();
@@ -1242,16 +1272,16 @@ void TuckerEngine::updateData3() {
void TuckerEngine::updateSfxData3_1() {
for (int i = 0; i < _locationSoundsCount; ++i) {
LocationSound *s = &_locationSoundsTable[i];
- if ((s->type == 6 || s->type == 7) && s->updateType == 1) {
+ if ((s->_type == 6 || s->_type == 7) && s->_updateType == 1) {
for (int j = 0; j < _spritesCount; ++j) {
- if (_spritesTable[j].animationFrame == s->startFxSpriteNum && _spritesTable[j].state == s->startFxSpriteState) {
- if (s->type == 7) {
- _flagsTable[s->flagNum] = s->flagValueStartFx;
+ if (_spritesTable[j]._animationFrame == s->_startFxSpriteNum && _spritesTable[j]._state == s->_startFxSpriteState) {
+ if (s->_type == 7) {
+ _flagsTable[s->_flagNum] = s->_flagValueStartFx;
}
- startSound(s->offset, i, s->volume);
- } else if (s->type == 7) {
- if (_spritesTable[j].animationFrame == s->stopFxSpriteNum && _spritesTable[j].state == s->stopFxSpriteState) {
- _flagsTable[s->flagNum] = s->flagValueStopFx;
+ startSound(s->_offset, i, s->_volume);
+ } else if (s->_type == 7) {
+ if (_spritesTable[j]._animationFrame == s->_stopFxSpriteNum && _spritesTable[j]._state == s->_stopFxSpriteState) {
+ _flagsTable[s->_flagNum] = s->_flagValueStopFx;
stopSound(i);
}
}
@@ -1263,15 +1293,15 @@ void TuckerEngine::updateSfxData3_1() {
void TuckerEngine::updateSfxData3_2() {
for (int i = 0; i < _locationSoundsCount; ++i) {
LocationSound *s = &_locationSoundsTable[i];
- if ((s->type == 6 || s->type == 7) && s->updateType == 0) {
- if (s->startFxSpriteNum == _backgroundSpriteCurrentFrame && s->startFxSpriteState == _backgroundSpriteCurrentAnimation) {
- if (s->type == 7) {
- _flagsTable[s->flagNum] = s->flagValueStartFx;
+ if ((s->_type == 6 || s->_type == 7) && s->_updateType == 0) {
+ if (s->_startFxSpriteNum == _backgroundSpriteCurrentFrame && s->_startFxSpriteState == _backgroundSpriteCurrentAnimation) {
+ if (s->_type == 7) {
+ _flagsTable[s->_flagNum] = s->_flagValueStartFx;
}
- startSound(s->offset, i, s->volume);
- } else if (s->type == 7) {
- if (s->stopFxSpriteNum == _backgroundSpriteCurrentFrame && s->stopFxSpriteState == _backgroundSpriteCurrentAnimation) {
- _flagsTable[s->flagNum] = s->flagValueStopFx;
+ startSound(s->_offset, i, s->_volume);
+ } else if (s->_type == 7) {
+ if (s->_stopFxSpriteNum == _backgroundSpriteCurrentFrame && s->_stopFxSpriteState == _backgroundSpriteCurrentAnimation) {
+ _flagsTable[s->_flagNum] = s->_flagValueStopFx;
stopSound(i);
}
}
@@ -1422,7 +1452,7 @@ void TuckerEngine::redrawPanelOverBackground() {
void TuckerEngine::drawConversationTexts() {
int y = 141;
- int flag = 0;
+ bool flag = false;
for (int i = 0; i < _conversationOptionsCount; ++i) {
int color = 108;
if ((_mousePosY > y && _mousePosY < y + 11) || _nextTableToLoadIndex == i) {
@@ -1431,11 +1461,11 @@ void TuckerEngine::drawConversationTexts() {
drawSpeechText(0, y, _characterSpeechDataPtr, _instructionsActionsTable[i], color);
if (_mousePosY > y && _mousePosY < _conversationOptionLinesCount * 10 + y + 1) {
_nextTableToLoadIndex = i;
- flag = 1;
+ flag = true;
}
y += _conversationOptionLinesCount * 10;
}
- if (flag == 0) {
+ if (!flag) {
_nextTableToLoadIndex = -1;
}
}
@@ -1471,31 +1501,31 @@ void TuckerEngine::updateGameHints() {
if (_gameHintsIndex == 0 && _flagsTable[3] > 0) {
_gameHintsIndex = 1;
_gameHintsCounter = 0;
- _gameHintsDisplayText = 0;
+ _displayHintsText = false;
} else if (_gameHintsIndex == 1 && _flagsTable[12] > 0) {
_gameHintsIndex = 2;
_gameHintsCounter = 0;
- _gameHintsDisplayText = 0;
+ _displayHintsText = false;
} else if (_gameHintsIndex == 2 && _flagsTable[20] > 0) {
_gameHintsIndex = 3;
_gameHintsCounter = 0;
- _gameHintsDisplayText = 0;
+ _displayHintsText = false;
} else if (_gameHintsIndex == 3 && _flagsTable[9] > 0) {
_gameHintsIndex = 4;
_gameHintsCounter = 0;
- _gameHintsDisplayText = 0;
+ _displayHintsText = false;
} else if (_gameHintsIndex == 4 && _flagsTable[23] > 0) {
_gameHintsIndex = 5;
_gameHintsCounter = 0;
- _gameHintsDisplayText = 0;
+ _displayHintsText = false;
} else if (_flagsTable[19] > 0) {
_gameHintsIndex = 6;
_gameHintsCounter = 0;
- _gameHintsDisplayText = 0;
+ _displayHintsText = false;
}
++_gameHintsCounter;
if (_gameHintsCounter > 1500) {
- _gameHintsDisplayText = 1;
+ _displayHintsText = true;
}
}
@@ -1503,7 +1533,7 @@ void TuckerEngine::startCharacterSounds() {
if (_characterSoundFxDelayCounter != 0) {
--_characterSoundFxDelayCounter;
if (_characterSoundFxDelayCounter <= 0) {
- startSound(_locationSoundsTable[_characterSoundFxNum].offset, _characterSoundFxNum, _locationSoundsTable[_characterSoundFxNum].volume);
+ startSound(_locationSoundsTable[_characterSoundFxNum]._offset, _characterSoundFxNum, _locationSoundsTable[_characterSoundFxNum]._volume);
}
}
}
@@ -1513,16 +1543,16 @@ void TuckerEngine::updateSoundsTypes3_4() {
return;
}
for (int i = 0; i < _locationSoundsCount; ++i) {
- switch (_locationSoundsTable[i].type) {
+ switch (_locationSoundsTable[i]._type) {
case 3:
if (getRandomNumber() >= 32300) {
- startSound(_locationSoundsTable[i].offset, 0, _locationSoundsTable[i].volume);
+ startSound(_locationSoundsTable[i]._offset, 0, _locationSoundsTable[i]._volume);
return;
}
break;
case 4:
if (getRandomNumber() >= 32763) {
- startSound(_locationSoundsTable[i].offset, 0, _locationSoundsTable[i].volume);
+ startSound(_locationSoundsTable[i]._offset, 0, _locationSoundsTable[i]._volume);
return;
}
break;
@@ -1532,11 +1562,11 @@ void TuckerEngine::updateSoundsTypes3_4() {
void TuckerEngine::drawData3() {
for (int i = 0; i < _locationAnimationsCount; ++i) {
- if (_locationAnimationsTable[i].drawFlag != 0) {
- int num = _locationAnimationsTable[i].graphicNum;
+ if (_locationAnimationsTable[i]._drawFlag) {
+ int num = _locationAnimationsTable[i]._graphicNum;
const Data *d = &_dataTable[num];
- Graphics::decodeRLE(_locationBackgroundGfxBuf + d->yDest * 640 + d->xDest, _data3GfxBuf + d->sourceOffset, d->xSize, d->ySize);
- addDirtyRect(d->xDest, d->yDest, d->xSize, d->ySize);
+ Graphics::decodeRLE(_locationBackgroundGfxBuf + d->_yDest * 640 + d->_xDest, _data3GfxBuf + d->_sourceOffset, d->_xSize, d->_ySize);
+ addDirtyRect(d->_xDest, d->_yDest, d->_xSize, d->_ySize);
}
}
}
@@ -1750,28 +1780,28 @@ void TuckerEngine::drawCurrentSprite() {
// Workaround original game glitch: location 14 contains some colors from [0xE0-0xF8] in a walkable area (tracker item #3106542)
const bool color248Only = (_locationNum == 14);
SpriteFrame *chr = &_spriteFramesTable[_currentSpriteAnimationFrame];
- int yPos = _yPosCurrent + _mainSpritesBaseOffset - 54 + chr->yOffset;
+ int yPos = _yPosCurrent + _mainSpritesBaseOffset - 54 + chr->_yOffset;
int xPos = _xPosCurrent;
- if (_mirroredDrawing == 0) {
- xPos += chr->xOffset - 14;
+ if (!_mirroredDrawing) {
+ xPos += chr->_xOffset - 14;
} else {
- xPos -= chr->xSize + chr->xOffset - 14;
+ xPos -= chr->_xSize + chr->_xOffset - 14;
}
- Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr->sourceOffset, chr->xSize, chr->ySize,
- chr->yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0, color248Only);
- addDirtyRect(xPos, yPos, chr->xSize, chr->ySize);
+ Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr->_sourceOffset, chr->_xSize, chr->_ySize,
+ chr->_yOffset, _locationHeightTable[_locationNum], _mirroredDrawing, color248Only);
+ addDirtyRect(xPos, yPos, chr->_xSize, chr->_ySize);
if (_currentSpriteAnimationLength > 1) {
SpriteFrame *chr2 = &_spriteFramesTable[_currentSpriteAnimationFrame2];
- yPos = _yPosCurrent + _mainSpritesBaseOffset - 54 + chr2->yOffset;
+ yPos = _yPosCurrent + _mainSpritesBaseOffset - 54 + chr2->_yOffset;
xPos = _xPosCurrent;
- if (_mirroredDrawing == 0) {
- xPos += chr2->xOffset - 14;
+ if (!_mirroredDrawing) {
+ xPos += chr2->_xOffset - 14;
} else {
- xPos -= chr2->xSize + chr2->xOffset - 14;
+ xPos -= chr2->_xSize + chr2->_xOffset - 14;
}
- Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr2->sourceOffset, chr2->xSize, chr2->ySize,
- chr2->yOffset, _locationHeightTable[_locationNum], _mirroredDrawing != 0, color248Only);
- addDirtyRect(xPos, yPos, chr2->xSize, chr2->ySize);
+ Graphics::decodeRLE_248(_locationBackgroundGfxBuf + yPos * 640 + xPos, _spritesGfxBuf + chr2->_sourceOffset, chr2->_xSize, chr2->_ySize,
+ chr2->_yOffset, _locationHeightTable[_locationNum], _mirroredDrawing, color248Only);
+ addDirtyRect(xPos, yPos, chr2->_xSize, chr2->_ySize);
}
}
@@ -1790,8 +1820,8 @@ void TuckerEngine::setVolumeMusic(int index, int volume) {
}
void TuckerEngine::startSound(int offset, int index, int volume) {
- bool loop = (_locationSoundsTable[index].type == 2 || _locationSoundsTable[index].type == 5 || _locationSoundsTable[index].type == 7);
- loadSound(Audio::Mixer::kSFXSoundType, _locationSoundsTable[index].num, volume, loop, &_sfxHandles[index]);
+ bool loop = (_locationSoundsTable[index]._type == 2 || _locationSoundsTable[index]._type == 5 || _locationSoundsTable[index]._type == 7);
+ loadSound(Audio::Mixer::kSFXSoundType, _locationSoundsTable[index]._num, volume, loop, &_sfxHandles[index]);
}
void TuckerEngine::stopSound(int index) {
@@ -1803,8 +1833,8 @@ bool TuckerEngine::isSoundPlaying(int index) {
}
void TuckerEngine::startMusic(int offset, int index, int volume) {
- bool loop = (_locationMusicsTable[index].flag == 2);
- loadSound(Audio::Mixer::kMusicSoundType, _locationMusicsTable[index].num, volume, loop, &_musicHandles[index]);
+ bool loop = (_locationMusicsTable[index]._flag == 2);
+ loadSound(Audio::Mixer::kMusicSoundType, _locationMusicsTable[index]._num, volume, loop, &_musicHandles[index]);
}
void TuckerEngine::stopMusic(int index) {
@@ -1831,14 +1861,16 @@ void TuckerEngine::rememberSpeechSound() {
}
void TuckerEngine::redrawPanelItems() {
- const uint8 *src = 0;
- uint8 *dst = 0;
- int sz = 0;
if (_forceRedrawPanelItems || (_redrawPanelItemsCounter != 0 && _panelState == 0)) {
_forceRedrawPanelItems = false;
if (_redrawPanelItemsCounter > 0) {
--_redrawPanelItemsCounter;
}
+
+ const uint8 *src = nullptr;
+ uint8 *dst = nullptr;
+ int sz = 0;
+
switch (_panelState) {
case 0:
src = _panelGfxBuf;
@@ -1892,25 +1924,25 @@ void TuckerEngine::redrawPanelItemsHelper() {
void TuckerEngine::drawSprite(int num) {
Sprite *s = &_spritesTable[num];
- if (s->animationFrame <= s->firstFrame && s->animationFrame > 0 && s->state != -1) {
- const uint8 *p = s->animationData;
+ if (s->_animationFrame <= s->_firstFrame && s->_animationFrame > 0 && s->_state != -1) {
+ const uint8 *p = s->_animationData;
if (!p) {
return;
}
- int frameOffset = READ_LE_UINT24(p + s->animationFrame * 4);
+ int frameOffset = READ_LE_UINT24(p + s->_animationFrame * 4);
int srcW = READ_LE_UINT16(p + frameOffset);
int srcH = READ_LE_UINT16(p + frameOffset + 2);
int srcX = READ_LE_UINT16(p + frameOffset + 8);
int srcY = READ_LE_UINT16(p + frameOffset + 10);
- int xPos = s->gfxBackgroundOffset + srcX;
+ int xPos = s->_gfxBackgroundOffset + srcX;
if (xPos < 600 && (_scrollOffset + 320 < xPos || _scrollOffset - srcW > xPos)) {
return;
}
- s->xSource = srcX;
- s->gfxBackgroundOffset += s->backgroundOffset;
+ s->_xSource = srcX;
+ s->_gfxBackgroundOffset += s->_backgroundOffset;
uint8 *dstPtr = _locationBackgroundGfxBuf + srcY * 640 + xPos;
const uint8 *srcPtr = p + frameOffset + 12;
- switch (s->colorType) {
+ switch (s->_colorType) {
case 0:
Graphics::decodeRLE(dstPtr, srcPtr, srcW, srcH);
break;
@@ -1918,11 +1950,11 @@ void TuckerEngine::drawSprite(int num) {
Graphics::decodeRLE_224(dstPtr, srcPtr, srcW, srcH);
break;
default:
- Graphics::decodeRLE_248(dstPtr, srcPtr, srcW, srcH, 0, s->yMaxBackground, s->flipX != 0);
+ Graphics::decodeRLE_248(dstPtr, srcPtr, srcW, srcH, 0, s->_yMaxBackground, s->_flipX);
break;
}
- const int xR = srcX + (s->gfxBackgroundOffset % 640);
- const int yR = srcY + (s->gfxBackgroundOffset / 640);
+ const int xR = srcX + (s->_gfxBackgroundOffset % 640);
+ const int yR = srcY + (s->_gfxBackgroundOffset / 640);
addDirtyRect(xR, yR, srcW, srcH);
}
}
@@ -1938,7 +1970,7 @@ void TuckerEngine::drawPausedInfoBar() {
}
const uint8 *TuckerEngine::getStringBuf(int type) const {
- const uint8 *p = 0;
+ const uint8 *p = nullptr;
switch (type) {
case 0:
p = _data5Buf;
@@ -2031,7 +2063,7 @@ void TuckerEngine::updateCharacterAnimation() {
++_spriteAnimationFrameIndex;
}
_characterFacingDirection = 0;
- if (_changeBackgroundSprite == 1) {
+ if (_changeBackgroundSprite) {
if (_backgroundSpriteCurrentFrame == 0) {
_backgroundSpriteDataPtr = _sprA02Table[_backgroundSpriteCurrentAnimation];
_backgroundSpriteCurrentFrame = _backgroundSpriteLastFrame = READ_LE_UINT16(_backgroundSpriteDataPtr);
@@ -2040,7 +2072,7 @@ void TuckerEngine::updateCharacterAnimation() {
if (_backgroundSpriteCurrentFrame < 1) {
_backgroundSpriteCurrentAnimation = -1;
_backgroundSpriteCurrentFrame = 0;
- _changeBackgroundSprite = 0;
+ _changeBackgroundSprite = false;
if (_nextAction == 0) {
setCursorType(0);
}
@@ -2052,7 +2084,7 @@ void TuckerEngine::updateCharacterAnimation() {
assert(_backgroundSpriteCurrentAnimation >= 0 && _backgroundSpriteCurrentAnimation < kSprA02TableSize);
_backgroundSpriteDataPtr = _sprA02Table[_backgroundSpriteCurrentAnimation];
_backgroundSpriteLastFrame = READ_LE_UINT16(_backgroundSpriteDataPtr);
- } else if (_locationNum == 25 && _panelLockedFlag != 1 && (_backgroundSpriteCurrentAnimation == 3 || _backgroundSpriteCurrentAnimation == 6)) {
+ } else if (_locationNum == 25 && !_panelLockedFlag && (_backgroundSpriteCurrentAnimation == 3 || _backgroundSpriteCurrentAnimation == 6)) {
_backgroundSpriteCurrentFrame = 0;
_backgroundSpriteCurrentAnimation = -1;
} else {
@@ -2068,9 +2100,9 @@ void TuckerEngine::updateCharacterAnimation() {
}
}
if (_locationNum == 24 && _flagsTable[103] == 0) {
- if (_panelLockedFlag == 1) {
- _panelLockedFlag = 0;
- _selectedObject.locationObject_locationNum = 0;
+ if (_panelLockedFlag) {
+ _panelLockedFlag = false;
+ _selectedObject._locationObjectLocationNum = 0;
if (_actionVerb != 2) {
_speechSoundNum = 2236;
startSpeechSound(_speechSoundNum, _speechVolume);
@@ -2105,10 +2137,10 @@ void TuckerEngine::updateCharacterAnimation() {
}
} else if (_locationNum == 25) {
if (_backgroundSpriteCurrentFrame == 0) {
- if (_characterBackFrontFacing == 0) {
+ if (!_characterBackFrontFacing) {
if (_characterBackFrontFacing != _characterPrevBackFrontFacing) {
_backgroundSpriteCurrentAnimation = 10;
- } else if (_panelLockedFlag == 1) {
+ } else if (_panelLockedFlag) {
_backgroundSpriteCurrentAnimation = 3;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == 99) {
_backgroundSpriteCurrentAnimation = 8;
@@ -2118,7 +2150,7 @@ void TuckerEngine::updateCharacterAnimation() {
} else {
if (_characterBackFrontFacing != _characterPrevBackFrontFacing) {
_backgroundSpriteCurrentAnimation = 2;
- } else if (_panelLockedFlag == 1) {
+ } else if (_panelLockedFlag) {
_backgroundSpriteCurrentAnimation = 6;
} else if (_charSpeechSoundCounter > 0 && _actionCharacterNum == 99) {
_backgroundSpriteCurrentAnimation = 9;
@@ -2143,7 +2175,7 @@ void TuckerEngine::updateCharacterAnimation() {
_backgroundSpriteLastFrame = READ_LE_UINT16(_backgroundSpriteDataPtr);
}
int frame = _spriteAnimationFramesTable[_spriteAnimationFrameIndex];
- if (_panelLockedFlag == 0 && _characterFacingDirection < 5 && _selectedObject.locationObject_locationNum == 0) {
+ if (!_panelLockedFlag && _characterFacingDirection < 5 && _selectedObject._locationObjectLocationNum == 0) {
_characterFacingDirection = 0;
}
if (_charSpeechSoundCounter > 0 && _characterFacingDirection != 6 && _actionCharacterNum == 99) {
@@ -2155,7 +2187,7 @@ void TuckerEngine::updateCharacterAnimation() {
}
int num = 0;
if (frame == 999 || (_characterFacingDirection != _characterPrevFacingDirection && _characterFacingDirection < 5)) {
- _mirroredDrawing = 0;
+ _mirroredDrawing = false;
if (_characterFacingDirection == 6) {
if (_csDataHandled) {
switch (_selectedCharacterDirection) {
@@ -2170,7 +2202,7 @@ void TuckerEngine::updateCharacterAnimation() {
break;
default:
num = 16;
- _mirroredDrawing = 1;
+ _mirroredDrawing = true;
break;
}
} else {
@@ -2182,7 +2214,7 @@ void TuckerEngine::updateCharacterAnimation() {
}
if (_characterFacingDirection == 0) {
if (_csDataHandled) {
- _mirroredDrawing = 0;
+ _mirroredDrawing = false;
switch (_selectedCharacterDirection) {
case 1:
num = 3;
@@ -2192,7 +2224,7 @@ void TuckerEngine::updateCharacterAnimation() {
break;
case 3:
num = 1;
- _mirroredDrawing = 1;
+ _mirroredDrawing = true;
break;
default:
num = 5;
@@ -2218,21 +2250,21 @@ void TuckerEngine::updateCharacterAnimation() {
break;
case 3:
num = 0;
- _mirroredDrawing = 1;
+ _mirroredDrawing = true;
break;
case 4:
num = 2;
break;
}
}
- _currentSpriteAnimationLength = _spriteAnimationsTable[num].numParts;
- _spriteAnimationFrameIndex = _spriteAnimationsTable[num].firstFrameIndex;
+ _currentSpriteAnimationLength = _spriteAnimationsTable[num]._numParts;
+ _spriteAnimationFrameIndex = _spriteAnimationsTable[num]._firstFrameIndex;
frame = _spriteAnimationFramesTable[_spriteAnimationFrameIndex];
}
if (_characterAnimationNum > 0) {
num = _characterAnimationNum;
- _currentSpriteAnimationLength = _spriteAnimationsTable[num].numParts;
- _spriteAnimationFrameIndex = _spriteAnimationsTable[num].firstFrameIndex;
+ _currentSpriteAnimationLength = _spriteAnimationsTable[num]._numParts;
+ _spriteAnimationFrameIndex = _spriteAnimationsTable[num]._firstFrameIndex;
frame = _spriteAnimationFramesTable[_spriteAnimationFrameIndex];
_characterAnimationNum = 0;
}
@@ -2287,10 +2319,10 @@ void TuckerEngine::handleMap() {
if (_handleMapCounter > 19) {
_handleMapCounter = 0;
_locationMaskCounter = 1;
- _panelLockedFlag = 0;
+ _panelLockedFlag = false;
}
}
- if (_panelLockedFlag == 0 && (_backgroundSpriteCurrentAnimation == -1 || _locationNum == 25) && _locationMaskType == 3) {
+ if (!_panelLockedFlag && (_backgroundSpriteCurrentAnimation == -1 || _locationNum == 25) && _locationMaskType == 3) {
setCursorType(0);
if (_locationMaskCounter == 1) {
_characterFacingDirection = 0;
@@ -2298,22 +2330,22 @@ void TuckerEngine::handleMap() {
}
return;
}
- if (_selectedObject.locationObject_locationNum != 0 && _locationMaskCounter != 0 && (_backgroundSpriteCurrentAnimation <= -1 || _locationNum == 25)) {
+ if (_selectedObject._locationObjectLocationNum != 0 && _locationMaskCounter != 0 && (_backgroundSpriteCurrentAnimation <= -1 || _locationNum == 25)) {
if (_locationNum == 25 || _backgroundSpriteCurrentAnimation != 4) {
if (_locationMaskType == 0) {
_locationMaskType = 1;
setCursorType(2);
- if (_selectedObject.locationObject_toWalkX2 > 800) {
- _backgroundSpriteCurrentAnimation = _selectedObject.locationObject_toWalkX2 - 900;
- if (_selectedObject.locationObject_toWalkY2 > 499) {
- _changeBackgroundSprite = 1;
- _backgroundSprOffset = _selectedObject.locationObject_toWalkY2 - 500;
+ if (_selectedObject._locationObjectToWalkX2 > 800) {
+ _backgroundSpriteCurrentAnimation = _selectedObject._locationObjectToWalkX2 - 900;
+ if (_selectedObject._locationObjectToWalkY2 > 499) {
+ _changeBackgroundSprite = true;
+ _backgroundSprOffset = _selectedObject._locationObjectToWalkY2 - 500;
} else {
- _backgroundSprOffset = _selectedObject.locationObject_toWalkY2;
- _changeBackgroundSprite = 0;
+ _backgroundSprOffset = _selectedObject._locationObjectToWalkY2;
+ _changeBackgroundSprite = false;
}
_backgroundSpriteCurrentFrame = 0;
- _mirroredDrawing = 0;
+ _mirroredDrawing = false;
if (_locationNum == 25) {
_backgroundSpriteDataPtr = _sprA02Table[_backgroundSpriteCurrentAnimation];
_backgroundSpriteLastFrame = READ_LE_UINT16(_backgroundSpriteDataPtr);
@@ -2321,17 +2353,17 @@ void TuckerEngine::handleMap() {
}
} else {
_locationMaskCounter = 0;
- _selectedObject.xPos = _selectedObject.locationObject_toWalkX2;
- _selectedObject.yPos = _selectedObject.locationObject_toWalkY2;
+ _selectedObject._xPos = _selectedObject._locationObjectToWalkX2;
+ _selectedObject._yPos = _selectedObject._locationObjectToWalkY2;
_handleMapCounter = 1;
- _panelLockedFlag = 1;
+ _panelLockedFlag = true;
}
return;
}
_locationMaskType = 2;
_panelState = 0;
setCursorType(0);
- if (_selectedObject.locationObject_locationNum == 99) {
+ if (_selectedObject._locationObjectLocationNum == 99) {
_noPositionChangeAfterMap = true;
handleMapSequence();
return;
@@ -2341,28 +2373,28 @@ void TuckerEngine::handleMap() {
redrawScreen(_scrollOffset);
_fadePaletteCounter = 34;
}
- _nextLocationNum = _selectedObject.locationObject_locationNum;
- _xPosCurrent = _selectedObject.locationObject_toX;
- _yPosCurrent = _selectedObject.locationObject_toY;
- if (_selectedObject.locationObject_toX2 > 800) {
- _backgroundSpriteCurrentAnimation = _selectedObject.locationObject_toX2 - 900;
- if (_selectedObject.locationObject_toY2 > 499) {
- _changeBackgroundSprite = 1;
- _backgroundSprOffset = _selectedObject.locationObject_toY2 - 500;
+ _nextLocationNum = _selectedObject._locationObjectLocationNum;
+ _xPosCurrent = _selectedObject._locationObjectToX;
+ _yPosCurrent = _selectedObject._locationObjectToY;
+ if (_selectedObject._locationObjectToX2 > 800) {
+ _backgroundSpriteCurrentAnimation = _selectedObject._locationObjectToX2 - 900;
+ if (_selectedObject._locationObjectToY2 > 499) {
+ _changeBackgroundSprite = true;
+ _backgroundSprOffset = _selectedObject._locationObjectToY2 - 500;
} else {
- _changeBackgroundSprite = 0;
- _backgroundSprOffset = _selectedObject.locationObject_toY2;
+ _changeBackgroundSprite = false;
+ _backgroundSprOffset = _selectedObject._locationObjectToY2;
}
_backgroundSpriteCurrentFrame = 0;
} else {
- _selectedObject.xPos = _selectedObject.locationObject_toX2;
- _selectedObject.yPos = _selectedObject.locationObject_toY2;
- _panelLockedFlag = 1;
+ _selectedObject._xPos = _selectedObject._locationObjectToX2;
+ _selectedObject._yPos = _selectedObject._locationObjectToY2;
+ _panelLockedFlag = true;
}
_scrollOffset = 0;
_handleMapCounter = 0;
_locationMaskCounter = 0;
- _selectedObject.locationObject_locationNum = 0;
+ _selectedObject._locationObjectLocationNum = 0;
}
}
}
@@ -2370,79 +2402,79 @@ void TuckerEngine::handleMap() {
void TuckerEngine::clearSprites() {
memset(_spritesTable, 0, sizeof(_spritesTable));
for (int i = 0; i < kMaxCharacters; ++i) {
- _spritesTable[i].state = -1;
- _spritesTable[i].stateIndex = -1;
+ _spritesTable[i]._state = -1;
+ _spritesTable[i]._stateIndex = -1;
}
}
void TuckerEngine::updateSprites() {
const int count = (_locationNum == 9) ? 3 : _spritesCount;
for (int i = 0; i < count; ++i) {
- if (_spritesTable[i].stateIndex > -1) {
- ++_spritesTable[i].stateIndex;
- if (_characterStateTable[_spritesTable[i].stateIndex] == 99) {
- _spritesTable[i].stateIndex = -1;
- _spritesTable[i].state = -1;
+ if (_spritesTable[i]._stateIndex > -1) {
+ ++_spritesTable[i]._stateIndex;
+ if (_characterStateTable[_spritesTable[i]._stateIndex] == 99) {
+ _spritesTable[i]._stateIndex = -1;
+ _spritesTable[i]._state = -1;
updateSprite(i);
} else {
- _spritesTable[i].animationFrame = _characterStateTable[_spritesTable[i].stateIndex];
+ _spritesTable[i]._animationFrame = _characterStateTable[_spritesTable[i]._stateIndex];
}
continue;
}
- if (_spritesTable[i].state == -1) {
+ if (_spritesTable[i]._state == -1) {
updateSprite(i);
continue;
}
- if (_charSpeechSoundCounter > 0 && i == _actionCharacterNum && _spritesTable[i].needUpdate == 0) {
+ if (_charSpeechSoundCounter > 0 && i == _actionCharacterNum && !_spritesTable[i]._needUpdate) {
updateSprite(i);
continue;
}
- if (_charSpeechSoundCounter == 0 && _spritesTable[i].needUpdate > 0) {
+ if (_charSpeechSoundCounter == 0 && _spritesTable[i]._needUpdate) {
updateSprite(i);
continue;
}
- if (_spritesTable[i].updateDelay > 0) {
- --_spritesTable[i].updateDelay;
- if (_spritesTable[i].updateDelay == 0) {
+ if (_spritesTable[i]._updateDelay > 0) {
+ --_spritesTable[i]._updateDelay;
+ if (_spritesTable[i]._updateDelay == 0) {
updateSprite(i);
}
continue;
}
- if (_spritesTable[i].defaultUpdateDelay > 0) {
- _spritesTable[i].updateDelay = _spritesTable[i].defaultUpdateDelay - 1;
- ++_spritesTable[i].animationFrame;
- if (_spritesTable[i].animationFrame == _spritesTable[i].firstFrame) {
+ if (_spritesTable[i]._defaultUpdateDelay > 0) {
+ _spritesTable[i]._updateDelay = _spritesTable[i]._defaultUpdateDelay - 1;
+ ++_spritesTable[i]._animationFrame;
+ if (_spritesTable[i]._animationFrame == _spritesTable[i]._firstFrame) {
updateSprite(i);
}
continue;
}
- if (_spritesTable[i].nextAnimationFrame == 0) {
- ++_spritesTable[i].animationFrame;
- if (_spritesTable[i].firstFrame - 1 < _spritesTable[i].animationFrame) {
- if (_spritesTable[i].prevAnimationFrame == 1) {
- --_spritesTable[i].animationFrame;
- _spritesTable[i].nextAnimationFrame = 1;
+ if (!_spritesTable[i]._nextAnimationFrame) {
+ ++_spritesTable[i]._animationFrame;
+ if (_spritesTable[i]._firstFrame - 1 < _spritesTable[i]._animationFrame) {
+ if (_spritesTable[i]._prevAnimationFrame) {
+ --_spritesTable[i]._animationFrame;
+ _spritesTable[i]._nextAnimationFrame = true;
} else {
updateSprite(i);
}
}
continue;
}
- --_spritesTable[i].animationFrame;
- if (_spritesTable[i].animationFrame == 0) {
+ --_spritesTable[i]._animationFrame;
+ if (_spritesTable[i]._animationFrame == 0) {
updateSprite(i);
}
}
}
void TuckerEngine::updateSprite(int i) {
- _spritesTable[i].prevState = _spritesTable[i].state;
- _spritesTable[i].prevAnimationFrame = 0;
- _spritesTable[i].nextAnimationFrame = 0;
- _updateSpriteFlag1 = 0;
- _updateSpriteFlag2 = 0;
- _spritesTable[i].defaultUpdateDelay = 0;
- _spritesTable[i].updateDelay = 0;
+ _spritesTable[i]._prevState = _spritesTable[i]._state;
+ _spritesTable[i]._prevAnimationFrame = false;
+ _spritesTable[i]._nextAnimationFrame = false;
+ _updateSpriteFlag1 = false;
+ _updateSpriteFlag2 = false;
+ _spritesTable[i]._defaultUpdateDelay = 0;
+ _spritesTable[i]._updateDelay = 0;
switch (_locationNum) {
case 2:
updateSprite_locationNum2();
@@ -2632,7 +2664,7 @@ void TuckerEngine::updateSprite(int i) {
if (i == 0) {
updateSprite_locationNum32_0(0);
} else {
- _spritesTable[i].state = -1;
+ _spritesTable[i]._state = -1;
}
break;
case 33:
@@ -2643,7 +2675,7 @@ void TuckerEngine::updateSprite(int i) {
} else if (i == 2) {
updateSprite_locationNum33_2(2);
} else {
- _spritesTable[i].state = 12;
+ _spritesTable[i]._state = 12;
}
break;
case 34:
@@ -2654,7 +2686,7 @@ void TuckerEngine::updateSprite(int i) {
break;
case 37:
if (i == 0) {
- _spritesTable[0].state = -1;
+ _spritesTable[0]._state = -1;
} else {
updateSprite_locationNum37(i);
}
@@ -2670,9 +2702,9 @@ void TuckerEngine::updateSprite(int i) {
updateSprite_locationNum43_2(i);
} else if (i < 2) {
if (_flagsTable[236] < 4) {
- _spritesTable[i].state = i + 1;
+ _spritesTable[i]._state = i + 1;
} else {
- _spritesTable[i].state = -1;
+ _spritesTable[i]._state = -1;
}
} else if (i == 3) {
updateSprite_locationNum43_3(3);
@@ -2685,10 +2717,10 @@ void TuckerEngine::updateSprite(int i) {
}
break;
case 45:
- _spritesTable[0].state = 1;
+ _spritesTable[0]._state = 1;
break;
case 47:
- _spritesTable[i].state = i + 1;
+ _spritesTable[i]._state = i + 1;
break;
case 48:
updateSprite_locationNum48(0);
@@ -2700,7 +2732,7 @@ void TuckerEngine::updateSprite(int i) {
if (i < 6) {
updateSprite_locationNum50(i);
} else {
- _spritesTable[i].state = i + 1;
+ _spritesTable[i]._state = i + 1;
}
break;
case 51:
@@ -2782,7 +2814,7 @@ void TuckerEngine::updateSprite(int i) {
break;
case 69:
if (i == 0) {
- _spritesTable[0].state = 1;
+ _spritesTable[0]._state = 1;
} else if (i == 1) {
updateSprite_locationNum69_1(1);
} else if (i == 2) {
@@ -2814,23 +2846,23 @@ void TuckerEngine::updateSprite(int i) {
updateSprite_locationNum82(0);
break;
case 98:
- _spritesTable[0].state = 1;
+ _spritesTable[0]._state = 1;
break;
}
- if (_spritesTable[i].stateIndex <= -1) {
- if (_updateSpriteFlag1 == 0) {
- _spritesTable[i].animationFrame = 1;
+ if (_spritesTable[i]._stateIndex <= -1) {
+ if (!_updateSpriteFlag1) {
+ _spritesTable[i]._animationFrame = 1;
}
- if (_spritesTable[i].state < 0 || !_sprC02Table[_spritesTable[i].state]) {
+ if (_spritesTable[i]._state < 0 || !_sprC02Table[_spritesTable[i]._state]) {
// warning("Invalid state %d for sprite %d location %d", _spritesTable[i].state, i, _locationNum);
return;
}
- _spritesTable[i].animationData = _sprC02Table[_spritesTable[i].state];
- _spritesTable[i].firstFrame = READ_LE_UINT16(_spritesTable[i].animationData);
- if (_updateSpriteFlag2 == 1) {
- _spritesTable[i].state = _spritesTable[i].firstFrame;
- _spritesTable[i].nextAnimationFrame = 1;
- _spritesTable[i].prevAnimationFrame = 1;
+ _spritesTable[i]._animationData = _sprC02Table[_spritesTable[i]._state];
+ _spritesTable[i]._firstFrame = READ_LE_UINT16(_spritesTable[i]._animationData);
+ if (_updateSpriteFlag2) {
+ _spritesTable[i]._state = _spritesTable[i]._firstFrame;
+ _spritesTable[i]._nextAnimationFrame = true;
+ _spritesTable[i]._prevAnimationFrame = true;
}
}
}
@@ -2844,7 +2876,7 @@ void TuckerEngine::drawStringInteger(int num, int x, int y, int digits) {
Graphics::drawStringChar(_locationBackgroundGfxBuf, _scrollOffset + x, y, 640, numStr[i], 102, _charsetGfxBuf);
x += 8;
}
- addDirtyRect(_scrollOffset + x, y, Graphics::_charset.charW * 3, Graphics::_charset.charH);
+ addDirtyRect(_scrollOffset + x, y, Graphics::_charset._charW * 3, Graphics::_charset._charH);
}
void TuckerEngine::drawStringAlt(int x, int y, int color, const uint8 *str, int strLen) {
@@ -2856,7 +2888,7 @@ void TuckerEngine::drawStringAlt(int x, int y, int color, const uint8 *str, int
x += _charWidthTable[chr];
++pos;
}
- addDirtyRect(xStart, y, x - xStart, Graphics::_charset.charH);
+ addDirtyRect(xStart, y, x - xStart, Graphics::_charset._charH);
}
void TuckerEngine::drawItemString(int x, int num, const uint8 *str) {
@@ -2911,15 +2943,15 @@ void TuckerEngine::updateItemsGfxColors(int color1, int color128) {
}
}
-int TuckerEngine::testLocationMask(int x, int y) {
- if (_locationMaskType > 0 || _locationMaskIgnore > 0) {
- return 1;
+bool TuckerEngine::testLocationMask(int x, int y) {
+ if (_locationMaskType > 0 || _locationMaskIgnore) {
+ return true;
}
if (_locationNum == 26 || _locationNum == 32) {
y -= 3;
}
const int offset = y * 640 + x;
- return _locationBackgroundMaskBuf[offset] > 0 ? 1 : 0;
+ return (_locationBackgroundMaskBuf[offset] > 0);
}
int TuckerEngine::getStringWidth(int num, const uint8 *ptr) {
@@ -3096,7 +3128,7 @@ int TuckerEngine::readTableInstructionParam(int len) {
++_tableInstructionsPtr;
--len;
}
- char *end = 0;
+ char *end = nullptr;
const int param = strtol((const char *)_tableInstructionsPtr, &end, 10);
if (end != (const char *)_tableInstructionsPtr + len) {
warning("Unexpected instruction parameter length %d (%d)", (int)(end - (const char *)_tableInstructionsPtr), len);
@@ -3123,7 +3155,7 @@ int TuckerEngine::executeTableInstruction() {
return 0;
case kCode_bub:
i = readTableInstructionParam(3);
- _spriteAnimationFrameIndex = _spriteAnimationsTable[i].firstFrameIndex;
+ _spriteAnimationFrameIndex = _spriteAnimationsTable[i]._firstFrameIndex;
_characterFacingDirection = 5;
_mainLoopCounter2 = 0;
return 0;
@@ -3137,13 +3169,13 @@ int TuckerEngine::executeTableInstruction() {
_selectedCharacterDirection = readTableInstructionParam(2);
return 0;
case kCode_bof:
- _skipCurrentCharacterDraw = 1;
+ _skipCurrentCharacterDraw = true;
return 0;
case kCode_buh:
_noCharacterAnimationChange = readTableInstructionParam(2);
return 0;
case kCode_bon:
- _skipCurrentCharacterDraw = 0;
+ _skipCurrentCharacterDraw = false;
return 0;
case kCode_bso:
_backgroundSprOffset = readTableInstructionParam(3);
@@ -3159,24 +3191,24 @@ int TuckerEngine::executeTableInstruction() {
_charSpeechSoundCounter = kDefaultCharSpeechSoundCounter;
return 0;
case kCode_buw:
- _selectedObject.xPos = readTableInstructionParam(3);
- _selectedObject.yPos = readTableInstructionParam(3);
- _locationMaskIgnore = 1;
- _panelLockedFlag = 1;
+ _selectedObject._xPos = readTableInstructionParam(3);
+ _selectedObject._yPos = readTableInstructionParam(3);
+ _locationMaskIgnore = true;
+ _panelLockedFlag = true;
return 0;
case kCode_bux:
_xPosCurrent = readTableInstructionParam(3);
_yPosCurrent = readTableInstructionParam(3);
return 0;
case kCode_c0a:
- _spritesTable[index].state = readTableInstructionParam(3);
- if (_spritesTable[index].state == 999) {
- _spritesTable[index].state = -1;
+ _spritesTable[index]._state = readTableInstructionParam(3);
+ if (_spritesTable[index]._state == 999) {
+ _spritesTable[index]._state = -1;
}
_mainLoopCounter1 = 0;
- _spritesTable[index].updateDelay = 0;
- _spritesTable[index].nextAnimationFrame = 0;
- _spritesTable[index].prevAnimationFrame = 0;
+ _spritesTable[index]._updateDelay = 0;
+ _spritesTable[index]._nextAnimationFrame = false;
+ _spritesTable[index]._prevAnimationFrame = false;
return 0;
case kCode_c0c:
setCharacterAnimation(readTableInstructionParam(3), index);
@@ -3187,7 +3219,7 @@ int TuckerEngine::executeTableInstruction() {
startSpeechSound(_partNum * 3000 + _ptTextOffset + _speechSoundNum - 3000, kMaxSoundVolume);
_charSpeechSoundCounter = kDefaultCharSpeechSoundCounter;
_actionTextColor = 181 + index;
- if (_tableInstructionFlag == 0) {
+ if (!_tableInstructionFlag) {
_actionPosX = _tableInstructionItemNum1;
_actionPosY = _tableInstructionItemNum2;
} else {
@@ -3210,8 +3242,8 @@ int TuckerEngine::executeTableInstruction() {
return 0;
case kCode_flx:
i = readTableInstructionParam(2);
- _locationSoundsTable[i].type = 2;
- startSound(_locationSoundsTable[i].offset, i, _locationSoundsTable[i].volume);
+ _locationSoundsTable[i]._type = 2;
+ startSound(_locationSoundsTable[i]._offset, i, _locationSoundsTable[i]._volume);
return 0;
case kCode_fxx:
i = readTableInstructionParam(2);
@@ -3221,7 +3253,7 @@ int TuckerEngine::executeTableInstruction() {
return 0;
case kCode_fx:
i = readTableInstructionParam(2);
- startSound(_locationSoundsTable[i].offset, i, _locationSoundsTable[i].volume);
+ startSound(_locationSoundsTable[i]._offset, i, _locationSoundsTable[i]._volume);
_soundInstructionIndex = i;
return 0;
case kCode_gfg:
@@ -3284,12 +3316,12 @@ int TuckerEngine::executeTableInstruction() {
_csDataLoaded = false;
return 3;
case kCode_ssp:
- _tableInstructionFlag = 0;
+ _tableInstructionFlag = false;
_tableInstructionItemNum1 = readTableInstructionParam(3);
_tableInstructionItemNum2 = readTableInstructionParam(3);
return 0;
case kCode_s0p:
- _tableInstructionFlag = 1;
+ _tableInstructionFlag = true;
_tableInstructionObj1Table[index] = readTableInstructionParam(3);
_tableInstructionObj2Table[index] = readTableInstructionParam(3);
return 0;
@@ -3380,21 +3412,21 @@ int TuckerEngine::getObjectUnderCursor() {
return -1;
}
for (int i = 0; i < _locationObjectsCount; ++i) {
- if (_mousePosX + _scrollOffset + 1 <= _locationObjectsTable[i].xPos) {
+ if (_mousePosX + _scrollOffset + 1 <= _locationObjectsTable[i]._xPos) {
continue;
}
- if (_mousePosX + _scrollOffset >= _locationObjectsTable[i].xPos + _locationObjectsTable[i].xSize) {
+ if (_mousePosX + _scrollOffset >= _locationObjectsTable[i]._xPos + _locationObjectsTable[i]._xSize) {
continue;
}
- if (_mousePosY <= _locationObjectsTable[i].yPos) {
+ if (_mousePosY <= _locationObjectsTable[i]._yPos) {
continue;
}
- if (_mousePosY >= _locationObjectsTable[i].yPos + _locationObjectsTable[i].ySize) {
+ if (_mousePosY >= _locationObjectsTable[i]._yPos + _locationObjectsTable[i]._ySize) {
continue;
}
_selectedObjectType = 0;
_selectedCharacterNum = i;
- setCursorNum(_locationObjectsTable[i].cursorNum);
+ setCursorNum(_locationObjectsTable[i]._cursorNum);
return i;
}
return -1;
@@ -3405,127 +3437,127 @@ void TuckerEngine::setSelectedObjectKey() {
if (_mousePosY > 139 && _nextAction == 0) {
return;
}
- _panelLockedFlag = 1;
+ _panelLockedFlag = true;
_locationMaskCounter = 0;
_actionRequiresTwoObjects = false;
- _selectedObject.yPos = 0;
- _selectedObject.locationObject_locationNum = 0;
+ _selectedObject._yPos = 0;
+ _selectedObject._locationObjectLocationNum = 0;
_pendingActionIndex = 0;
if (_selectedObjectType == 0) {
if (_selectedObjectNum == 0) {
- _selectedObject.xPos = x;
- _selectedObject.yPos = _mousePosY;
+ _selectedObject._xPos = x;
+ _selectedObject._yPos = _mousePosY;
} else {
- _selectedObject.xPos = _locationObjectsTable[_selectedCharacterNum].standX;
- _selectedObject.yPos = _locationObjectsTable[_selectedCharacterNum].standY;
+ _selectedObject._xPos = _locationObjectsTable[_selectedCharacterNum]._standX;
+ _selectedObject._yPos = _locationObjectsTable[_selectedCharacterNum]._standY;
if (_actionVerb == 0 || _actionVerb == 8) {
- _selectedObject.locationObject_locationNum = _locationObjectsTable[_selectedCharacterNum].locationNum;
- _selectedObject.locationObject_toX = _locationObjectsTable[_selectedCharacterNum].toX;
- _selectedObject.locationObject_toY = _locationObjectsTable[_selectedCharacterNum].toY;
- _selectedObject.locationObject_toX2 = _locationObjectsTable[_selectedCharacterNum].toX2;
- _selectedObject.locationObject_toY2 = _locationObjectsTable[_selectedCharacterNum].toY2;
- _selectedObject.locationObject_toWalkX2 = _locationObjectsTable[_selectedCharacterNum].toWalkX2;
- _selectedObject.locationObject_toWalkY2 = _locationObjectsTable[_selectedCharacterNum].toWalkY2;
+ _selectedObject._locationObjectLocationNum = _locationObjectsTable[_selectedCharacterNum]._locationNum;
+ _selectedObject._locationObjectToX = _locationObjectsTable[_selectedCharacterNum]._toX;
+ _selectedObject._locationObjectToY = _locationObjectsTable[_selectedCharacterNum]._toY;
+ _selectedObject._locationObjectToX2 = _locationObjectsTable[_selectedCharacterNum]._toX2;
+ _selectedObject._locationObjectToY2 = _locationObjectsTable[_selectedCharacterNum]._toY2;
+ _selectedObject._locationObjectToWalkX2 = _locationObjectsTable[_selectedCharacterNum]._toWalkX2;
+ _selectedObject._locationObjectToWalkY2 = _locationObjectsTable[_selectedCharacterNum]._toWalkY2;
}
}
} else {
switch (_selectedObjectType) {
case 1:
- _selectedObject.xPos = _locationAnimationsTable[_selectedCharacterNum].standX;
- _selectedObject.yPos = _locationAnimationsTable[_selectedCharacterNum].standY;
+ _selectedObject._xPos = _locationAnimationsTable[_selectedCharacterNum]._standX;
+ _selectedObject._yPos = _locationAnimationsTable[_selectedCharacterNum]._standY;
break;
case 2:
- _selectedObject.xPos = _charPosTable[_selectedCharacterNum].xWalkTo;
- _selectedObject.yPos = _charPosTable[_selectedCharacterNum].yWalkTo;
+ _selectedObject._xPos = _charPosTable[_selectedCharacterNum]._xWalkTo;
+ _selectedObject._yPos = _charPosTable[_selectedCharacterNum]._yWalkTo;
break;
case 3:
- _selectedObject.xPos = _xPosCurrent;
- _selectedObject.yPos = _yPosCurrent;
+ _selectedObject._xPos = _xPosCurrent;
+ _selectedObject._yPos = _yPosCurrent;
break;
}
}
- if (_selectedObject.yPos == 0) {
- _selectedObject.xPos = x;
- _selectedObject.yPos = _mousePosY;
+ if (_selectedObject._yPos == 0) {
+ _selectedObject._xPos = x;
+ _selectedObject._yPos = _mousePosY;
}
- _selectedObjectLocationMask = testLocationMask(_selectedObject.xPos, _selectedObject.yPos);
- if (_selectedObjectLocationMask == 0 && _objectKeysLocationTable[_locationNum] == 1) {
- if (_selectedObject.yPos < _objectKeysPosYTable[_locationNum]) {
- while (_selectedObjectLocationMask == 0 && _selectedObject.yPos < _objectKeysPosYTable[_locationNum]) {
- ++_selectedObject.yPos;
- _selectedObjectLocationMask = testLocationMask(_selectedObject.xPos, _selectedObject.yPos);
+ _selectedObjectLocationMask = testLocationMask(_selectedObject._xPos, _selectedObject._yPos);
+ if (!_selectedObjectLocationMask && _objectKeysLocationTable[_locationNum] == 1) {
+ if (_selectedObject._yPos < _objectKeysPosYTable[_locationNum]) {
+ while (!_selectedObjectLocationMask && _selectedObject._yPos < _objectKeysPosYTable[_locationNum]) {
+ ++_selectedObject._yPos;
+ _selectedObjectLocationMask = testLocationMask(_selectedObject._xPos, _selectedObject._yPos);
}
} else {
- while (_selectedObjectLocationMask == 0 && _selectedObject.yPos < _objectKeysPosYTable[_locationNum]) {
- --_selectedObject.yPos;
- _selectedObjectLocationMask = testLocationMask(_selectedObject.xPos, _selectedObject.yPos);
+ while (!_selectedObjectLocationMask && _selectedObject._yPos < _objectKeysPosYTable[_locationNum]) {
+ --_selectedObject._yPos;
+ _selectedObjectLocationMask = testLocationMask(_selectedObject._xPos, _selectedObject._yPos);
}
}
}
- if (_selectedObjectLocationMask == 1) {
- _selectedObjectLocationMask = testLocationMaskArea(_xPosCurrent, _yPosCurrent, _selectedObject.xPos, _selectedObject.yPos);
- if (_selectedObjectLocationMask == 1 && _objectKeysPosXTable[_locationNum] > 0) {
- _selectedObject.xDefaultPos = _selectedObject.xPos;
- _selectedObject.yDefaultPos = _selectedObject.yPos;
- _selectedObject.xPos = _objectKeysPosXTable[_locationNum];
- _selectedObject.yPos = _objectKeysPosYTable[_locationNum];
+ if (_selectedObjectLocationMask) {
+ _selectedObjectLocationMask = testLocationMaskArea(_xPosCurrent, _yPosCurrent, _selectedObject._xPos, _selectedObject._yPos);
+ if (_selectedObjectLocationMask && _objectKeysPosXTable[_locationNum] > 0) {
+ _selectedObject._xDefaultPos = _selectedObject._xPos;
+ _selectedObject._yDefaultPos = _selectedObject._yPos;
+ _selectedObject._xPos = _objectKeysPosXTable[_locationNum];
+ _selectedObject._yPos = _objectKeysPosYTable[_locationNum];
if (_objectKeysLocationTable[_locationNum] == 1) {
- _selectedObject.xPos = _selectedObject.xDefaultPos;
+ _selectedObject._xPos = _selectedObject._xDefaultPos;
}
}
}
}
void TuckerEngine::setCharacterAnimation(int count, int spr) {
- _spritesTable[spr].animationFrame = 0;
- _spritesTable[spr].stateIndex = 0;
+ _spritesTable[spr]._animationFrame = 0;
+ _spritesTable[spr]._stateIndex = 0;
for (int i = 0; i < count; ++i) {
- while (_characterStateTable[_spritesTable[spr].stateIndex] != 99) {
- ++_spritesTable[spr].stateIndex;
+ while (_characterStateTable[_spritesTable[spr]._stateIndex] != 99) {
+ ++_spritesTable[spr]._stateIndex;
}
- ++_spritesTable[spr].stateIndex;
+ ++_spritesTable[spr]._stateIndex;
}
- _spritesTable[spr].state = _characterStateTable[_spritesTable[spr].stateIndex];
- ++_spritesTable[spr].stateIndex;
- _spritesTable[spr].animationFrame = _characterStateTable[_spritesTable[spr].stateIndex];
- ++_spritesTable[spr].stateIndex;
- _spritesTable[spr].animationData = _sprC02Table[_spritesTable[spr].state];
- _spritesTable[spr].firstFrame = READ_LE_UINT16(_spritesTable[spr].animationData);
+ _spritesTable[spr]._state = _characterStateTable[_spritesTable[spr]._stateIndex];
+ ++_spritesTable[spr]._stateIndex;
+ _spritesTable[spr]._animationFrame = _characterStateTable[_spritesTable[spr]._stateIndex];
+ ++_spritesTable[spr]._stateIndex;
+ _spritesTable[spr]._animationData = _sprC02Table[_spritesTable[spr]._state];
+ _spritesTable[spr]._firstFrame = READ_LE_UINT16(_spritesTable[spr]._animationData);
}
-int TuckerEngine::testLocationMaskArea(int xBase, int yBase, int xPos, int yPos) {
+bool TuckerEngine::testLocationMaskArea(int xBase, int yBase, int xPos, int yPos) {
while (true) {
bool loop = false;
if (yBase > yPos) {
- if (testLocationMask(xBase, yBase - 1) == 1) {
+ if (testLocationMask(xBase, yBase - 1)) {
--yBase;
loop = true;
}
} else if (yBase < yPos) {
- if (testLocationMask(xBase, yBase + 1) == 1) {
+ if (testLocationMask(xBase, yBase + 1)) {
++yBase;
loop = true;
}
}
if (xBase > xPos) {
- if (testLocationMask(xBase - 1, yBase) == 1) {
+ if (testLocationMask(xBase - 1, yBase)) {
--xBase;
loop = true;
}
} else if (xBase < xPos) {
- if (testLocationMask(xBase + 1, yBase) == 1) {
+ if (testLocationMask(xBase + 1, yBase)) {
++xBase;
loop = true;
}
}
if (xBase == xPos && yBase == yPos) {
- return 0;
+ return false;
}
if (!loop) {
break;
}
}
- return 1;
+ return true;
}
void TuckerEngine::handleMouseClickOnInventoryObject() {
@@ -3548,7 +3580,7 @@ void TuckerEngine::handleMouseClickOnInventoryObject() {
_selectedObjectType = 0;
_selectedObjectNum = 0;
_actionVerb = 0;
- _actionVerbLocked = 0;
+ _actionVerbLocked = false;
_forceRedrawPanelItems = true;
_panelState = 2;
setCursorType(1);
@@ -3573,7 +3605,7 @@ void TuckerEngine::handleMouseClickOnInventoryObject() {
_actionVerb = 0;
_selectedObjectType = 0;
_selectedObjectNum = 0;
- _actionVerbLocked = 0;
+ _actionVerbLocked = false;
}
}
break;
@@ -3585,23 +3617,23 @@ int TuckerEngine::setCharacterUnderCursor() {
return -1;
}
for (int i = 0; i < _charPosCount; ++i) {
- if (_mousePosX + _scrollOffset <= _charPosTable[i].xPos) {
+ if (_mousePosX + _scrollOffset <= _charPosTable[i]._xPos) {
continue;
}
- if (_mousePosX + _scrollOffset >= _charPosTable[i].xPos + _charPosTable[i].xSize) {
+ if (_mousePosX + _scrollOffset >= _charPosTable[i]._xPos + _charPosTable[i]._xSize) {
continue;
}
- if (_mousePosY <= _charPosTable[i].yPos) {
+ if (_mousePosY <= _charPosTable[i]._yPos) {
continue;
}
- if (_mousePosY >= _charPosTable[i].yPos + _charPosTable[i].ySize) {
+ if (_mousePosY >= _charPosTable[i]._yPos + _charPosTable[i]._ySize) {
continue;
}
- if (_charPosTable[i].flagNum == 0 || _flagsTable[_charPosTable[i].flagNum] == _charPosTable[i].flagValue) {
+ if (_charPosTable[i]._flagNum == 0 || _flagsTable[_charPosTable[i]._flagNum] == _charPosTable[i]._flagValue) {
_selectedObjectType = 2;
- _selectedCharacterDirection = _charPosTable[i].direction;
+ _selectedCharacterDirection = _charPosTable[i]._direction;
_selectedCharacterNum = i;
- return _charPosTable[i].name;
+ return _charPosTable[i]._name;
}
}
return -1;
@@ -3612,29 +3644,29 @@ int TuckerEngine::setLocationAnimationUnderCursor() {
return -1;
}
for (int i = _locationAnimationsCount - 1; i >= 0; --i) {
- if (_locationAnimationsTable[i].drawFlag == 0) {
+ if (!_locationAnimationsTable[i]._drawFlag)
continue;
- }
- int num = _locationAnimationsTable[i].graphicNum;
- if (_mousePosX + _scrollOffset + 1 <= _dataTable[num].xDest) {
+
+ int num = _locationAnimationsTable[i]._graphicNum;
+ if (_mousePosX + _scrollOffset + 1 <= _dataTable[num]._xDest) {
continue;
}
- if (_mousePosX + _scrollOffset >= _dataTable[num].xDest + _dataTable[num].xSize) {
+ if (_mousePosX + _scrollOffset >= _dataTable[num]._xDest + _dataTable[num]._xSize) {
continue;
}
- if (_mousePosY <= _dataTable[num].yDest) {
+ if (_mousePosY <= _dataTable[num]._yDest) {
continue;
}
- if (_mousePosY >= _dataTable[num].yDest + _dataTable[num].ySize) {
+ if (_mousePosY >= _dataTable[num]._yDest + _dataTable[num]._ySize) {
continue;
}
- if (_locationAnimationsTable[i].selectable == 0) {
+ if (_locationAnimationsTable[i]._selectable == 0) {
return -1;
}
_selectedObjectType = 1;
_selectedCharacterNum = i;
_selectedCharacter2Num = i;
- return _locationAnimationsTable[i].selectable;
+ return _locationAnimationsTable[i]._selectable;
}
return -1;
}
@@ -3642,14 +3674,14 @@ int TuckerEngine::setLocationAnimationUnderCursor() {
void TuckerEngine::setActionForInventoryObject() {
if (_actionVerb == 0 || _actionVerb == 2 || _actionVerb == 6 || _actionVerb == 7) {
playSpeechForAction(_actionVerb);
- _actionVerbLocked = 0;
+ _actionVerbLocked = false;
_actionRequiresTwoObjects = false;
return;
}
if (_actionVerb == 3 || _actionVerb == 4) {
if (!(_partNum == 2 && _selectedObjectNum == 19) && !(_partNum == 3 && _selectedObjectNum == 42)) {
playSpeechForAction(_actionVerb);
- _actionVerbLocked = 0;
+ _actionVerbLocked = false;
_actionRequiresTwoObjects = false;
return;
}
@@ -3659,13 +3691,13 @@ void TuckerEngine::setActionForInventoryObject() {
_currentActionObj2Num = _actionObj2Num;
_currentInfoString2SourceType = _actionObj2Type;
if (_actionVerb == 1 && _selectedObjectType == 3) {
- if (_panelLockedFlag == 1) {
+ if (_panelLockedFlag) {
if (_locationMaskType != 0) {
return;
}
- _panelLockedFlag = 0;
+ _panelLockedFlag = false;
}
- if (handleSpecialObjectSelectionSequence() == 1) {
+ if (handleSpecialObjectSelectionSequence()) {
return;
}
_speechSoundNum = _actionObj1Num + _speechSoundBaseNum;
@@ -3678,14 +3710,15 @@ void TuckerEngine::setActionForInventoryObject() {
_actionCharacterNum = 99;
setCursorType(2);
_charSpeechSoundCounter = kDefaultCharSpeechSoundCounter;
- _actionVerbLocked = 0;
+ _actionVerbLocked = false;
_actionRequiresTwoObjects = false;
return;
}
- if ((_partNum == 3 && (_actionObj1Num == 6 || _actionObj1Num == 3 || _actionObj1Num == 17)) ||
+ // Items with unary usage i.e. "Use X", rather than "Use X on Y"
+ if ((_partNum == 3 && (_actionObj1Num == 6 || _actionObj1Num == 3 || _actionObj1Num == 17 || _actionObj1Num == 33)) ||
(_partNum == 2 && _actionObj1Num == 19) ||
(_partNum == 3 && (_actionObj1Num == 42 && _selectedObjectNum == 18)) ) {
- _actionVerbLocked = 0;
+ _actionVerbLocked = false;
_actionRequiresTwoObjects = false;
_locationMaskCounter = 1;
setActionState();
@@ -3694,7 +3727,7 @@ void TuckerEngine::setActionForInventoryObject() {
if (!_actionRequiresTwoObjects) {
_actionRequiresTwoObjects = true;
} else {
- _actionVerbLocked = 0;
+ _actionVerbLocked = false;
_actionRequiresTwoObjects = false;
_locationMaskCounter = 1;
setActionState();
@@ -3754,12 +3787,12 @@ void TuckerEngine::drawSpeechText(int xStart, int y, const uint8 *dataPtr, int n
}
}
int count = 0;
- int flag = 0;
+ bool flag = false;
struct {
int w, count, offset;
} lines[5];
lines[0].offset = getPositionForLine(num, dataPtr);
- while (flag == 0 && count < 4) {
+ while (!flag && count < 4) {
int lineCharsCount, lineWidth;
flag = splitSpeechTextLines(dataPtr, lines[count].offset, x, lineCharsCount, lineWidth);
lines[count].w = lineWidth;
@@ -3788,7 +3821,7 @@ void TuckerEngine::drawSpeechText(int xStart, int y, const uint8 *dataPtr, int n
}
}
-int TuckerEngine::splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int &lineCharsCount, int &lineWidth) {
+bool TuckerEngine::splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int &lineCharsCount, int &lineWidth) {
int count = 0;
int w = 0;
lineCharsCount = 0;
@@ -3802,11 +3835,11 @@ int TuckerEngine::splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int
++count;
++pos;
}
- int ret = 0;
+ bool ret = false;
if (x + 1 > w) {
lineCharsCount = count;
lineWidth = w;
- ret = 1;
+ ret = true;
}
return ret;
}
@@ -3818,7 +3851,7 @@ void TuckerEngine::drawSpeechTextLine(const uint8 *dataPtr, int pos, int count,
x += _charWidthTable[dataPtr[pos]];
++pos;
}
- addDirtyRect(xStart, y, x - xStart, Graphics::_charset.charH);
+ addDirtyRect(xStart, y, x - xStart, Graphics::_charset._charH);
}
void TuckerEngine::redrawScreen(int offset) {
diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h
index c9e4d986bb..adcd02b2fe 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -53,133 +53,133 @@ class RewindableAudioStream;
namespace Tucker {
struct Action {
- int key;
- int testFlag1Num;
- int testFlag1Value;
- int testFlag2Num;
- int testFlag2Value;
- int speech;
- int flipX;
- int index;
- int delay;
- int setFlagNum;
- int setFlagValue;
- int fxNum;
- int fxDelay;
+ int _key;
+ int _testFlag1Num;
+ int _testFlag1Value;
+ int _testFlag2Num;
+ int _testFlag2Value;
+ int _speech;
+ int _flipX;
+ int _index;
+ int _delay;
+ int _setFlagNum;
+ int _setFlagValue;
+ int _fxNum;
+ int _fxDelay;
};
struct Sprite {
- int state;
- int gfxBackgroundOffset;
- int updateDelay;
- int backgroundOffset;
- int needUpdate;
- int stateIndex;
- int counter;
- int disabled;
- int colorType;
- int animationFrame;
- int firstFrame;
- uint8 *animationData;
- int prevState;
- int nextAnimationFrame;
- int prevAnimationFrame;
- int defaultUpdateDelay;
- int xSource;
- int yMaxBackground;
- int flipX;
+ int _state;
+ int _gfxBackgroundOffset;
+ int _updateDelay;
+ int _backgroundOffset;
+ int _stateIndex;
+ int _counter;
+ int _colorType;
+ int _animationFrame;
+ int _firstFrame;
+ uint8 *_animationData;
+ int _prevState;
+ int _defaultUpdateDelay;
+ int _xSource;
+ int _yMaxBackground;
+ bool _disabled;
+ bool _flipX;
+ bool _needUpdate;
+ bool _nextAnimationFrame;
+ bool _prevAnimationFrame;
};
struct CharPos {
- int xPos;
- int yPos;
- int xSize;
- int ySize;
- int xWalkTo;
- int yWalkTo;
- int flagNum;
- int flagValue;
- int direction;
- int name;
- int description;
+ int _xPos;
+ int _yPos;
+ int _xSize;
+ int _ySize;
+ int _xWalkTo;
+ int _yWalkTo;
+ int _flagNum;
+ int _flagValue;
+ int _direction;
+ int _name;
+ int _description;
};
struct SpriteFrame {
- int sourceOffset;
- int xOffset;
- int yOffset;
- int xSize;
- int ySize;
+ int _sourceOffset;
+ int _xOffset;
+ int _yOffset;
+ int _xSize;
+ int _ySize;
};
struct SpriteAnimation {
- int numParts;
- int rotateFlag;
- int firstFrameIndex;
+ int _numParts;
+ int _rotateFlag; // Useless variable
+ int _firstFrameIndex;
};
struct Data {
- int sourceOffset;
- int xSize;
- int ySize;
- int xDest;
- int yDest;
- int index;
+ int _sourceOffset;
+ int _xSize;
+ int _ySize;
+ int _xDest;
+ int _yDest;
+ int _index;
};
struct LocationAnimation {
- int graphicNum;
- int animInitCounter;
- int animCurrentCounter;
- int animLastCounter;
- int getFlag;
- int inventoryNum;
- int flagNum;
- int flagValue;
- int selectable;
- int standX;
- int standY;
- int drawFlag;
+ int _graphicNum;
+ int _animInitCounter;
+ int _animCurrentCounter;
+ int _animLastCounter;
+ int _getFlag;
+ int _inventoryNum;
+ int _flagNum;
+ int _flagValue;
+ int _selectable;
+ int _standX;
+ int _standY;
+ bool _drawFlag;
};
struct LocationObject {
- int xPos;
- int yPos;
- int xSize;
- int ySize;
- int textNum;
- int locationNum;
- int toX;
- int toY;
- int toX2;
- int toY2;
- int toWalkX2;
- int toWalkY2;
- int standX;
- int standY;
- int cursorNum;
+ int _xPos;
+ int _yPos;
+ int _xSize;
+ int _ySize;
+ int _textNum;
+ int _locationNum;
+ int _toX;
+ int _toY;
+ int _toX2;
+ int _toY2;
+ int _toWalkX2;
+ int _toWalkY2;
+ int _standX;
+ int _standY;
+ int _cursorNum;
};
struct LocationSound {
- int startFxSpriteState;
- int startFxSpriteNum;
- int updateType;
- int stopFxSpriteState;
- int stopFxSpriteNum;
- int offset;
- int type;
- int volume;
- int flagValueStartFx;
- int flagValueStopFx;
- int flagNum;
- int num;
+ int _startFxSpriteState;
+ int _startFxSpriteNum;
+ int _updateType;
+ int _stopFxSpriteState;
+ int _stopFxSpriteNum;
+ int _offset;
+ int _type;
+ int _volume;
+ int _flagValueStartFx;
+ int _flagValueStopFx;
+ int _flagNum;
+ int _num;
};
struct LocationMusic {
- int flag;
- int offset;
- int volume;
- int num;
+ int _flag;
+ int _offset;
+ int _volume;
+ int _num;
};
enum {
@@ -232,7 +232,7 @@ enum CompressedSoundType {
class CompressedSound {
public:
- CompressedSound() : _compressedSoundType(-1) {}
+ CompressedSound() : _compressedSoundType(-1), _compressedSoundFlags(0) {}
void openFile();
void closeFile();
@@ -284,7 +284,7 @@ protected:
int getRandomNumber();
void allocateBuffers();
void freeBuffers();
- void restart();
+ void resetVariables();
void mainLoop();
void waitForTimer(int ticksCount);
void parseEvents();
@@ -356,7 +356,7 @@ protected:
void drawCreditsString(int x, int y, int num);
void updateCharSpeechSound(bool displayText);
void updateItemsGfxColors(int bit0, int bit7);
- int testLocationMask(int x, int y);
+ bool testLocationMask(int x, int y);
int getStringWidth(int num, const uint8 *ptr);
int getPositionForLine(int num, const uint8 *ptr);
void resetCharacterAnimationIndex(int count);
@@ -369,7 +369,7 @@ protected:
int getObjectUnderCursor();
void setSelectedObjectKey();
void setCharacterAnimation(int count, int spr);
- int testLocationMaskArea(int xBase, int yBase, int xPos, int yPos);
+ bool testLocationMaskArea(int xBase, int yBase, int xPos, int yPos);
void handleMouseClickOnInventoryObject();
int setCharacterUnderCursor();
int setLocationAnimationUnderCursor();
@@ -377,7 +377,7 @@ protected:
void setActionState();
void playSpeechForAction(int i);
void drawSpeechText(int xStart, int y, const uint8 *dataPtr, int num, int color);
- int splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int &lineCharsCount, int &lineWidth);
+ bool splitSpeechTextLines(const uint8 *dataPtr, int pos, int x, int &lineCharsCount, int &lineWidth);
void drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int x, int y, uint8 color);
void redrawScreen(int offset);
void redrawScreenRect(const Common::Rect &clip, const Common::Rect &dirty);
@@ -578,7 +578,7 @@ protected:
void handleMeanwhileSequence();
void handleMapSequence();
void copyMapRect(int x, int y, int w, int h);
- int handleSpecialObjectSelectionSequence();
+ bool handleSpecialObjectSelectionSequence();
uint8 *loadFile(const char *filename, uint8 *p);
void loadImage(const char *filename, uint8 *dst, int a);
@@ -630,14 +630,14 @@ protected:
bool _gameDebug;
bool _displayGameHints;
int _execData3Counter;
- bool _displaySpeechText;
int _currentSaveLoadGameState;
-
int _gameHintsIndex;
int _gameHintsCounter;
- int _gameHintsDisplayText;
int _gameHintsStringNum;
+ bool _displaySpeechText;
+ bool _displayHintsText;
+
int _fileLoadSize;
uint8 *_loadTempBuf;
uint8 *_cursorGfxBuf;
@@ -685,7 +685,7 @@ protected:
int _switchPanelCounter;
int _conversationOptionsCount;
bool _fadedPanel;
- int _panelLockedFlag;
+ bool _panelLockedFlag;
int _conversationOptionLinesCount;
int _inventoryItemsState[50];
int _inventoryObjectsList[40];
@@ -742,22 +742,22 @@ protected:
int _actionObj1Type, _actionObj2Type;
int _actionObj1Num, _actionObj2Num;
bool _actionRequiresTwoObjects;
- int _actionVerbLocked;
+ bool _actionVerbLocked;
int _actionPosX;
int _actionPosY;
- int _selectedObjectLocationMask;
+ bool _selectedObjectLocationMask;
struct {
- int xDefaultPos;
- int yDefaultPos;
- int xPos;
- int yPos;
- int locationObject_locationNum;
- int locationObject_toX;
- int locationObject_toY;
- int locationObject_toX2;
- int locationObject_toY2;
- int locationObject_toWalkX2;
- int locationObject_toWalkY2;
+ int _xDefaultPos;
+ int _yDefaultPos;
+ int _xPos;
+ int _yPos;
+ int _locationObjectLocationNum;
+ int _locationObjectToX;
+ int _locationObjectToY;
+ int _locationObjectToX2;
+ int _locationObjectToY2;
+ int _locationObjectToWalkX2;
+ int _locationObjectToWalkY2;
} _selectedObject;
int _selectedCharacterDirection;
int _selectedCharacter2Num;
@@ -780,7 +780,7 @@ protected:
const uint8 *_tableInstructionsPtr;
int _tableInstructionObj1Table[6];
int _tableInstructionObj2Table[6];
- int _tableInstructionFlag;
+ bool _tableInstructionFlag;
int _tableInstructionItemNum1, _tableInstructionItemNum2;
int _instructionsActionsTable[6];
bool _validInstructionId;
@@ -810,21 +810,21 @@ protected:
int _characterAnimationIndex;
int _characterFacingDirection;
int _characterPrevFacingDirection;
- int _characterBackFrontFacing;
- int _characterPrevBackFrontFacing;
+ bool _characterBackFrontFacing;
+ bool _characterPrevBackFrontFacing;
int _characterAnimationNum;
int _noCharacterAnimationChange;
- int _changeBackgroundSprite;
int _characterSpriteAnimationFrameCounter;
- int _locationMaskIgnore;
+ bool _locationMaskIgnore;
int _locationMaskType;
int _locationMaskCounter;
- int _updateSpriteFlag1;
- int _updateSpriteFlag2;
int _handleMapCounter;
bool _noPositionChangeAfterMap;
+ bool _changeBackgroundSprite;
+ bool _updateSpriteFlag1;
+ bool _updateSpriteFlag2;
- int _mirroredDrawing;
+ bool _mirroredDrawing;
uint8 *_loadLocBufPtr;
uint8 *_backgroundSpriteDataPtr;
int _locationHeight;
@@ -848,7 +848,7 @@ protected:
int _updateLocation14ObjNum[10];
int _updateLocation14Delay[10];
int _updateLocationCounter2;
- int _updateLocationFlag;
+ bool _updateLocationFlag;
int _updateLocation70StringLen;
uint8 _updateLocation70String[20];