aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/detection_tables.h1
-rw-r--r--engines/agos/input.cpp4
-rw-r--r--engines/agos/midi.cpp4
-rw-r--r--engines/agos/sound.cpp14
-rw-r--r--engines/avalanche/animation.cpp15
-rw-r--r--engines/avalanche/animation.h5
-rw-r--r--engines/avalanche/avalanche.cpp17
-rw-r--r--engines/avalanche/avalanche.h7
-rw-r--r--engines/avalanche/avalot.cpp43
-rw-r--r--engines/avalanche/background.cpp2
-rw-r--r--engines/avalanche/background.h2
-rw-r--r--engines/avalanche/dialogs.cpp16
-rw-r--r--engines/avalanche/dropdown.cpp6
-rw-r--r--engines/avalanche/enums.h1
-rw-r--r--engines/avalanche/ghostroom.cpp39
-rw-r--r--engines/avalanche/ghostroom.h4
-rw-r--r--engines/avalanche/graphics.cpp83
-rw-r--r--engines/avalanche/graphics.h8
-rw-r--r--engines/avalanche/help.cpp4
-rw-r--r--engines/avalanche/highscore.cpp110
-rw-r--r--engines/avalanche/highscore.h59
-rw-r--r--engines/avalanche/module.mk3
-rw-r--r--engines/avalanche/parser.cpp29
-rw-r--r--engines/avalanche/parser.h8
-rw-r--r--engines/avalanche/shootemup.cpp6
-rw-r--r--engines/avalanche/shootemup.h2
-rw-r--r--engines/avalanche/timer.cpp27
-rw-r--r--engines/avalanche/timer.h2
-rw-r--r--engines/bbvs/bbvs.cpp36
-rw-r--r--engines/bbvs/bbvs.h3
-rw-r--r--engines/bbvs/saveload.cpp5
-rw-r--r--engines/bbvs/walk.cpp2
-rw-r--r--engines/cge/cge.cpp88
-rw-r--r--engines/cge/cge.h2
-rw-r--r--engines/cge/cge_main.cpp28
-rw-r--r--engines/cge/fileio.cpp8
-rw-r--r--engines/cge/fileio.h4
-rw-r--r--engines/cine/anim.cpp2
-rw-r--r--engines/cine/bg.cpp4
-rw-r--r--engines/cine/cine.cpp8
-rw-r--r--engines/cine/gfx.cpp6
-rw-r--r--engines/cine/pal.cpp4
-rw-r--r--engines/cine/part.cpp2
-rw-r--r--engines/cine/script_fw.cpp8
-rw-r--r--engines/cine/sound.cpp2
-rw-r--r--engines/cine/various.cpp114
-rw-r--r--engines/cine/various.h2
-rw-r--r--engines/cruise/font.cpp2
-rw-r--r--engines/cruise/function.cpp2
-rw-r--r--engines/cruise/saveload.cpp23
-rw-r--r--engines/cruise/vars.cpp1
-rw-r--r--engines/cruise/vars.h1
-rw-r--r--engines/fullpipe/behavior.cpp10
-rw-r--r--engines/fullpipe/constants.h106
-rw-r--r--engines/fullpipe/fullpipe.cpp18
-rw-r--r--engines/fullpipe/fullpipe.h17
-rw-r--r--engines/fullpipe/gameloader.cpp4
-rw-r--r--engines/fullpipe/gfx.cpp15
-rw-r--r--engines/fullpipe/input.cpp33
-rw-r--r--engines/fullpipe/interaction.cpp13
-rw-r--r--engines/fullpipe/inventory.cpp9
-rw-r--r--engines/fullpipe/inventory.h2
-rw-r--r--engines/fullpipe/messagehandlers.cpp66
-rw-r--r--engines/fullpipe/messages.cpp4
-rw-r--r--engines/fullpipe/messages.h1
-rw-r--r--engines/fullpipe/modal.cpp729
-rw-r--r--engines/fullpipe/modal.h87
-rw-r--r--engines/fullpipe/module.mk1
-rw-r--r--engines/fullpipe/motion.cpp350
-rw-r--r--engines/fullpipe/motion.h6
-rw-r--r--engines/fullpipe/scenes.cpp116
-rw-r--r--engines/fullpipe/scenes.h90
-rw-r--r--engines/fullpipe/scenes/scene18and19.cpp537
-rw-r--r--engines/fullpipe/scenes/scene29.cpp1125
-rw-r--r--engines/fullpipe/sound.cpp309
-rw-r--r--engines/fullpipe/sound.h19
-rw-r--r--engines/fullpipe/statics.cpp220
-rw-r--r--engines/fullpipe/statics.h4
-rw-r--r--engines/gob/draw.cpp5
-rw-r--r--engines/gob/draw.h1
-rw-r--r--engines/gob/inter_v1.cpp18
-rw-r--r--engines/gob/minigames/geisha/diving.cpp3
-rw-r--r--engines/gob/minigames/geisha/penetration.cpp3
-rw-r--r--engines/gob/resources.cpp4
-rw-r--r--engines/groovie/roq.cpp2
-rw-r--r--engines/groovie/roq.h2
-rw-r--r--engines/kyra/scene_lol.cpp27
-rw-r--r--engines/kyra/sound_towns.cpp3
-rw-r--r--engines/kyra/staticres.cpp2
-rw-r--r--engines/lastexpress/data/animation.cpp2
-rw-r--r--engines/lastexpress/data/animation.h1
-rw-r--r--engines/lastexpress/data/sequence.cpp2
-rw-r--r--engines/lastexpress/data/sequence.h1
-rw-r--r--engines/lure/menu.cpp2
-rw-r--r--engines/neverhood/modules/module1000.cpp2
-rw-r--r--engines/neverhood/modules/module1300.cpp4
-rw-r--r--engines/neverhood/modules/module2200.cpp2
-rw-r--r--engines/neverhood/modules/module2300.cpp28
-rw-r--r--engines/neverhood/modules/module2300.h4
-rw-r--r--engines/neverhood/modules/module2700.cpp2
-rw-r--r--engines/neverhood/modules/module2900.cpp3
-rw-r--r--engines/neverhood/modules/module3000.cpp49
-rw-r--r--engines/neverhood/modules/module3000.h4
-rw-r--r--engines/parallaction/saveload.h4
-rw-r--r--engines/pegasus/ai/ai_area.cpp2
-rw-r--r--engines/pegasus/energymonitor.cpp1
-rw-r--r--engines/pegasus/fader.cpp1
-rw-r--r--engines/pegasus/input.cpp11
-rw-r--r--engines/pegasus/input.h2
-rw-r--r--engines/pegasus/interface.cpp8
-rw-r--r--engines/pegasus/items/inventorypicture.cpp1
-rw-r--r--engines/pegasus/items/item.cpp14
-rw-r--r--engines/pegasus/items/item.h7
-rw-r--r--engines/pegasus/items/itemlist.cpp5
-rw-r--r--engines/pegasus/items/itemlist.h1
-rw-r--r--engines/pegasus/menu.cpp2
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoria.cpp10
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp15
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoriabomb.h3
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp6
-rw-r--r--engines/pegasus/neighborhood/caldoria/caldoriamessages.h2
-rw-r--r--engines/pegasus/neighborhood/mars/mars.cpp20
-rw-r--r--engines/pegasus/neighborhood/neighborhood.cpp15
-rw-r--r--engines/pegasus/neighborhood/neighborhood.h2
-rw-r--r--engines/pegasus/neighborhood/norad/delta/globegame.cpp5
-rw-r--r--engines/pegasus/neighborhood/norad/delta/globegame.h2
-rw-r--r--engines/pegasus/neighborhood/norad/delta/noraddelta.cpp18
-rw-r--r--engines/pegasus/neighborhood/norad/delta/noraddelta.h3
-rw-r--r--engines/pegasus/neighborhood/tsa/fulltsa.cpp5
-rw-r--r--engines/pegasus/neighborhood/tsa/tinytsa.cpp1
-rw-r--r--engines/pegasus/neighborhood/wsc/wsc.cpp3
-rw-r--r--engines/pegasus/pegasus.cpp55
-rw-r--r--engines/pegasus/pegasus.h1
-rw-r--r--engines/queen/debug.cpp52
-rw-r--r--engines/sci/engine/kfile.cpp16
-rw-r--r--engines/sci/engine/script_patches.cpp4
-rw-r--r--engines/sci/sound/audio.cpp56
-rw-r--r--engines/sci/sound/audio.h2
-rw-r--r--engines/scumm/gfx.cpp2
-rw-r--r--engines/scumm/gfxARM.s2
-rw-r--r--engines/scumm/proc3ARM.s17
-rw-r--r--engines/scumm/saveload.cpp37
-rw-r--r--engines/scumm/smush/codec47ARM.s1
-rw-r--r--engines/sky/debug.cpp33
-rw-r--r--engines/tony/font.h1
-rw-r--r--engines/tony/game.h1
-rw-r--r--engines/tony/gfxcore.h2
-rw-r--r--engines/tony/inventory.h2
-rw-r--r--engines/tsage/debugger.cpp104
-rw-r--r--engines/tsage/detection.cpp16
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes3.cpp5
-rw-r--r--engines/tsage/saveload.cpp40
-rw-r--r--engines/tsage/saveload.h12
-rw-r--r--engines/tsage/sound.cpp211
-rw-r--r--engines/tsage/sound.h5
-rw-r--r--engines/tucker/graphics.cpp32
-rw-r--r--engines/tucker/graphics.h10
-rw-r--r--engines/tucker/locations.cpp1239
-rw-r--r--engines/tucker/resource.cpp226
-rw-r--r--engines/tucker/saveload.cpp4
-rw-r--r--engines/tucker/sequences.cpp30
-rw-r--r--engines/tucker/tucker.cpp886
-rw-r--r--engines/tucker/tucker.h264
-rw-r--r--engines/voyeur/animation.cpp13
-rw-r--r--engines/voyeur/animation.h7
-rw-r--r--engines/voyeur/data.cpp39
-rw-r--r--engines/voyeur/debugger.cpp35
-rw-r--r--engines/voyeur/events.cpp29
-rw-r--r--engines/voyeur/files.cpp54
-rw-r--r--engines/voyeur/files.h26
-rw-r--r--engines/voyeur/files_threads.cpp36
-rw-r--r--engines/voyeur/graphics.cpp12
-rw-r--r--engines/voyeur/graphics.h2
-rw-r--r--engines/voyeur/sound.cpp2
-rw-r--r--engines/voyeur/sound.h3
-rw-r--r--engines/voyeur/voyeur.cpp61
-rw-r--r--engines/voyeur/voyeur.h4
-rw-r--r--engines/voyeur/voyeur_game.cpp126
-rw-r--r--engines/wintermute/base/font/base_font_truetype.cpp2
-rw-r--r--engines/wintermute/detection.cpp4
-rw-r--r--engines/wintermute/detection_tables.h110
-rw-r--r--engines/wintermute/graphics/transparent_surface.cpp147
-rw-r--r--engines/wintermute/graphics/transparent_surface.h6
-rw-r--r--engines/wintermute/video/video_theora_player.cpp1
-rw-r--r--engines/zvision/fonts/truetype_font.cpp7
-rw-r--r--engines/zvision/fonts/truetype_font.h6
186 files changed, 6605 insertions, 2609 deletions
diff --git a/engines/agi/detection_tables.h b/engines/agi/detection_tables.h
index 7c9ef4cbf6..2d7fba3507 100644
--- a/engines/agi/detection_tables.h
+++ b/engines/agi/detection_tables.h
@@ -846,6 +846,7 @@ static const AGIGameDescription gameDescriptions[] = {
FANMADE("Time Quest (Demo v0.1)", "12e1a6f03ea4b8c5531acd0400b4ed8d"),
FANMADE("Time Quest (Demo v0.2)", "7b710608abc99e0861ac59b967bf3f6d"),
FANMADE_SVP("Time Quest", "90314f473d8317be5cd1f0306f139aea", 300, 0x2440, Common::kPlatformCoCo3),
+ FANMADE("Toby's World (Demo)", "3f8ebea0eb32303e65e2a6e8341c6741"),
FANMADE("Tonight The Shrieking Corpses Bleed (Demo v0.11)", "bcc57a7c8d563fa0c333107ae1c0a6e6"),
FANMADE("Tonight The Shrieking Corpses Bleed (v1.01)", "36b38f621b38e8d104aa0807302dc8c9"),
FANMADE("Turks' Quest - Heir to the Planet", "3d19254b737c8b218e5bc4580542b79a"),
diff --git a/engines/agos/input.cpp b/engines/agos/input.cpp
index 35779323e3..8a4e87017a 100644
--- a/engines/agos/input.cpp
+++ b/engines/agos/input.cpp
@@ -450,7 +450,7 @@ void AGOSEngine_Feeble::handleMouseWheelDown() {
void AGOSEngine_Simon1::handleMouseWheelUp() {
HitArea *ha = findBox(206);
- if (ha != NULL && (ha->flags & kBFBoxInUse)) {
+ if (ha != NULL && (ha->flags & kBFBoxInUse) && !(ha->flags & kBFBoxDead)) {
if (_saveLoadRowCurPos != 1) {
if (_saveLoadRowCurPos < 7)
_saveLoadRowCurPos = 1;
@@ -467,7 +467,7 @@ void AGOSEngine_Simon1::handleMouseWheelUp() {
void AGOSEngine_Simon1::handleMouseWheelDown() {
HitArea *ha = findBox(207);
- if (ha != NULL && (ha->flags & kBFBoxInUse)) {
+ if (ha != NULL && (ha->flags & kBFBoxInUse) && !(ha->flags & kBFBoxDead)) {
if (_saveDialogFlag) {
_saveLoadRowCurPos += 1;
if (_saveLoadRowCurPos >= _numSaveGameRows)
diff --git a/engines/agos/midi.cpp b/engines/agos/midi.cpp
index c26fbe3331..392ee08ea1 100644
--- a/engines/agos/midi.cpp
+++ b/engines/agos/midi.cpp
@@ -235,6 +235,10 @@ void MidiPlayer::startTrack(int track) {
_music.parser = parser; // That plugs the power cord into the wall
} else if (_music.parser) {
if (!_music.parser->setTrack(track)) {
+ // The Roland MT32 music in Simon the Sorcerer 2
+ // is missing the extra tracks in many scenes,
+ // like the introduction sequence.
+ stop();
return;
}
_currentTrack = (byte)track;
diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp
index 1e299a06ed..812f46504f 100644
--- a/engines/agos/sound.cpp
+++ b/engines/agos/sound.cpp
@@ -121,8 +121,14 @@ Common::SeekableReadStream *BaseSound::getSoundStream(uint sound) const {
int i = 1;
while (_offsets[sound + i] == _offsets[sound])
i++;
+ uint end;
+ if (_offsets[sound + i] > _offsets[sound]) {
+ end = _offsets[sound + i];
+ } else {
+ end = file->size();
+ }
- return new Common::SeekableSubReadStream(file, _offsets[sound], _offsets[sound + i], DisposeAfterUse::YES);
+ return new Common::SeekableSubReadStream(file, _offsets[sound], end, DisposeAfterUse::YES);
}
///////////////////////////////////////////////////////////////////////////////
@@ -442,12 +448,16 @@ void Sound::loadVoiceFile(const GameSpecificSettings *gss) {
if (file.open("voices.idx")) {
int end = file.size();
_filenums = (uint16 *)malloc((end / 6 + 1) * 2);
- _offsets = (uint32 *)malloc((end / 6 + 1) * 4);
+ _offsets = (uint32 *)malloc((end / 6 + 1 + 1) * 4);
for (int i = 1; i <= end / 6; i++) {
_filenums[i] = file.readUint16BE();
_offsets[i] = file.readUint32BE();
}
+ // We need to add a terminator entry otherwise we get an out of
+ // bounds read when the offset table is accessed in
+ // BaseSound::getSoundStream.
+ _offsets[end / 6 + 1] = 0;
_hasVoiceFile = true;
return;
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp
index 86ca4c8541..451b4a1c68 100644
--- a/engines/avalanche/animation.cpp
+++ b/engines/avalanche/animation.cpp
@@ -764,7 +764,7 @@ void Animation::catacombMove(byte ped) {
spr1->init(5, true); // ...Load Geida.
appearPed(1, geidaPed(ped));
spr1->_callEachStepFl = true;
- spr1->_eachStepProc = kProcGeida;
+ spr1->_eachStepProc = kProcFollowAvvy;
}
}
@@ -1121,7 +1121,7 @@ void Animation::spin(Direction dir, byte &tripnum) {
}
}
-void Animation::geidaProcs(byte tripnum) {
+void Animation::follow(byte tripnum) {
AnimationType *tripSpr = _sprites[tripnum];
AnimationType *avvy = _sprites[0];
@@ -1132,14 +1132,14 @@ void Animation::geidaProcs(byte tripnum) {
}
if (tripSpr->_y < (avvy->_y - 2)) {
- // Geida is further from the screen than Avvy.
+ // The following NPC is further from the screen than Avvy.
spin(kDirDown, tripnum);
tripSpr->_moveY = 1;
tripSpr->_moveX = 0;
takeAStep(tripnum);
return;
} else if (tripSpr->_y > (avvy->_y + 2)) {
- // Avvy is further from the screen than Geida.
+ // Avvy is further from the screen than the following NPC.
spin(kDirUp, tripnum);
tripSpr->_moveY = -1;
tripSpr->_moveX = 0;
@@ -1205,8 +1205,9 @@ void Animation::drawSprites() {
* @remarks Originally called 'trippancy_link'
*/
void Animation::animLink() {
- if (_vm->_dropdown->isActive() || _vm->_seeScroll)
+ if (_vm->_dropdown->isActive() || !_vm->_animationsEnabled)
return;
+
for (int16 i = 0; i < kSpriteNumbMax; i++) {
AnimationType *curSpr = _sprites[i];
if (curSpr->_quick && curSpr->_visible)
@@ -1235,8 +1236,8 @@ void Animation::animLink() {
case kProcGrabAvvy :
grabAvvy(i);
break;
- case kProcGeida :
- geidaProcs(i);
+ case kProcFollowAvvy :
+ follow(i);
break;
default:
break;
diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h
index 375d117893..d1ee4a3ebd 100644
--- a/engines/avalanche/animation.h
+++ b/engines/avalanche/animation.h
@@ -102,9 +102,8 @@ public:
kProcBackAndForth,
kProcFaceAvvy,
kProcArrow,
- kProcSpludwick, // Unused
kProcGrabAvvy,
- kProcGeida // Spludwick uses it as well for homing! TODO: Unify it with kProcSpludwick.
+ kProcFollowAvvy
};
AnimationType *_sprites[kSpriteNumbMax];
@@ -167,7 +166,7 @@ private:
// Movements for Homing NPCs: Spludwick and Geida.
void spin(Direction dir, byte &tripnum);
void takeAStep(byte &tripnum);
- void geidaProcs(byte tripnum);
+ void follow(byte tripnum);
void drawSprites();
};
diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp
index 1bc4c5348d..6cfe4dfdb6 100644
--- a/engines/avalanche/avalanche.cpp
+++ b/engines/avalanche/avalanche.cpp
@@ -57,6 +57,7 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *
_nim = nullptr;
_ghostroom = nullptr;
_help = nullptr;
+ _highscore = nullptr;
_platform = gd->desc.platform;
initVariables();
@@ -81,6 +82,7 @@ AvalancheEngine::~AvalancheEngine() {
delete _nim;
delete _ghostroom;
delete _help;
+ delete _highscore;
for (int i = 0; i < 31; i++) {
for (int j = 0; j < 2; j++) {
@@ -142,7 +144,7 @@ void AvalancheEngine::initVariables() {
_letMeOut = false;
_thinks = 2;
_thinkThing = true;
- _seeScroll = false;
+ _animationsEnabled = true;
_currentMouse = 177;
_holdLeftMouse = false;
@@ -165,6 +167,7 @@ Common::ErrorCode AvalancheEngine::initialize() {
_nim = new Nim(this);
_ghostroom = new GhostRoom(this);
_help = new Help(this);
+ _highscore = new HighScore(this);
_graphics->init();
_dialogs->init();
@@ -200,7 +203,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {
sz.syncAsByte(_carryNum);
for (int i = 0; i < kObjectNum; i++)
sz.syncAsByte(_objects[i]);
- sz.syncAsSint16LE(_dnascore);
+ sz.syncAsSint16LE(_score);
sz.syncAsSint32LE(_money);
sz.syncAsByte(_room);
if (sz.isSaving())
@@ -336,8 +339,8 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {
}
-bool AvalancheEngine::canSaveGameStateCurrently() { // TODO: Refine these!!!
- return (!_seeScroll && _alive);
+bool AvalancheEngine::canSaveGameStateCurrently() {
+ return (_animationsEnabled && _alive);
}
Common::Error AvalancheEngine::saveGameState(int slot, const Common::String &desc) {
@@ -381,8 +384,8 @@ Common::String AvalancheEngine::getSaveFileName(const int slot) {
return Common::String::format("%s.%03d", _targetName.c_str(), slot);
}
-bool AvalancheEngine::canLoadGameStateCurrently() { // TODO: Refine these!!!
- return (!_seeScroll);
+bool AvalancheEngine::canLoadGameStateCurrently() {
+ return (_animationsEnabled);
}
Common::Error AvalancheEngine::loadGameState(int slot) {
@@ -432,7 +435,7 @@ bool AvalancheEngine::loadGame(const int16 slot) {
_isLoaded = true;
- _seeScroll = true; // This prevents display of the new sprites before the new picture is loaded.
+ _animationsEnabled = false;
if (_holdTheDawn) {
_holdTheDawn = false;
diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h
index fcca396fd2..6eb5e675cc 100644
--- a/engines/avalanche/avalanche.h
+++ b/engines/avalanche/avalanche.h
@@ -46,6 +46,7 @@
#include "avalanche/help.h"
#include "avalanche/shootemup.h"
#include "avalanche/mainmenu.h"
+#include "avalanche/highscore.h"
#include "common/serializer.h"
@@ -91,6 +92,7 @@ public:
Nim *_nim;
GhostRoom *_ghostroom;
Help *_help;
+ HighScore *_highscore;
OSystem *_system;
@@ -150,7 +152,7 @@ public:
// Former DNA structure
byte _carryNum; // How many objects you're carrying...
bool _objects[kObjectNum]; // ...and which ones they are.
- int16 _dnascore; // your score, of course
+ int16 _score; // your score, of course
int32 _money; // your current amount of dosh
Room _room; // your current room
bool _wonNim; // Have you *won* Nim? (That's harder.)
@@ -210,7 +212,7 @@ public:
bool _letMeOut;
byte _thinks;
bool _thinkThing;
- bool _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll?
+ bool _animationsEnabled; // If set to TRUE, it stops the animation system working. This prevents display of the new sprites before the new picture is loaded or during the display of a scroll. Original name: seescroll.
char _objectList[10];
// Called .free() for them in ~Gyro().
@@ -236,6 +238,7 @@ public:
bool _isLoaded; // Is it a loaded gamestate?
void callVerb(VerbCode id);
+ void loadBackground(byte num);
void loadRoom(byte num);
void thinkAbout(byte object, bool type); // Hey!!! Get it and put it!!!
void incScore(byte num); // Add on no. of points
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp
index 8f619e6a13..c8f5599687 100644
--- a/engines/avalanche/avalot.cpp
+++ b/engines/avalanche/avalot.cpp
@@ -202,6 +202,8 @@ void AvalancheEngine::setup() {
_graphics->drawSoundLight(_sound->_soundFl);
+ drawToolbar();
+
int16 loadSlot = ConfMan.instance().getInt("save_slot");
if (loadSlot >= 0) {
_thinks = 2; // You always have money.
@@ -218,8 +220,6 @@ void AvalancheEngine::setup() {
newGame();
- drawToolbar();
-
thinkAbout(kObjectMoney, kThing);
_dialogs->displayScrollChain('Q', 83); // Info on the game, etc.
@@ -249,8 +249,6 @@ void AvalancheEngine::runAvalot() {
_system->delayMillis(55 - delay); // Replaces slowdown(); 55 comes from 18.2 Hz (B Flight).
};
- warning("STUB: run()");
-
_closing->exitGame();
}
@@ -416,9 +414,7 @@ void AvalancheEngine::loadAlso(byte num) {
}
}
-void AvalancheEngine::loadRoom(byte num) {
- CursorMan.showMouse(false);
-
+void AvalancheEngine::loadBackground(byte num) {
Common::String filename = Common::String::format("place%d.avd", num);
Common::File file;
if (!file.open(filename))
@@ -440,9 +436,15 @@ void AvalancheEngine::loadRoom(byte num) {
_graphics->refreshBackground();
file.close();
+}
+void AvalancheEngine::loadRoom(byte num) {
+ CursorMan.showMouse(false);
+
+ loadBackground(num);
loadAlso(num);
- _background->load(num);
+ _background->loadSprites(num);
+
CursorMan.showMouse(true);
}
@@ -460,7 +462,7 @@ void AvalancheEngine::findPeople(byte room) {
void AvalancheEngine::exitRoom(byte x) {
_sound->stopSound();
_background->release();
- _seeScroll = true; // This stops the trippancy system working over the length of this procedure.
+ _animationsEnabled = false;
switch (x) {
case kRoomSpludwicks:
@@ -483,7 +485,7 @@ void AvalancheEngine::exitRoom(byte x) {
}
_interrogation = 0; // Leaving the room cancels all the questions automatically.
- _seeScroll = false; // Now it can work again!
+ _animationsEnabled = true;
_lastRoom = _room;
if (_room != kRoomMap)
@@ -530,11 +532,11 @@ void AvalancheEngine::putGeidaAt(byte whichPed, byte ped) {
spr1->init(5, false); // load Geida
_animation->appearPed(1, whichPed);
spr1->_callEachStepFl = true;
- spr1->_eachStepProc = Animation::kProcGeida;
+ spr1->_eachStepProc = Animation::kProcFollowAvvy;
}
void AvalancheEngine::enterRoom(Room roomId, byte ped) {
- _seeScroll = true; // This stops the trippancy system working over the length of this procedure.
+ _animationsEnabled = false;
findPeople(roomId);
_room = roomId;
@@ -615,7 +617,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {
}
spr1->_callEachStepFl = true;
- spr1->_eachStepProc = Animation::kProcGeida;
+ spr1->_eachStepProc = Animation::kProcFollowAvvy;
} else
_whereIs[kPeopleSpludwick - 150] = kRoomNowhere;
break;
@@ -918,7 +920,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {
break;
}
- _seeScroll = false; // Now it can work again!
+ _animationsEnabled = true;
}
void AvalancheEngine::thinkAbout(byte object, bool type) {
@@ -953,7 +955,7 @@ void AvalancheEngine::drawToolbar() {
}
void AvalancheEngine::drawScore() {
- uint16 score = _dnascore;
+ uint16 score = _score;
int8 numbers[3] = {0, 0, 0};
for (int i = 0; i < 2; i++) {
byte divisor = 1;
@@ -979,15 +981,14 @@ void AvalancheEngine::drawScore() {
void AvalancheEngine::incScore(byte num) {
for (int i = 1; i <= num; i++) {
- _dnascore++;
+ _score++;
if (_soundFx) {
for (int j = 1; j <= 97; j++)
- // Length os 2 is a guess, the original doesn't have a delay specified
- _sound->playNote(177 + _dnascore * 3, 2);
+ // Length of 2 is a guess, the original doesn't have a delay specified
+ _sound->playNote(177 + _score * 3, 2);
}
}
- warning("STUB: points()");
drawScore();
}
@@ -1332,7 +1333,7 @@ void AvalancheEngine::resetVariables() {
for (int i = 0; i < kObjectNum; i++)
_objects[i] = false;
- _dnascore = 0;
+ _score = 0;
_money = 0;
_room = kRoomNowhere;
_saveNum = 0;
@@ -1438,7 +1439,7 @@ void AvalancheEngine::newGame() {
_thinkThing = true;
_thinks = 2;
refreshObjectList();
- _seeScroll = false;
+ _animationsEnabled = true;
avvy->appear(300, 117, kDirRight); // Needed to initialize Avalot.
//for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil;
diff --git a/engines/avalanche/background.cpp b/engines/avalanche/background.cpp
index c3d6ac3481..f1ba659a55 100644
--- a/engines/avalanche/background.cpp
+++ b/engines/avalanche/background.cpp
@@ -261,7 +261,7 @@ void Background::update() {
}
}
-void Background::load(byte number) {
+void Background::loadSprites(byte number) {
Common::File f;
_filename = _filename.format("chunk%d.avd", number);
if (!f.open(_filename))
diff --git a/engines/avalanche/background.h b/engines/avalanche/background.h
index 98d6d36fed..e994d9eae9 100644
--- a/engines/avalanche/background.h
+++ b/engines/avalanche/background.h
@@ -51,7 +51,7 @@ public:
~Background();
void update();
- void load(byte number);
+ void loadSprites(byte number);
void release();
// Setting the destination to negative coordinates means the picture should be drawn to it's original position.
diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp
index dc1c277877..e843d17c5b 100644
--- a/engines/avalanche/dialogs.cpp
+++ b/engines/avalanche/dialogs.cpp
@@ -157,7 +157,7 @@ void Dialogs::scrollModeNormal() {
Common::String e = "(c) 1994";
setReadyLight(3);
- _vm->_seeScroll = true;
+ _vm->_animationsEnabled = false;
_vm->_graphics->loadMouse(kCurFletch);
_vm->_graphics->saveScreen();
@@ -216,10 +216,8 @@ void Dialogs::scrollModeNormal() {
#endif
setReadyLight(0);
- _vm->_seeScroll = false;
+ _vm->_animationsEnabled = true;
_vm->_holdLeftMouse = false; // Used in Lucerna::checkclick().
-
- warning("STUB: Scrolls::scrollModeNormal()");
}
/**
@@ -290,7 +288,7 @@ bool Dialogs::theyMatch(TuneType &played) {
*/
void Dialogs::scrollModeMusic() {
setReadyLight(3);
- _vm->_seeScroll = true;
+ _vm->_animationsEnabled = false;
CursorMan.showMouse(false);
_vm->_graphics->loadMouse(kCurFletch);
@@ -299,7 +297,7 @@ void Dialogs::scrollModeMusic() {
played[i] = kPitchInvalid;
int8 lastOne = -1, thisOne = -1; // Invalid values.
- _vm->_seeScroll = true;
+ _vm->_animationsEnabled = false;
_vm->_graphics->saveScreen();
_vm->_graphics->showScroll();
@@ -363,6 +361,7 @@ void Dialogs::scrollModeMusic() {
value = 11;
break;
default:
+ error("cannot happen");
break;
}
@@ -392,7 +391,7 @@ void Dialogs::scrollModeMusic() {
_vm->_graphics->restoreScreen();
_vm->_graphics->removeBackup();
- _vm->_seeScroll = false;
+ _vm->_animationsEnabled = true;
CursorMan.showMouse(true);
}
@@ -645,9 +644,6 @@ void Dialogs::solidify(byte n) {
* 'calldriver' and 'display' by using Common::String instead of a private buffer.
*/
void Dialogs::displayText(Common::String text) {
-// bool was_virtual; // Was the mouse cursor virtual on entry to this proc?
- warning("STUB: Scrolls::calldrivers()");
-
_vm->_sound->stopSound();
setReadyLight(0);
diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp
index 0bc1f7eb8b..97adfc2581 100644
--- a/engines/avalanche/dropdown.cpp
+++ b/engines/avalanche/dropdown.cpp
@@ -405,8 +405,8 @@ Common::String DropDownMenu::selectGender(byte x) {
void DropDownMenu::setupMenuGame() {
_activeMenuItem.reset();
_activeMenuItem.setupOption("Help...", 'H', "f1", true);
- _activeMenuItem.setupOption("Boss Key", 'B', "alt-B", false);
- _activeMenuItem.setupOption("Untrash screen", 'U', "ctrl-f7", true);
+ _activeMenuItem.setupOption("Boss Key", 'B', "alt-B", true);
+ _activeMenuItem.setupOption("Untrash screen", 'U', "ctrl-f7", false);
_activeMenuItem.setupOption("Score and rank", 'S', "f9", true);
_activeMenuItem.setupOption("About Avvy...", 'A', "shift-f10", true);
_activeMenuItem.display();
@@ -678,7 +678,7 @@ void DropDownMenu::setup() {
_menuBar.draw();
}
-void DropDownMenu::update() { // TODO: Optimize it ASAP!!! It really needs it...
+void DropDownMenu::update() {
_vm->_graphics->saveScreen();
Common::Point cursorPos = _vm->getMousePos();
diff --git a/engines/avalanche/enums.h b/engines/avalanche/enums.h
index 998c96a131..0ba39321bc 100644
--- a/engines/avalanche/enums.h
+++ b/engines/avalanche/enums.h
@@ -30,6 +30,7 @@
namespace Avalanche {
+enum MonsterType { kMonsterTypeGhost, kMonsterTypeGlerk };
enum Flavour { kFlavourEga, kFlavourBgi, kFlavourNatural, kFlavourTwo, kFlavourOne };
diff --git a/engines/avalanche/ghostroom.cpp b/engines/avalanche/ghostroom.cpp
index 1419a0cbab..16c79fdee0 100644
--- a/engines/avalanche/ghostroom.cpp
+++ b/engines/avalanche/ghostroom.cpp
@@ -70,6 +70,30 @@ GhostRoom::~GhostRoom() {
for (int j = 0; j < 6; j++)
_greldet[j][i].free();
}
+
+ if (_wasLoaded) {
+ for (int i = 0; i < 5; i++) {
+ for (int j = 0; j < 2; j++) {
+ for (int y = 0; y < 66; y++) {
+ delete[] _ghost[i][j][y];
+ }
+ delete[] _ghost[i][j];
+ }
+ delete[] _ghost[i];
+ }
+ delete[] _ghost;
+
+ for (int i = 0; i < 6; i++) {
+ for (int j = 0; j < 4; j++) {
+ for (int y = 0; y < 35; y++) {
+ delete[] _glerk[i][j][y];
+ }
+ delete[] _glerk[i][j];
+ }
+ delete[] _glerk[i];
+ }
+ delete[] _glerk;
+ }
}
void GhostRoom::wait(uint16 howLong) {
@@ -141,9 +165,13 @@ void GhostRoom::loadPictures() {
file.seek(44);
// Initializing ghost's array.
+ _ghost = new byte***[5];
for (int i = 0; i < 5; i++) {
+ _ghost[i] = new byte**[2];
for (int j = 0; j < 2; j++) {
+ _ghost[i][j] = new byte*[66];
for (int y = 0; y < 66; y++) {
+ _ghost[i][j][y] = new byte[26];
for (int x = 0; x < 26; x++)
_ghost[i][j][y][x] = 0;
}
@@ -171,11 +199,14 @@ void GhostRoom::loadPictures() {
for (int i = 0; i < 3; i++)
_bat[i] = _vm->_graphics->ghostLoadPicture(file, dummyCoord);
-
// Initializing glerk's array.
+ _glerk = new byte***[6];
for (int i = 0; i < 6; i++) {
+ _glerk[i] = new byte**[4];
for (int j = 0; j < 4; j++) {
+ _glerk[i][j] = new byte*[35];
for (int y = 0; y < 35; y++) {
+ _glerk[i][j][y] = new byte[9];
for (int x = 0; x < 9; x++)
_glerk[i][j][y][x] = 0;
}
@@ -245,7 +276,7 @@ void GhostRoom::run() {
if (_glerkStage > 25)
break;
- _vm->_graphics->ghostDrawGlerk(_glerk[kGlerkFade[_glerkStage]], 456, 14);
+ _vm->_graphics->ghostDrawMonster(_glerk[kGlerkFade[_glerkStage]], 456, 14, kMonsterTypeGlerk);
_glerkStage++;
}
@@ -263,7 +294,7 @@ void GhostRoom::run() {
// Here comes the descending ghost:
for (int y = -64; y <= 103; y++) {
- _vm->_graphics->ghostDrawGhost(_ghost[1 + (abs(y / 7) % 2) * 3], 0, y);
+ _vm->_graphics->ghostDrawMonster(_ghost[1 + (abs(y / 7) % 2) * 3], 0, y, kMonsterTypeGhost);
if (y > 0)
_vm->_graphics->drawFilledRectangle(Common::Rect(0, y - 1, 26 * 8 + 1, y + 1), kColorBlack);
_vm->_graphics->refreshScreen();
@@ -277,7 +308,7 @@ void GhostRoom::run() {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 5; j++) {
_vm->_graphics->drawFilledRectangle(Common::Rect(0, 96, 26 * 8, 170), kColorBlack);
- _vm->_graphics->ghostDrawGhost(_ghost[kWaveOrder[j]], 0, 96 + kAdjustment[j]);
+ _vm->_graphics->ghostDrawMonster(_ghost[kWaveOrder[j]], 0, 96 + kAdjustment[j], kMonsterTypeGhost);
_aarghCount++;
diff --git a/engines/avalanche/ghostroom.h b/engines/avalanche/ghostroom.h
index ebb02f7aac..4c659128ce 100644
--- a/engines/avalanche/ghostroom.h
+++ b/engines/avalanche/ghostroom.h
@@ -58,11 +58,11 @@ private:
static const byte kGreldetFade[18];
Common::Point dummyCoord;
- byte _ghost[5][2][66][26];
+ byte ****_ghost;// [5][2][66][26]
Graphics::Surface _eyes[2];
Graphics::Surface _exclamation;
Graphics::Surface _bat[3];
- byte _glerk[6][4][35][9];
+ byte ****_glerk; // [6][4][35][9]
Graphics::Surface _aargh[6];
Common::Point _aarghWhere[6];
Graphics::Surface _greenEyes[5];
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index ae53f3e034..513cd72c8c 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -527,64 +527,65 @@ void GraphicManager::nimFree() {
_nimLogo.free();
}
-void GraphicManager::ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, int16 destY) {
+void GraphicManager::ghostDrawMonster(byte ***picture, uint16 destX, int16 destY, MonsterType type) {
+ uint16 height = 0;
+ uint16 width = 0;
+ // Only for the Ghost:
const byte kPlaneToUse[4] = { 0, 0, 0, 1 };
- // Constants from the original code:
- uint16 height = 66;
- const uint16 width = 26 * 8;
-
- // We have to mess around with the coords and the sizes since
- // the ghost isn't always placed fully on the screen.
int yStart = 0;
- if (destY < 0) {
- yStart = abs(destY);
- height -= yStart;
- destY = 0;
- }
-
- Graphics::Surface ghostPic;
- ghostPic.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
-
- for (int y = 0; y < height; y++) {
- for (int plane = 0; plane < 4; plane++) {
- for (uint16 x = 0; x < width / 8; x ++) {
- byte pixel = ghostArr[kPlaneToUse[plane]][y + yStart][x];
- for (int bit = 0; bit < 8; bit++) {
- byte pixelBit = (pixel >> bit) & 1;
- *(byte *)ghostPic.getBasePtr(x * 8 + 7 - bit, y) += (pixelBit << plane);
- }
- }
+
+ // Constants from the original code:
+ switch (type) {
+ case kMonsterTypeGhost:
+ height = 66;
+ width = 208; // 26 * 8
+
+ // We have to mess around with the coords and the sizes since
+ // the ghost isn't always placed fully on the screen.
+ if (destY < 0) {
+ yStart = abs(destY);
+ height -= yStart;
+ destY = 0;
}
+ break;
+ case kMonsterTypeGlerk:
+ height = 35;
+ width = 72; // 9 * 8
+ break;
+ default:
+ break;
}
- drawPicture(_surface, ghostPic, destX, destY);
-
- ghostPic.free();
-}
-
-void GraphicManager::ghostDrawGlerk(byte glerkArr[4][35][9], uint16 destX, uint16 destY) {
- // Constants from the original code:
- const uint16 height = 35;
- const uint16 width = 9 * 8;
-
- Graphics::Surface glerkPic;
- glerkPic.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+ Graphics::Surface monsterPicture;
+ monsterPicture.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
for (int y = 0; y < height; y++) {
for (int plane = 0; plane < 4; plane++) {
for (uint16 x = 0; x < width / 8; x++) {
- byte pixel = glerkArr[plane][y][x];
+ byte pixel = 0;
+
+ switch (type) {
+ case kMonsterTypeGhost:
+ pixel = picture[kPlaneToUse[plane]][y + yStart][x];
+ break;
+ case kMonsterTypeGlerk:
+ pixel = picture[plane][y][x];
+ break;
+ default:
+ break;
+ }
+
for (int bit = 0; bit < 8; bit++) {
byte pixelBit = (pixel >> bit) & 1;
- *(byte *)glerkPic.getBasePtr(x * 8 + 7 - bit, y) += (pixelBit << plane);
+ *(byte *)monsterPicture.getBasePtr(x * 8 + 7 - bit, y) += (pixelBit << plane);
}
}
}
}
- drawPicture(_surface, glerkPic, destX, destY);
+ drawPicture(_surface, monsterPicture, destX, destY);
- glerkPic.free();
+ monsterPicture.free();
}
/**
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index 7e0ed64b5f..bd8fc6c8ff 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -97,8 +97,7 @@ public:
void drawWinningPic();
// Ghostroom's functions:
- void ghostDrawGhost(byte ghostArr[2][66][26], uint16 destX, int16 destY); // Very similar to loadPictureSign(). TODO: Unify the two later if possible.
- void ghostDrawGlerk(byte glerkArr[4][35][9], uint16 destX, uint16 destY); // Very similar to ghostDrawGhost(), but not enough to unify the two.
+ void ghostDrawMonster(byte ***picture, uint16 destX, int16 destY, MonsterType type);
Graphics::Surface ghostLoadPicture(Common::File &file, Common::Point &coord);
void ghostDrawPicture(const Graphics::Surface &picture, uint16 destX, uint16 destY);
void ghostDrawBackgroundItems(Common::File &file);
@@ -106,7 +105,7 @@ public:
// Help's function:
void helpDrawButton(int y, byte which);
void helpDrawHighlight(byte which, Color color);
- void helpDrawBigText(const Common::String text, int16 x, int16 y, Color color); // Very similar to drawText. TODO: Try to unify the two.
+ void helpDrawBigText(const Common::String text, int16 x, int16 y, Color color);
// Shoot em' up's functions:
void seuDrawTitle();
@@ -199,12 +198,11 @@ private:
Graphics::Surface loadPictureSign(Common::File &file, uint16 width, uint16 height); // Reads a tricky type of picture used for the "game over"/"about" scrolls and in the mini-game Nim.
void drawText(Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color);
- void drawBigText(Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color); // Very similar to drawText. TODO: Try to unify the two.
+ void drawBigText(Graphics::Surface &surface, const Common::String text, FontType font, byte fontHeight, int16 x, int16 y, Color color);
void drawPicture(Graphics::Surface &target, const Graphics::Surface picture, uint16 destX, uint16 destY);
// Taken from Free Pascal's Procedure InternalEllipseDefault. Used to replace Pascal's procedure arc.
// Returns the end point of the arc. (Needed in Clock.)
- // TODO: Make it more accurate later.
Common::Point drawArc(Graphics::Surface &surface, int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color);
};
diff --git a/engines/avalanche/help.cpp b/engines/avalanche/help.cpp
index 8584bfa78c..9b077eb4fb 100644
--- a/engines/avalanche/help.cpp
+++ b/engines/avalanche/help.cpp
@@ -199,8 +199,8 @@ bool Help::handleMouse(const Common::Event &event) {
if (_highlightWas != highlightIs)
_vm->_graphics->helpDrawHighlight(_highlightWas, kColorBlue);
- // Highligt the current one with the proper color:
- if (_buttons[highlightIs]._trigger != Common::KEYCODE_INVALID) {
+ // Highlight the current one with the proper color:
+ if ((highlightIs != 177) && (_buttons[highlightIs]._trigger != Common::KEYCODE_INVALID)) {
_highlightWas = highlightIs;
_vm->_graphics->helpDrawHighlight(highlightIs, highlightColor);
}
diff --git a/engines/avalanche/highscore.cpp b/engines/avalanche/highscore.cpp
new file mode 100644
index 0000000000..5f47aeb894
--- /dev/null
+++ b/engines/avalanche/highscore.cpp
@@ -0,0 +1,110 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software; you can redistribute it and/or
+* 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.
+*
+*/
+
+/*
+* This code is based on the original source code of Lord Avalot d'Argent version 1.3.
+* Copyright (c) 1994-1995 Mike: Mark and Thomas Thurman.
+*/
+
+#include "avalanche/avalanche.h"
+#include "avalanche/highscore.h"
+
+#include "common/savefile.h"
+
+namespace Avalanche {
+
+HighScore::HighScore(AvalancheEngine *vm) {
+ _vm = vm;
+}
+
+void HighScore::displayHighScores() {
+ warning("STUB: HighScore::displayHighScores(");
+}
+
+void HighScore::saveHighScores() {
+ int firstSmaller = 0;
+ while ((firstSmaller < 12) && (_data[firstSmaller]._score >= _vm->_score))
+ firstSmaller++;
+
+ if (firstSmaller < 12) {
+ // Shift all the lower scores down a space:
+ for (int i = firstSmaller; i < 11; i++)
+ _data[i + 1] = _data[i];
+ // Set the new high score:
+ _data[firstSmaller]._name = "Player"; // TODO: Come up with something for that. In the original it wasn't implemented at all...
+ _data[firstSmaller]._rank = _vm->_parser->rank();
+ _data[firstSmaller]._score = _vm->_score;
+ }
+
+ Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving("scores.avd");
+ if (!f) {
+ warning("Can't create file 'scores.avd', high scores are not saved.");
+ return;
+ }
+ Common::Serializer sz(NULL, f);
+ syncHighScores(sz);
+ f->finalize();
+ delete f;
+}
+
+void HighScore::loadHighScroes() {
+ Common::File file;
+ if (!file.exists("scores.avd")) {
+ produceDefaultHighScores();
+ } else {
+ Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading("scores.avd");
+ if (!f)
+ return;
+ Common::Serializer sz(f, NULL);
+ syncHighScores(sz);
+ delete f;
+ }
+}
+
+void HighScore::produceDefaultHighScores() {
+ for (int i = 0; i < 12; i++) {
+ _data[i]._score = 32 - (i + 1) * 2;
+ _data[i]._rank = "...";
+ }
+ _data[0]._name = "Mike";
+ _data[1]._name = "Liz";
+ _data[2]._name = "Thomas";
+ _data[3]._name = "Mark";
+ _data[4]._name = "Mandy";
+ _data[5]._name = "Andrew";
+ _data[6]._name = "Lucy Tryphena";
+ _data[7]._name = "Tammy the dog";
+ _data[8]._name = "Avaricius";
+ _data[9]._name = "Spellchick";
+ _data[10]._name = "Caddelli";
+ _data[11]._name = "Spludwick";
+}
+
+void HighScore::syncHighScores(Common::Serializer &sz) {
+ for (int i = 0; i < 12; i++) {
+ sz.syncString(_data[i]._name);
+ sz.syncAsUint16LE(_data[i]._score);
+ sz.syncString(_data[i]._rank);
+ }
+}
+
+} // End of namespace Avalanche
diff --git a/engines/avalanche/highscore.h b/engines/avalanche/highscore.h
new file mode 100644
index 0000000000..de7ec36ed5
--- /dev/null
+++ b/engines/avalanche/highscore.h
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software; you can redistribute it and/or
+* 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.
+*
+*/
+
+/*
+* This code is based on the original source code of Lord Avalot d'Argent version 1.3.
+* Copyright (c) 1994-1995 Mike: Mark and Thomas Thurman.
+*/
+
+#ifndef AVALANCHE_HIGHSCORE_H
+#define AVALANCHE_HIGHSCORE_H
+
+namespace Avalanche {
+class AvalancheEngine;
+
+struct HighScoreData {
+ Common::String _name;
+ uint16 _score;
+ Common::String _rank;
+};
+
+class HighScore {
+public:
+ HighScore(AvalancheEngine *vm);
+
+ void displayHighScores();
+ void saveHighScores();
+ void loadHighScroes();
+
+private:
+ AvalancheEngine *_vm;
+
+ HighScoreData _data[12];
+
+ void produceDefaultHighScores();
+ void syncHighScores(Common::Serializer &sz);
+};
+
+} // End of namespace Avalanche
+
+#endif // AVALANCHE_HIGHSCORE_H
diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk
index d31fd0d91a..29bc039b42 100644
--- a/engines/avalanche/module.mk
+++ b/engines/avalanche/module.mk
@@ -20,7 +20,8 @@ MODULE_OBJS = \
ghostroom.o \
help.o \
shootemup.o \
- mainmenu.o
+ mainmenu.o \
+ highscore.o
# This module can be built as a plugin
ifeq ($(ENABLE_AVALANCHE), DYNAMIC_PLUGIN)
diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp
index 44e8dde9ae..b152747ab0 100644
--- a/engines/avalanche/parser.cpp
+++ b/engines/avalanche/parser.cpp
@@ -602,7 +602,7 @@ Common::String Parser::rank() {
};
for (int i = 0; i < 8; i++) {
- if ((_vm->_dnascore >= ranks[i]._score) && (_vm->_dnascore < ranks[i + 1]._score))
+ if ((_vm->_score >= ranks[i]._score) && (_vm->_score < ranks[i + 1]._score))
return Common::String(ranks[i]._title);
}
return "";
@@ -2021,8 +2021,7 @@ void Parser::doThat() {
break;
case 55:
if (_vm->_room == kRoomArgentPub)
- // play_nim();
- warning("STUB: Parser::doThat() - case kVerbCodeplay - play_nim()");
+ _vm->_nim->playNim();
else
_vm->_dialogs->displayText(kWhat);
break;
@@ -2052,8 +2051,7 @@ void Parser::doThat() {
_vm->_dialogs->displayText("Hello, Phaon!");
break;
case kVerbCodeBoss:
- // bosskey();
- warning("STUB: Parser::doThat() - case kVerbCodeboss");
+ bossKey();
break;
case kVerbCodePee:
if (_vm->getFlag('P')) {
@@ -2308,7 +2306,7 @@ void Parser::doThat() {
break;
case kVerbCodeScore: {
Common::String tmpStr = Common::String::format("Your score is %d,%c%cout of a possible 128.%c%c " \
- "This gives you a rank of %s.%c%c%s", _vm->_dnascore, kControlCenter, kControlNewLine, kControlNewLine,
+ "This gives you a rank of %s.%c%c%s", _vm->_score, kControlCenter, kControlNewLine, kControlNewLine,
kControlNewLine, rank().c_str(), kControlNewLine, kControlNewLine, totalTime().c_str());
_vm->_dialogs->displayText(tmpStr);
}
@@ -2426,6 +2424,25 @@ void Parser::doThat() {
}
}
+void Parser::bossKey() {
+ _vm->_graphics->saveScreen();
+ _vm->_graphics->blackOutScreen();
+ _vm->_graphics->loadMouse(kCurUpArrow);
+ _vm->loadBackground(98);
+ _vm->_graphics->drawNormalText("Graph/Histo/Draw/Sample: \"JANJUN93.GRA\": (W3-AB3)", _vm->_font, 8, 120, 169, kColorDarkgray);
+ _vm->_graphics->drawNormalText("Press any key or click the mouse to return.", _vm->_font, 8, 144, 182, kColorDarkgray);
+ _vm->_graphics->refreshScreen();
+ Common::Event event;
+ _vm->getEvent(event);
+ while ((!_vm->shouldQuit()) && (event.type != Common::EVENT_KEYDOWN) && (event.type != Common::EVENT_LBUTTONDOWN)){
+ _vm->getEvent(event);
+ _vm->_graphics->refreshScreen();
+ }
+ _vm->_graphics->restoreScreen();
+ _vm->_graphics->removeBackup();
+ _vm->loadBackground(_vm->_room);
+}
+
void Parser::verbOpt(byte verb, Common::String &answer, char &ansKey) {
// kVerbCodegive isn't dealt with by this procedure, but by ddm__with.
switch (verb) {
diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h
index 46408f518a..6133c41442 100644
--- a/engines/avalanche/parser.h
+++ b/engines/avalanche/parser.h
@@ -72,13 +72,11 @@ public:
byte _wearing; // what you're wearing
Parser(AvalancheEngine *vm);
-
void init();
void parse();
void doThat();
void verbOpt(byte verb, Common::String &answer, char &ansKey);
void drink();
-
void handleInputText(const Common::Event &event);
void handleBackspace();
void handleReturn();
@@ -89,7 +87,7 @@ public:
void tryDropdown();
int16 getPos(const Common::String &crit, const Common::String &src);
void doVerb(VerbCode id);
-
+ Common::String rank();
void resetVariables();
void synchronize(Common::Serializer &sz);
@@ -112,10 +110,7 @@ private:
byte wordNum(Common::String word);
void replace(Common::String oldChars, byte newChar);
-
- Common::String rank();
Common::String totalTime();
-
void clearWords();
void cheatParse(Common::String codes);
void stripPunctuation(Common::String &word);
@@ -146,6 +141,7 @@ private:
void playHarp();
void winSequence();
void wipeText();
+ void bossKey();
};
} // End of namespace Avalanche
diff --git a/engines/avalanche/shootemup.cpp b/engines/avalanche/shootemup.cpp
index 8d61316daa..cabd19d6f9 100644
--- a/engines/avalanche/shootemup.cpp
+++ b/engines/avalanche/shootemup.cpp
@@ -95,7 +95,7 @@ ShootEmUp::ShootEmUp(AvalancheEngine *vm) {
_gotOut = false;
}
-void ShootEmUp::run() {
+uint16 ShootEmUp::run() {
CursorMan.showMouse(false);
_vm->_graphics->saveScreen();
_vm->fadeOut();
@@ -142,12 +142,14 @@ void ShootEmUp::run() {
if (delay <= 55)
_vm->_system->delayMillis(55 - delay); // Replaces slowdown(); 55 comes from 18.2 Hz (B Flight).
};
-
+
_vm->fadeOut();
_vm->_graphics->restoreScreen();
_vm->_graphics->removeBackup();
_vm->fadeIn();
CursorMan.showMouse(true);
+
+ return _score;
}
bool ShootEmUp::overlap(uint16 a1x, uint16 a1y, uint16 a2x, uint16 a2y, uint16 b1x, uint16 b1y, uint16 b2x, uint16 b2y) {
diff --git a/engines/avalanche/shootemup.h b/engines/avalanche/shootemup.h
index 4c010aa71e..3cdcc1d5cd 100644
--- a/engines/avalanche/shootemup.h
+++ b/engines/avalanche/shootemup.h
@@ -35,7 +35,7 @@ class ShootEmUp {
public:
ShootEmUp(AvalancheEngine *vm);
- void run();
+ uint16 run();
private:
struct Sprite {
diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp
index 7b6e1ee1ce..a9753b3cce 100644
--- a/engines/avalanche/timer.cpp
+++ b/engines/avalanche/timer.cpp
@@ -333,12 +333,11 @@ void Timer::hangAround2() {
// We don't need the ShootEmUp during the whole game, it's only playable once.
ShootEmUp *shootemup = new ShootEmUp(_vm);
- shootemup->run();
+ _shootEmUpScore = shootemup->run();
delete shootemup;
}
void Timer::afterTheShootemup() {
- // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented!
_vm->flipRoom(_vm->_room, 1);
_vm->_animation->_sprites[0]->init(0, true); // Avalot.
@@ -347,27 +346,15 @@ void Timer::afterTheShootemup() {
_vm->_objects[kObjectCrossbow - 1] = true;
_vm->refreshObjectList();
- // Same as the added line above: TODO: Remove it later!!!
- _vm->_dialogs->displayText(Common::String("P.S.: There should have been the mini-game called \"shoot em' up\", " \
- "but I haven't implemented it yet: you get the crossbow automatically.") + kControlNewLine + kControlNewLine + "Peter (uruk)");
-
-#if 0
- byte shootscore, gain;
-
- shootscore = mem[storage_seg * storage_ofs];
- gain = (shootscore + 5) / 10; // Rounding up.
-
- display(string("\6Your score was ") + strf(shootscore) + '.' + "\r\rYou gain (" +
- strf(shootscore) + " 0xF6 10) = " + strf(gain) + " points.");
+ byte gain = (_shootEmUpScore + 5) / 10; // Rounding up.
+ _vm->_dialogs->displayText(Common::String::format("%cYour score was %d.%c%cYou gain (%d \xf6 10) = %d points.", kControlItalic, _shootEmUpScore, kControlNewLine, kControlNewLine, _shootEmUpScore, gain));
if (gain > 20) {
- display("But we won't let you have more than 20 points!");
- points(20);
+ _vm->_dialogs->displayText("But we won't let you have more than 20 points!");
+ _vm->incScore(20);
} else
- points(gain);
-#endif
+ _vm->incScore(gain);
- warning("STUB: Timer::after_the_shootemup()");
_vm->_dialogs->displayScrollChain('Q', 70);
}
@@ -712,6 +699,8 @@ void Timer::resetVariables() {
_times[i]._action = 0;
_times[i]._reason = 0;
}
+
+ _shootEmUpScore = 0;
}
} // End of namespace Avalanche.
diff --git a/engines/avalanche/timer.h b/engines/avalanche/timer.h
index fd51544fd1..ad6ac0eae6 100644
--- a/engines/avalanche/timer.h
+++ b/engines/avalanche/timer.h
@@ -170,7 +170,7 @@ public:
private:
AvalancheEngine *_vm;
-
+ byte _shootEmUpScore;
};
} // End of namespace Avalanche.
diff --git a/engines/bbvs/bbvs.cpp b/engines/bbvs/bbvs.cpp
index 8bcc4d3809..d2e13e525c 100644
--- a/engines/bbvs/bbvs.cpp
+++ b/engines/bbvs/bbvs.cpp
@@ -79,7 +79,41 @@ BbvsEngine::BbvsEngine(OSystem *syst, const ADGameDescription *gd) :
Engine(syst), _gameDescription(gd) {
_random = new Common::RandomSource("bbvs");
-
+ _currActionCommandIndex = -1;
+ _buttheadObject = nullptr;
+ _beavisObject = nullptr;
+ _currCameraNum = 0;
+ _walkAreasCount = 0;
+ _walkInfosCount = 0;
+ _walkableRectsCount = 0;
+ _sourceWalkArea = nullptr;
+ _destWalkArea = nullptr;
+ _currWalkDistance = kMaxDistance;
+ _walkReachedDestArea = false;
+ _hasSnapshot = false;
+ _snapshot = nullptr;
+ _snapshotStream = nullptr;
+ _isSaveAllowed = false;
+
+ for (int i = 0; i < 80; i++) {
+ _walkAreas[i].x = 0;
+ _walkAreas[i].y = 0;
+ _walkAreas[i].width = 0;
+ _walkAreas[i].height = 0;
+ _walkAreas[i].checked = false;
+ _walkAreas[i].linksCount = 0;
+ for (int j = 0; j < 16; j++)
+ _walkAreas[i].links[j] = nullptr;
+ for (int j = 0; j < 32; j++) {
+ _walkAreas[i].linksD1[j] = nullptr;
+ _walkAreas[i].linksD2[j] = nullptr;
+ }
+ }
+
+ for (int i = 0; i < 256; i++) {
+ _walkInfoPtrs[i] = nullptr;
+ }
+
Engine::syncSoundSettings();
}
diff --git a/engines/bbvs/bbvs.h b/engines/bbvs/bbvs.h
index 8136184e0b..6a9a13905c 100644
--- a/engines/bbvs/bbvs.h
+++ b/engines/bbvs/bbvs.h
@@ -199,6 +199,7 @@ struct WalkArea {
bool contains(const Common::Point &pt) const;
};
+const int kSnapshotSize = 23072;
const int kSceneObjectsCount = 64;
const int kSceneSoundsCount = 8;
const int kInventoryItemStatusCount = 50;
@@ -209,6 +210,7 @@ const int kSceneVisitedCount = 64;
const int kMainMenu = 44;
const int kCredits = 45;
+const int kMaxDistance = 0xFFFFFF;
static const int8 kWalkTurnTbl[] = {
7, 9, 4, 8, 6, 10, 5, 11
};
@@ -303,7 +305,6 @@ public:
bool _walkReachedDestArea;
bool _hasSnapshot;
- uint32 _snapshotSize;
byte *_snapshot;
Common::SeekableMemoryWriteStream *_snapshotStream;
diff --git a/engines/bbvs/saveload.cpp b/engines/bbvs/saveload.cpp
index 3bb980053c..ff53cc457b 100644
--- a/engines/bbvs/saveload.cpp
+++ b/engines/bbvs/saveload.cpp
@@ -212,9 +212,8 @@ bool BbvsEngine::existsSavegame(int num) {
}
void BbvsEngine::allocSnapshot() {
- _snapshotSize = 23072;
- _snapshot = new byte[_snapshotSize];
- _snapshotStream = new Common::SeekableMemoryWriteStream(_snapshot, _snapshotSize);
+ _snapshot = new byte[kSnapshotSize];
+ _snapshotStream = new Common::SeekableMemoryWriteStream(_snapshot, kSnapshotSize);
}
void BbvsEngine::freeSnapshot() {
diff --git a/engines/bbvs/walk.cpp b/engines/bbvs/walk.cpp
index cabe402a46..cf8942e525 100644
--- a/engines/bbvs/walk.cpp
+++ b/engines/bbvs/walk.cpp
@@ -44,8 +44,6 @@ static const int8 kWalkAnimTbl[32] = {
};
void BbvsEngine::startWalkObject(SceneObject *sceneObject) {
- const int kMaxDistance = 0xFFFFFF;
-
if (_buttheadObject != sceneObject && _beavisObject != sceneObject)
return;
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index a409d765b4..3f7aa4abc9 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -50,13 +50,6 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
DebugMan.addDebugChannel(kCGEDebugFile, "file", "CGE IO debug channel");
DebugMan.addDebugChannel(kCGEDebugEngine, "engine", "CGE Engine debug channel");
- _startupMode = 1;
- _oldLev = 0;
- _pocPtr = 0;
- _quitFlag = false;
- _showBoundariesFl = false;
- _startGameSlot = -1;
- _recentStep = -2;
_bitmapPalette = nullptr;
_pocLight = nullptr;
_keyboard = nullptr;
@@ -83,6 +76,42 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
_miniShp = nullptr;
_miniShpList = nullptr;
_console = nullptr;
+ _sprTv = nullptr;
+ _sprK1 = nullptr;
+ _sprK2 = nullptr;
+ _sprK3 = nullptr;
+ _font = nullptr;
+ _vga = nullptr;
+ _sys = nullptr;
+
+ _quitFlag = false;
+ _showBoundariesFl = false;
+ _music = true;
+ _dark = false;
+ _game = false;
+ _endGame = false;
+ for (int i = 0; i < 4; i++)
+ _flag[i] = false;
+
+ _startupMode = 1;
+ _oldLev = 0;
+ _pocPtr = 0;
+ _startGameSlot = -1;
+ _recentStep = -2;
+ _lastFrame = 0;
+ _lastTick = 0;
+ _maxScene = 0;
+ _now = 1;
+ _lev = -1;
+ _mode = 0;
+ _gameCase2Cpt = 0;
+ _offUseCount = 0;
+ _volume[0] = 0;
+ _volume[1] = 0;
+ for (int i = 0; i < kPocketNX; i++)
+ _pocref[i] = -1;
+
+ initSceneValues();
}
void CGEEngine::initSceneValues() {
@@ -98,17 +127,16 @@ void CGEEngine::initSceneValues() {
}
void CGEEngine::init() {
- debugC(1, kCGEDebugEngine, "CGEEngine::setup()");
+ debugC(1, kCGEDebugEngine, "CGEEngine::init()");
// Initialize fields
- _lastFrame = 0;
- _lastTick = 0;
- _hero = NULL;
- _shadow = NULL;
- _miniScene = NULL;
- _miniShp = NULL;
- _miniShpList = NULL;
- _sprite = NULL;
+ _hero = nullptr;
+ _shadow = nullptr;
+ _miniScene = nullptr;
+ _miniShp = nullptr;
+ _miniShpList = nullptr;
+ _sprite = nullptr;
+
_resman = new ResourceManager();
// Create debugger console
@@ -117,12 +145,12 @@ void CGEEngine::init() {
// Initialize engine objects
_font = new Font(this, "CGE");
_text = new Text(this, "CGE");
- _talk = NULL;
+ _talk = nullptr;
_vga = new Vga(this);
_sys = new System(this);
_pocLight = new PocLight(this);
for (int i = 0; i < kPocketNX; i++)
- _pocket[i] = NULL;
+ _pocket[i] = nullptr;
_horzLine = new HorizLine(this);
_infoLine = new InfoLine(this, kInfoW);
_sceneLight = new SceneLight(this);
@@ -137,30 +165,6 @@ void CGEEngine::init() {
_sound = new Sound(this);
_offUseCount = atoi(_text->getText(kOffUseCount));
- _music = true;
-
- for (int i = 0; i < kPocketNX; i++)
- _pocref[i] = -1;
- _volume[0] = 0;
- _volume[1] = 0;
-
- initSceneValues();
-
- _maxScene = 0;
- _dark = false;
- _game = false;
- _endGame = false;
- _now = 1;
- _lev = -1;
- _recentStep = -2;
-
- for (int i = 0; i < 4; i++)
- _flag[i] = false;
-
- _mode = 0;
- _soundOk = 1;
- _sprTv = NULL;
- _gameCase2Cpt = 0;
_startGameSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
}
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index 8c5ae29e18..a65069ff46 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -107,7 +107,6 @@ struct SavegameHeader {
Graphics::Surface *thumbnail;
int saveYear, saveMonth, saveDay;
int saveHour, saveMinutes;
- int totalFrames;
};
extern const char *savegameStr;
@@ -168,7 +167,6 @@ public:
int _now;
int _lev;
int _mode;
- int _soundOk;
int _gameCase2Cpt;
int _offUseCount;
Dac *_bitmapPalette;
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 260fd8997a..e738b6ebb3 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -195,7 +195,6 @@ bool CGEEngine::loadGame(int slotNumber, SavegameHeader *header, bool tiny) {
debugC(1, kCGEDebugEngine, "CGEEngine::loadgame(%d, header, %s)", slotNumber, tiny ? "true" : "false");
Common::MemoryReadStream *readStream;
- SavegameHeader saveHeader;
if (slotNumber == -1) {
// Loading the data for the initial game state
@@ -231,6 +230,8 @@ bool CGEEngine::loadGame(int slotNumber, SavegameHeader *header, bool tiny) {
return false;
} else {
// Found header
+ SavegameHeader saveHeader;
+
if (!readSavegameHeader(readStream, saveHeader)) {
delete readStream;
return false;
@@ -397,7 +398,7 @@ void CGEEngine::syncGame(Common::SeekableReadStream *readStream, Common::WriteSt
}
} else {
// Loading game
- if (_soundOk == 1 && _mode == 0) {
+ if (_mode == 0) {
// Skip Digital and Midi volumes, useless under ScummVM
sndSetVolume();
}
@@ -424,7 +425,7 @@ void CGEEngine::syncGame(Common::SeekableReadStream *readStream, Common::WriteSt
}
bool CGEEngine::readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header) {
- header.thumbnail = NULL;
+ header.thumbnail = nullptr;
// Get the savegame version
header.version = in->readByte();
@@ -1483,25 +1484,6 @@ bool CGEEngine::showTitle(const char *name) {
selectPocket(-1);
_vga->sunrise(_vga->_sysPal);
- if (_mode < 2 && !_soundOk) {
- _vga->copyPage(1, 2);
- _vga->copyPage(0, 1);
- _vga->_showQ->append(_mouse);
- _mouse->on();
- for (; !_commandHandler->idle() || Vmenu::_addr;) {
- mainLoop();
- if (_quitFlag)
- return false;
- }
-
- _mouse->off();
- _vga->_showQ->clear();
- _vga->copyPage(0, 2);
- _soundOk = 2;
- if (_music)
- _midiPlayer->loadMidi(0);
- }
-
if (_mode < 2) {
// At this point the game originally set the protection variables
// used by the copy protection check
@@ -1540,7 +1522,7 @@ void CGEEngine::cge_main() {
if (_horzLine)
_horzLine->_flags._hide = true;
- if (_music && _soundOk)
+ if (_music)
_midiPlayer->loadMidi(0);
if (_startGameSlot != -1) {
diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp
index 4fcf9f8ad8..2b1f74db02 100644
--- a/engines/cge/fileio.cpp
+++ b/engines/cge/fileio.cpp
@@ -93,13 +93,11 @@ ResourceManager::~ResourceManager() {
delete _buff[i]._page;
}
-uint16 ResourceManager::XCrypt(byte *buf, uint16 length) {
+void ResourceManager::XCrypt(byte *buf, uint16 length) {
byte *b = buf;
for (uint16 i = 0; i < length; i++)
*b++ ^= kCryptSeed;
-
- return kCryptSeed;
}
bool ResourceManager::seek(int32 offs, int whence) {
@@ -118,7 +116,7 @@ uint16 ResourceManager::read(byte *buf, uint16 length) {
}
BtPage *ResourceManager::getPage(int level, uint16 pageId) {
- debugC(1, kCGEDebugFile, "IoHand::getPage(%d, %d)", level, pageId);
+ debugC(1, kCGEDebugFile, "ResourceManager::getPage(%d, %d)", level, pageId);
if (_buff[level]._pageNo != pageId) {
int32 pos = pageId * kBtSize;
@@ -142,7 +140,7 @@ BtPage *ResourceManager::getPage(int level, uint16 pageId) {
}
BtKeypack *ResourceManager::find(const char *key) {
- debugC(1, kCGEDebugFile, "IoHand::find(%s)", key);
+ debugC(1, kCGEDebugFile, "ResourceManager::find(%s)", key);
int lev = 0;
uint16 nxt = kBtValRoot;
diff --git a/engines/cge/fileio.h b/engines/cge/fileio.h
index 803d6b2d58..059d2c9a44 100644
--- a/engines/cge/fileio.h
+++ b/engines/cge/fileio.h
@@ -86,13 +86,13 @@ class ResourceManager {
uint16 catRead(byte *buf, uint16 length);
Common::File *_catFile;
Common::File *_datFile;
- uint16 XCrypt(byte *buf, uint16 length);
+ void XCrypt(byte *buf, uint16 length);
public:
ResourceManager();
~ResourceManager();
uint16 read(byte *buf, uint16 length);
- bool seek(int32 offs, int whence = 0);
+ bool seek(int32 offs, int whence = SEEK_SET);
BtKeypack *find(const char *key);
bool exist(const char *name);
diff --git a/engines/cine/anim.cpp b/engines/cine/anim.cpp
index f47b33bf16..c6099447d8 100644
--- a/engines/cine/anim.cpp
+++ b/engines/cine/anim.cpp
@@ -287,7 +287,7 @@ void AnimData::load(byte *d, int type, uint16 w, uint16 h, int16 file,
_fileIdx = file;
_frameIdx = frame;
memset(_name, 0, sizeof(_name));
- strcpy(_name, n);
+ Common::strlcpy(_name, n, sizeof(_name));
_realWidth = w;
switch (type) {
diff --git a/engines/cine/bg.cpp b/engines/cine/bg.cpp
index 3b80a9c037..ce808e0f6a 100644
--- a/engines/cine/bg.cpp
+++ b/engines/cine/bg.cpp
@@ -48,7 +48,7 @@ byte loadCtFW(const char *ctName) {
}
if (currentCtName != ctName)
- strcpy(currentCtName, ctName);
+ Common::strlcpy(currentCtName, ctName, sizeof(currentCtName));
ptr = dataPtr = readBundleFile(foundFileIdx);
@@ -75,7 +75,7 @@ byte loadCtOS(const char *ctName) {
}
if (currentCtName != ctName)
- strcpy(currentCtName, ctName);
+ Common::strlcpy(currentCtName, ctName, sizeof(currentCtName));
ptr = dataPtr = readBundleFile(foundFileIdx);
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index 797bc38938..a4af8f2201 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -55,6 +55,14 @@ CineEngine::CineEngine(OSystem *syst, const CINEGameDescription *gameDesc)
_console = new CineConsole(this);
g_cine = this;
+
+ for (int i = 0; i < NUM_FONT_CHARS; i++) {
+ _textHandler.fontParamTable[i].characterIdx = 0;
+ _textHandler.fontParamTable[i].characterWidth = 0;
+ }
+ _restartRequested = false;
+ _preLoad = false;
+ _timerDelayMultiplier = 12;
}
CineEngine::~CineEngine() {
diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp
index ab83594054..f6419ecafc 100644
--- a/engines/cine/gfx.cpp
+++ b/engines/cine/gfx.cpp
@@ -730,7 +730,7 @@ void FWRenderer::loadBg16(const byte *bg, const char *name, unsigned int idx) {
assert(_background);
- strcpy(_bgName, name);
+ Common::strlcpy(_bgName, name, sizeof(_bgName));
// Load the 16 color palette
_backupPal.load(bg, kLowPalNumBytes, kLowPalFormat, kLowPalNumColors, CINE_BIG_ENDIAN);
@@ -1403,7 +1403,7 @@ void OSRenderer::loadBg16(const byte *bg, const char *name, unsigned int idx) {
assert(_bgTable[idx].bg);
- strcpy(_bgTable[idx].name, name);
+ Common::strlcpy(_bgTable[idx].name, name, sizeof(_bgTable[idx].name));
// Load the 16 color palette
_bgTable[idx].pal.load(bg, kLowPalNumBytes, kLowPalFormat, kLowPalNumColors, CINE_BIG_ENDIAN);
@@ -1441,7 +1441,7 @@ void OSRenderer::loadBg256(const byte *bg, const char *name, unsigned int idx) {
assert(_bgTable[idx].bg);
- strcpy(_bgTable[idx].name, name);
+ Common::strlcpy(_bgTable[idx].name, name, sizeof(_bgTable[idx].name));
_bgTable[idx].pal.load(bg, kHighPalNumBytes, kHighPalFormat, kHighPalNumColors, CINE_LITTLE_ENDIAN);
memcpy(_bgTable[idx].bg, bg + kHighPalNumBytes, _screenSize);
}
diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp
index a1d9b49133..f3985c691e 100644
--- a/engines/cine/pal.cpp
+++ b/engines/cine/pal.cpp
@@ -62,9 +62,9 @@ int16 findPaletteFromName(const char *fileName) {
uint16 position = 0;
uint16 i;
- strcpy(buffer, fileName);
+ Common::strlcpy(buffer, fileName, sizeof(buffer));
- while (position < strlen(fileName)) {
+ while (position < strlen(buffer)) {
if (buffer[position] > 'a' && buffer[position] < 'z') {
buffer[position] += 'A' - 'a';
}
diff --git a/engines/cine/part.cpp b/engines/cine/part.cpp
index c55972bf56..30d9461a6a 100644
--- a/engines/cine/part.cpp
+++ b/engines/cine/part.cpp
@@ -47,7 +47,7 @@ void loadPart(const char *partName) {
g_cine->_partFileHandle.readUint16BE(); // entry size
if (currentPartName != partName)
- strcpy(currentPartName, partName);
+ Common::strlcpy(currentPartName, partName, sizeof(currentPartName));
for (uint16 i = 0; i < g_cine->_partBuffer.size(); i++) {
g_cine->_partFileHandle.read(g_cine->_partBuffer[i].partName, 14);
diff --git a/engines/cine/script_fw.cpp b/engines/cine/script_fw.cpp
index c02868d5b0..c0b0c1f5da 100644
--- a/engines/cine/script_fw.cpp
+++ b/engines/cine/script_fw.cpp
@@ -1419,19 +1419,19 @@ int FWScript::o1_loadNewPrcName() {
switch (param1) {
case 0:
debugC(5, kCineDebugScript, "Line: %d: loadPrc(\"%s\")", _line, param2);
- strcpy(newPrcName, param2);
+ Common::strlcpy(newPrcName, param2, sizeof(newPrcName));
break;
case 1:
debugC(5, kCineDebugScript, "Line: %d: loadRel(\"%s\")", _line, param2);
- strcpy(newRelName, param2);
+ Common::strlcpy(newRelName, param2, sizeof(newRelName));
break;
case 2:
debugC(5, kCineDebugScript, "Line: %d: loadObject(\"%s\")", _line, param2);
- strcpy(newObjectName, param2);
+ Common::strlcpy(newObjectName, param2, sizeof(newObjectName));
break;
case 3:
debugC(5, kCineDebugScript, "Line: %d: loadMsg(\"%s\")", _line, param2);
- strcpy(newMsgName, param2);
+ Common::strlcpy(newMsgName, param2, sizeof(newMsgName));
break;
}
return 0;
diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp
index e2d9d22e6f..069a4787ac 100644
--- a/engines/cine/sound.cpp
+++ b/engines/cine/sound.cpp
@@ -813,7 +813,7 @@ bool PCSoundFxPlayer::load(const char *song) {
if (dot) {
*dot = '\0';
}
- strcat(instrument, _driver->getInstrumentExtension());
+ Common::strlcat(instrument, _driver->getInstrumentExtension(), sizeof(instrument));
uint32 instrumentSize;
_instrumentsData[i] = readBundleSoundFile(instrument, &instrumentSize);
if (!_instrumentsData[i]) {
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index aa1c22c165..8687699a44 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -557,12 +557,20 @@ int16 selectSubObject(int16 x, int16 y, int16 param) {
}
}
+ if (selectedObject >= 20)
+ error("Invalid value for selectedObject: %d", selectedObject);
return objListTab[selectedObject];
}
-// TODO: Make separate functions for Future Wars's and Operation Stealth's version of this function, this is getting too messy
-// TODO: Add support for using the different prepositions for different verbs (Doesn't work currently)
void makeCommandLine() {
+ if (g_cine->getGameType() == Cine::GType_FW)
+ makeFWCommandLine();
+ else
+ makeOSCommandLine();
+}
+
+// TODO: Add support for using the different prepositions for different verbs (Doesn't work currently)
+void makeOSCommandLine() {
uint16 x, y;
commandVar1 = 0;
@@ -578,28 +586,16 @@ void makeCommandLine() {
int16 si;
getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
-
- if (g_cine->getGameType() == Cine::GType_FW) {
- si = selectSubObject(x, y + 8, -2);
- } else {
- si = selectSubObject(x, y + 8, -subObjectUseTable[playerCommand]);
- }
+ si = selectSubObject(x, y + 8, -subObjectUseTable[playerCommand]);
if (si < 0) {
- if (g_cine->getGameType() == Cine::GType_OS) {
- canUseOnObject = 0;
- } else { // Future Wars
- playerCommand = -1;
- g_cine->_commandBuffer = "";
- }
+ canUseOnObject = 0;
} else {
- if (g_cine->getGameType() == Cine::GType_OS) {
- if (si >= 8000) {
- si -= 8000;
- canUseOnObject = canUseOnItemTable[playerCommand];
- } else {
- canUseOnObject = 0;
- }
+ if (si >= 8000) {
+ si -= 8000;
+ canUseOnObject = canUseOnItemTable[playerCommand];
+ } else {
+ canUseOnObject = 0;
}
commandVar3[0] = si;
@@ -607,27 +603,21 @@ void makeCommandLine() {
g_cine->_commandBuffer += " ";
g_cine->_commandBuffer += g_cine->_objectTable[commandVar3[0]].name;
g_cine->_commandBuffer += " ";
- if (g_cine->getGameType() == Cine::GType_OS) {
- g_cine->_commandBuffer += commandPrepositionTable[playerCommand];
- } else { // Future Wars
- g_cine->_commandBuffer += defaultCommandPreposition;
- }
+ g_cine->_commandBuffer += commandPrepositionTable[playerCommand];
}
}
- if (g_cine->getGameType() == Cine::GType_OS || !(playerCommand != -1 && choiceResultTable[playerCommand] == 2)) {
- if (playerCommand == 2) {
- getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
- CursorMan.showMouse(false);
- processInventory(x, y + 8);
- playerCommand = -1;
- commandVar1 = 0;
- g_cine->_commandBuffer = "";
- CursorMan.showMouse(true);
- }
+ if (playerCommand == 2) {
+ getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
+ CursorMan.showMouse(false);
+ processInventory(x, y + 8);
+ playerCommand = -1;
+ commandVar1 = 0;
+ g_cine->_commandBuffer = "";
+ CursorMan.showMouse(true);
}
- if (g_cine->getGameType() == Cine::GType_OS && playerCommand != 2) {
+ if (playerCommand != 2) {
if (playerCommand != -1 && canUseOnObject != 0) { // call use on sub object
int16 si;
@@ -665,7 +655,55 @@ void makeCommandLine() {
}
}
- if (g_cine->getGameType() == Cine::GType_OS || !disableSystemMenu) {
+ isDrawCommandEnabled = 1;
+ renderer->setCommand(g_cine->_commandBuffer);
+}
+
+// TODO: Add support for using the different prepositions for different verbs (Doesn't work currently)
+void makeFWCommandLine() {
+ uint16 x, y;
+
+ commandVar1 = 0;
+ commandVar2 = -10;
+
+ if (playerCommand != -1) {
+ g_cine->_commandBuffer = defaultActionCommand[playerCommand];
+ } else {
+ g_cine->_commandBuffer = "";
+ }
+
+ if ((playerCommand != -1) && (choiceResultTable[playerCommand] == 2)) { // need object selection?
+ int16 si;
+
+ getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
+ si = selectSubObject(x, y + 8, -2);
+
+ if (si < 0) {
+ playerCommand = -1;
+ g_cine->_commandBuffer = "";
+ } else {
+ commandVar3[0] = si;
+ commandVar1 = 1;
+ g_cine->_commandBuffer += " ";
+ g_cine->_commandBuffer += g_cine->_objectTable[commandVar3[0]].name;
+ g_cine->_commandBuffer += " ";
+ g_cine->_commandBuffer += defaultCommandPreposition;
+ }
+ }
+
+ if (!(playerCommand != -1 && choiceResultTable[playerCommand] == 2)) {
+ if (playerCommand == 2) {
+ getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
+ CursorMan.showMouse(false);
+ processInventory(x, y + 8);
+ playerCommand = -1;
+ commandVar1 = 0;
+ g_cine->_commandBuffer = "";
+ CursorMan.showMouse(true);
+ }
+ }
+
+ if (!disableSystemMenu) {
isDrawCommandEnabled = 1;
renderer->setCommand(g_cine->_commandBuffer);
}
diff --git a/engines/cine/various.h b/engines/cine/various.h
index 04f2d47743..eb6312997d 100644
--- a/engines/cine/various.h
+++ b/engines/cine/various.h
@@ -37,6 +37,8 @@ void initLanguage(Common::Language lang);
int16 makeMenuChoice(const CommandeType commandList[], uint16 height, uint16 X, uint16 Y, uint16 width, bool recheckValue = false);
void makeCommandLine();
+void makeFWCommandLine();
+void makeOSCommandLine();
void makeActionMenu();
void waitPlayerInput();
void setTextWindow(uint16 param1, uint16 param2, uint16 param3, uint16 param4);
diff --git a/engines/cruise/font.cpp b/engines/cruise/font.cpp
index c63be30f77..80fb0e8a02 100644
--- a/engines/cruise/font.cpp
+++ b/engines/cruise/font.cpp
@@ -148,8 +148,6 @@ void initSystem() {
preloadData[i].nofree = 0;
}
- lowMemory = 0;
-
doFade = 0;
fadeFlag = 0;
scroll = 0;
diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp
index e727ac73cb..7af6b73238 100644
--- a/engines/cruise/function.cpp
+++ b/engines/cruise/function.cpp
@@ -606,7 +606,7 @@ int16 Op_InitializeState() {
}
int16 Op_GetlowMemory() {
- return lowMemory;
+ return 0;
}
int16 Op_AniDir() {
diff --git a/engines/cruise/saveload.cpp b/engines/cruise/saveload.cpp
index a991c29583..a734db4b3b 100644
--- a/engines/cruise/saveload.cpp
+++ b/engines/cruise/saveload.cpp
@@ -182,11 +182,13 @@ static void syncFilesDatabase(Common::Serializer &s) {
s.syncAsUint16LE(fe.resType);
s.syncAsUint16LE(fe.height);
- // TODO: Have a look at the saving/loading of this pointer
+ // Remember whether this file database was open or not.
+ // Upon loading, loadSavegameData uses this information
+ // in order to re-open the file databases accordingly.
tmp = (fe.subData.ptr) ? 1 : 0;
s.syncAsUint32LE(tmp);
if (s.isLoading()) {
- fe.subData.ptr = (uint8 *)tmp;
+ fe.subData.ptr = tmp ? (uint8 *)1 : 0;
}
s.syncAsSint16LE(fe.subData.index);
@@ -195,11 +197,11 @@ static void syncFilesDatabase(Common::Serializer &s) {
s.syncAsSint16LE(fe.subData.transparency);
- // TODO: Have a look at the saving/loading of this pointer
+ // Treat fe.subData.ptrMask the same as fe.subData.ptr.
tmp = (fe.subData.ptrMask) ? 1 : 0;
s.syncAsUint32LE(tmp);
if (s.isLoading()) {
- fe.subData.ptrMask = (uint8 *)tmp;
+ fe.subData.ptrMask = tmp ? (uint8 *)1 : 0;
}
s.syncAsUint16LE(fe.subData.resourceType);
@@ -806,7 +808,6 @@ Common::Error saveSavegameData(int saveGameIdx, const Common::String &saveName)
}
Common::Error loadSavegameData(int saveGameIdx) {
- int lowMemorySave;
Common::String saveName;
cellStruct *currentcellHead;
@@ -878,20 +879,19 @@ Common::Error loadSavegameData(int saveGameIdx) {
lastAni[0] = 0;
- lowMemorySave = lowMemory;
-
for (int i = 0; i < NUM_FILE_ENTRIES; i++) {
if (filesDatabase[i].subData.ptr) {
int j;
int k;
- for (j = i + 1; j < NUM_FILE_ENTRIES && filesDatabase[j].subData.ptr && !strcmp(filesDatabase[i].subData.name, filesDatabase[j].subData.name) && (filesDatabase[j].subData.index == (j - i)); j++)
+ for (j = i + 1; j < NUM_FILE_ENTRIES &&
+ filesDatabase[j].subData.ptr &&
+ !strcmp(filesDatabase[i].subData.name, filesDatabase[j].subData.name) &&
+ (filesDatabase[j].subData.index == (j - i));
+ j++)
;
for (k = i; k < j; k++) {
- if (filesDatabase[k].subData.ptrMask)
- lowMemory = 0;
-
filesDatabase[k].subData.ptr = NULL;
filesDatabase[k].subData.ptrMask = NULL;
}
@@ -908,7 +908,6 @@ Common::Error loadSavegameData(int saveGameIdx) {
}
i = j - 1;
- lowMemory = lowMemorySave;
}
}
diff --git a/engines/cruise/vars.cpp b/engines/cruise/vars.cpp
index f7c74c8e6d..9a59c8a714 100644
--- a/engines/cruise/vars.cpp
+++ b/engines/cruise/vars.cpp
@@ -31,7 +31,6 @@ uint8 selectColor = 3;
uint8 titleColor = 2;
uint8 subColor = 5;
-int16 lowMemory;
int16 scroll;
int16 switchPal;
char cmdLine[90];
diff --git a/engines/cruise/vars.h b/engines/cruise/vars.h
index 8bfcdc57d4..fe3f7d6303 100644
--- a/engines/cruise/vars.h
+++ b/engines/cruise/vars.h
@@ -59,7 +59,6 @@ extern uint8 selectColor;
extern uint8 titleColor;
extern uint8 subColor;
-extern int16 lowMemory;
extern int16 scroll;
extern int16 switchPal;
extern char cmdLine[90];
diff --git a/engines/fullpipe/behavior.cpp b/engines/fullpipe/behavior.cpp
index 2e3a4e2e44..14e9c33bdf 100644
--- a/engines/fullpipe/behavior.cpp
+++ b/engines/fullpipe/behavior.cpp
@@ -83,7 +83,7 @@ void BehaviorManager::updateBehaviors() {
if (!_isActive)
return;
- debug(0, "BehaviorManager::updateBehaviors()");
+ debug(4, "BehaviorManager::updateBehaviors()");
for (uint i = 0; i < _behaviors.size(); i++) {
BehaviorInfo *beh = _behaviors[i];
@@ -122,7 +122,7 @@ void BehaviorManager::updateBehaviors() {
}
void BehaviorManager::updateBehavior(BehaviorInfo *behaviorInfo, BehaviorEntry *entry) {
- debug(0, "BehaviorManager::updateBehavior() %d", entry->_itemsCount);
+ debug(4, "BehaviorManager::updateBehavior() %d", entry->_itemsCount);
for (int i = 0; i < entry->_itemsCount; i++) {
BehaviorEntryInfo *bhi = entry->_items[i];
if (!(bhi->_flags & 1)) {
@@ -144,7 +144,7 @@ void BehaviorManager::updateBehavior(BehaviorInfo *behaviorInfo, BehaviorEntry *
}
void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, BehaviorEntry *bhe) {
- debug(0, "BehaviorManager::updateStaticAniBehavior(%s)", transCyrillic((byte *)ani->_objectName));
+ debug(4, "BehaviorManager::updateStaticAniBehavior(%s)", transCyrillic((byte *)ani->_objectName));
MessageQueue *mq = 0;
@@ -236,7 +236,7 @@ void BehaviorInfo::clear() {
}
void BehaviorInfo::initAmbientBehavior(GameVar *var, Scene *sc) {
- debug(0, "BehaviorInfo::initAmbientBehavior(%s)", transCyrillic((byte *)var->_varName));
+ debug(4, "BehaviorInfo::initAmbientBehavior(%s)", transCyrillic((byte *)var->_varName));
clear();
_itemsCount = 1;
@@ -260,7 +260,7 @@ void BehaviorInfo::initAmbientBehavior(GameVar *var, Scene *sc) {
}
void BehaviorInfo::initObjectBehavior(GameVar *var, Scene *sc, StaticANIObject *ani) {
- debug(0, "BehaviorInfo::initObjectBehavior(%s)", transCyrillic((byte *)var->_varName));
+ debug(4, "BehaviorInfo::initObjectBehavior(%s)", transCyrillic((byte *)var->_varName));
clear();
diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h
index 33ae1e524a..f76a12fb2b 100644
--- a/engines/fullpipe/constants.h
+++ b/engines/fullpipe/constants.h
@@ -43,6 +43,8 @@ namespace Fullpipe {
#define MV_LFT_OPEN 1048
#define MV_MAN_GOLADDER 451
#define MV_MAN_GOLADDER2 2844
+#define MV_MAN_HMRKICK 1028
+#define MV_MAN_HMRKICK_COINLESS 1445
#define MV_MAN_LIFTDOWN 1052
#define MV_MAN_LIFTUP 1051
#define MV_MAN_LOOKUP 4773
@@ -219,8 +221,11 @@ namespace Fullpipe {
#define SC_MAINMENU 4620
#define SC_MAP 5222
#define SC_TITLES 5166
+#define SND_CMN_015 3139
#define SND_CMN_031 3516
#define SND_CMN_032 3517
+#define SND_CMN_054 4762
+#define SND_CMN_055 4763
#define SND_CMN_060 4921
#define SND_CMN_061 4922
#define SND_CMN_070 5199
@@ -266,6 +271,27 @@ namespace Fullpipe {
#define TrubaLeft 474
#define TrubaUp 680
+// Main Menu
+#define PIC_MNU_AUTHORS_L 4624
+#define PIC_MNU_CONTINUE_L 4626
+#define PIC_MNU_DEBUG_L 4632
+#define PIC_MNU_EXIT_L 4622
+#define PIC_MNU_LOAD_L 4628
+#define PIC_MNU_MUSICSLIDER_D 4914
+#define PIC_MNU_MUSICSLIDER_L 4915
+#define PIC_MNU_RESTART_L 5299
+#define PIC_MNU_SAVE_L 4630
+#define PIC_MNU_SLIDER_D 4913
+#define PIC_MNU_SLIDER_L 4912
+
+// Query dialog
+#define PIC_MEX_BGR 5300
+#define PIC_MEX_CANCEL 5302
+#define PIC_MEX_OK 5301
+#define PIC_MOV_BGR 5343
+#define PIC_MOV_CANCEL 5345
+#define PIC_MOV_OK 5344
+
// Intro
#define ANI_IN1MAN 5110
#define MSG_INTR_ENDINTRO 5139
@@ -887,20 +913,41 @@ namespace Fullpipe {
#define MSG_SC18_SHOWGIRLJUMPTO 1499
#define MSG_SC18_SHOWMANJUMP 1510
#define MSG_SC18_SHOWMANJUMPTO 1508
+#define MV_BOY18_JUMPFROM 1478
#define MV_BOY18_JUMPTO 1481
+#define MV_GRL18_JUMPFROM 1485
+#define MV_GRL18_JUMPTO 1488
+#define MV_KSL_CALMDOWN 1476
+#define MV_KSL_INBOY 1491
+#define MV_KSL_INGIRL 1493
#define MV_KSL_INMAN 1504
+#define MV_KSL_JUMPBOY 1473
+#define MV_KSL_JUMPGIRL 1475
+#define MV_KSL_JUMPMAN 1509
#define MV_KSL_SWING 1460
#define MV_KSL_SWINGBOY 1462
#define MV_KSL_SWINGGIRL 1464
+#define MV_KSL_SWINGMAN 1502
+#define MV_MAN18_JUMPTOTRUBA 1511
+#define MV_MAN18_STANDKRESLO 1500
#define MV_WHR18_SPIN 1300
#define PIC_SC18_DOMIN 5184
#define PIC_SC18_LADDER1 1471
#define PIC_SC18_LADDER2 1472
#define PIC_SC18_LADDER3 3299
#define PIC_SC18_RTRUBA 1520
+#define QU_SC19_MANJUMP1 1516
+#define QU_SC19_MANJUMP2 1517
+#define QU_SC19_MANJUMP3 1518
#define SND_18_006 3906
#define SND_18_010 4994
+#define ST_KSL_BOY 1463
+#define ST_KSL_GIRL 1465
+#define ST_KSL_JUMPBOY 1492
+#define ST_KSL_JUMPGIRL 1494
#define ST_KSL_JUMPMAN 1505
+#define ST_KSL_MAN 1503
+#define ST_KSL_REACT 1474
// Scene 19
#define ANI_CORDIE 1529
@@ -1255,6 +1302,65 @@ namespace Fullpipe {
#define QU_SC28_WMN_START 3452
#define ST_MAN28_RIGHT 4249
+// Scene 29
+#define ANI_ASS 2120
+#define ANI_PORTER 2082
+#define ANI_SHELL_GREEN 2116
+#define ANI_SHELL_RED 2130
+#define ANI_SHOOTER1 2108
+#define ANI_SHOOTER2 2111
+#define MSG_SC29_DISABLEPORTER 2097
+#define MSG_SC29_DISABLERIDEBACK 2106
+#define MSG_SC29_ENABLEPORTER 2096
+#define MSG_SC29_ENABLERIDEBACK 2105
+#define MSG_SC29_LAUGH 4760
+#define MSG_SC29_SHOOTGREEN 2119
+#define MSG_SC29_SHOOTRED 2137
+#define MSG_SC29_SHOWLASTGREEN 2730
+#define MSG_SC29_SHOWLASTRED 2731
+#define MSG_SC29_STOPRIDE 2107
+#define MV_ASS_HITGREEN 2138
+#define MV_ASS_HITRED 2139
+#define MV_BRDCMN_GOR 4735
+#define MV_MAN29_BEND 2091
+#define MV_MAN29_HIT 2088
+#define MV_MAN29_JUMP 2090
+#define MV_MAN29_RUN 2095
+#define MV_MAN29_STANDUP 2092
+#define MV_MAN29_STANDUP_NORM 2093
+#define MV_PTR_MOVEFAST 2102
+#define MV_SHG_HITASS 2151
+#define MV_SHG_HITMAN 2147
+#define MV_SHG_NORM 2117
+#define MV_SHR_HITASS 2152
+#define MV_SHR_HITMAN 2149
+#define MV_SHR_NORM 2131
+#define MV_STR1_SHOOT 2109
+#define MV_STR2_SHOOT 2112
+#define PIC_SC29_LTRUBA 2081
+#define QU_SC29_BRD1 4741
+#define QU_SC29_BRD2 4742
+#define QU_SC29_BRDOUT1 4743
+#define QU_SC29_BRDOUT2 4744
+#define QU_SC29_ESCAPE 2129
+#define QU_SC29_MANFROM_L 2101
+#define QU_SC29_MANFROM_R 2104
+#define QU_SC29_MANTO_L 2103
+#define QU_SC29_MANTO_R 2100
+#define SND_29_014 4348
+#define SND_29_027 4757
+#define SND_29_028 4758
+#define SND_29_029 4759
+#define ST_ASS_NORM 2122
+#define ST_BRDCMN_GOR 4734
+#define ST_BRDCMN_RIGHT 4732
+#define ST_MAN29_RUNR 2140
+#define ST_MAN29_SITR 2141
+#define ST_STR1_RIGHT 2143
+#define ST_STR2_RIGHT 2144
+#define ST_STR1_STAND 2110
+#define ST_STR2_STAND 2113
+
// Scene 30
#define ANI_LEG 2322
#define MSG_SC30_UPDATEPATH 2358
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index 4446af7b60..5369c05de7 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -71,6 +71,7 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_flgSoundList = true;
_sfxVolume = 0;
+ _musicVolume = 0;
_inputController = 0;
_inputDisabled = false;
@@ -95,6 +96,7 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_gamePaused = false;
_inputArFlag = false;
_recordEvents = false;
+ _mainMenu_debugEnabled = false;
_flgGameIsRunning = true;
@@ -102,6 +104,18 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_musicAllowed = -1;
_musicGameVar = 0;
+ _musicMinDelay = 0;
+ _musicMaxDelay = 0;
+ _musicLocal = 0;
+ _trackStartDelay = 0;
+
+ memset(_sceneTracks, 0, sizeof(_sceneTracks));
+ memset(_trackName, 0, sizeof(_trackName));
+ memset(_sceneTracksCurrentTrack, 0, sizeof(_sceneTracksCurrentTrack));
+
+ _numSceneTracks = 0;
+ _sceneTrackHasSequence = false;
+ _sceneTrackIsPlaying = false;
_aniMan = 0;
_aniMan2 = 0;
@@ -190,6 +204,10 @@ void FullpipeEngine::initialize() {
_mgm = new MGM;
}
+void FullpipeEngine::restartGame() {
+ warning("STUB: FullpipeEngine::restartGame()");
+}
+
Common::Error FullpipeEngine::run() {
const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0);
// Initialize backend
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index 17a771bd5d..27505252ab 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -91,6 +91,7 @@ public:
GUI::Debugger *getDebugger() { return _console; }
void initialize();
+ void restartGame();
void setMusicAllowed(int val) { _musicAllowed = val; }
@@ -125,6 +126,7 @@ public:
bool _flgGameIsRunning;
bool _inputArFlag;
bool _recordEvents;
+ bool _mainMenu_debugEnabled;
Common::Rect _sceneRect;
int _sceneWidth;
@@ -149,18 +151,32 @@ public:
int _currSoundListCount;
bool _soundEnabled;
bool _flgSoundList;
+ char _sceneTracks[10][260];
+ int _numSceneTracks;
+ bool _sceneTrackHasSequence;
+ int _musicMinDelay;
+ int _musicMaxDelay;
+ int _musicLocal;
+ char _trackName[2600];
+ int _trackStartDelay;
+ char _sceneTracksCurrentTrack[260];
+ bool _sceneTrackIsPlaying;
void stopAllSounds();
void toggleMute();
void playSound(int id, int flag);
void playTrack(GameVar *sceneVar, const char *name, bool delayed);
+ int getSceneTrack();
void startSceneTrack();
+ void startSoundStream1(char *trackName);
void stopSoundStream2();
void stopAllSoundStreams();
void stopAllSoundInstances(int id);
void updateSoundVolume();
+ void setMusicVolume(int vol);
int _sfxVolume;
+ int _musicVolume;
GlobalMessageQueueList *_globalMessageQueueList;
MessageHandler *_messageHandlers;
@@ -296,6 +312,7 @@ public:
GameVar *_musicGameVar;
Audio::SoundHandle _sceneTrackHandle;
+
public:
bool _isSaveAllowed;
diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp
index e172b9b0f2..d9f7327a6b 100644
--- a/engines/fullpipe/gameloader.cpp
+++ b/engines/fullpipe/gameloader.cpp
@@ -272,7 +272,7 @@ bool preloadCallback(PreloadItem &pre, int flag) {
g_fp->_currSoundList1[0] = g_fp->accessScene(SC_COMMON)->_soundList;
}
- g_vars->scene18_var01 = 0;
+ g_vars->scene18_inScene18p1 = false;
if ((pre.preloadId1 != SC_18 || pre.sceneId != SC_19) && (pre.preloadId1 != SC_19 || (pre.sceneId != SC_18 && pre.sceneId != SC_19))) {
if (g_fp->_scene3) {
@@ -284,7 +284,7 @@ bool preloadCallback(PreloadItem &pre, int flag) {
} else {
scene19_setMovements(g_fp->accessScene(pre.preloadId1), pre.keyCode);
- g_vars->scene18_var01 = 1;
+ g_vars->scene18_inScene18p1 = true;
if (pre.preloadId1 == SC_18) {
g_fp->_gameLoader->saveScenePicAniInfos(SC_18);
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index 137af86f48..7c66a9a747 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -90,7 +90,16 @@ Background::Background() {
}
Background::~Background() {
- warning("STUB: Background::~Background()");
+ _picObjList.clear();
+
+ for (int i = 0; i < _bigPictureArray1Count; i++) {
+ for (int j = 0; j < _bigPictureArray2Count; j++)
+ delete _bigPictureArray[i][j];
+
+ free(_bigPictureArray[i]);
+ }
+
+ free(_bigPictureArray);
}
bool Background::load(MfcArchive &file) {
@@ -159,7 +168,9 @@ PictureObject::PictureObject() {
}
PictureObject::~PictureObject() {
- warning("STUB: PictureObject::~PictureObject()");
+ delete _picture;
+ _pictureObject2List->clear();
+ delete _pictureObject2List;
}
PictureObject::PictureObject(PictureObject *src) : GameObject(src) {
diff --git a/engines/fullpipe/input.cpp b/engines/fullpipe/input.cpp
index 0678d15368..7c97461a24 100644
--- a/engines/fullpipe/input.cpp
+++ b/engines/fullpipe/input.cpp
@@ -275,6 +275,8 @@ void FullpipeEngine::updateCursorCommon() {
}
void FullpipeEngine::initArcadeKeys(const char *varname) {
+ _arcadeKeys.clear();
+
GameVar *var = getGameLoaderGameVar()->getSubVarByName(varname)->getSubVarByName("KEYPOS");
if (!var)
@@ -294,6 +296,37 @@ void FullpipeEngine::initArcadeKeys(const char *varname) {
}
}
+void FullpipeEngine::processArcade(ExCommand *cmd) {
+ if (!g_fp->_aniMan2)
+ return;
+
+ int idx;
+
+ if (cmd->_sceneClickX <= g_fp->_aniMan2->_ox) {
+ for (idx = (int)_arcadeKeys.size() - 1; idx >= 0; idx--) {
+ if (_arcadeKeys[idx]->x < g_fp->_aniMan2->_ox)
+ break;
+ }
+
+ if (idx < 0)
+ return;
+ } else {
+ for (idx = 0; idx < (int)_arcadeKeys.size(); idx++) {
+ if (_arcadeKeys[idx]->x > g_fp->_aniMan2->_ox)
+ break;
+ }
+
+ if (idx >= (int)_arcadeKeys.size())
+ return;
+ }
+
+ cmd->_sceneClickX = _arcadeKeys[idx]->x;
+ cmd->_sceneClickY = _arcadeKeys[idx]->y;
+
+ cmd->_x = cmd->_sceneClickX - g_fp->_sceneRect.left;
+ cmd->_y = cmd->_sceneClickY - g_fp->_sceneRect.top;
+}
+
void FullpipeEngine::setArcadeOverlay(int picId) {
Common::Point point;
Common::Point point2;
diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp
index 6b6ceb6eeb..84e9688e30 100644
--- a/engines/fullpipe/interaction.cpp
+++ b/engines/fullpipe/interaction.cpp
@@ -56,7 +56,9 @@ bool canInteractAny(GameObject *obj1, GameObject *obj2, int invId) {
}
InteractionController::~InteractionController() {
- warning("STUB: InteractionController::~InteractionController()");
+ _interactions.clear();
+
+ removeMessageHandler(124, -1);
}
bool InteractionController::load(MfcArchive &file) {
@@ -427,7 +429,14 @@ Interaction::Interaction() {
}
Interaction::~Interaction() {
- warning("STUB: Interaction::~Interaction()");
+ if (_messageQueue) {
+ while (_messageQueue->getExCommandByIndex(0))
+ _messageQueue->deleteExCommandByIndex(0, 1);
+ }
+
+ delete _messageQueue;
+
+ free(_actionName);
}
bool Interaction::load(MfcArchive &file) {
diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp
index cfe8adf86f..e79f9c54df 100644
--- a/engines/fullpipe/inventory.cpp
+++ b/engines/fullpipe/inventory.cpp
@@ -447,6 +447,15 @@ int Inventory2::getHoveredItem(Common::Point *point) {
return 0;
}
+void Inventory2::clear() {
+ unselectItem(0);
+
+ for (uint i = 0; i < _inventoryItems.size(); i++)
+ getInventoryPoolItemFieldCById(_inventoryItems[i]->itemId);
+
+ _inventoryItems.clear();
+}
+
void FullpipeEngine::getAllInventory() {
Inventory2 *inv = getGameLoaderInventory();
diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h
index 833cccc355..46b55c5669 100644
--- a/engines/fullpipe/inventory.h
+++ b/engines/fullpipe/inventory.h
@@ -129,6 +129,8 @@ class Inventory2 : public Inventory {
bool unselectItem(bool flag);
void draw();
+
+ void clear();
};
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/messagehandlers.cpp b/engines/fullpipe/messagehandlers.cpp
index b8e7b5c1db..15aa78d342 100644
--- a/engines/fullpipe/messagehandlers.cpp
+++ b/engines/fullpipe/messagehandlers.cpp
@@ -34,11 +34,69 @@
namespace Fullpipe {
void global_messageHandler_KickStucco() {
- warning("STUB: global_messageHandler_KickStucco()");
+ Movement *mov = g_fp->_aniMan->getMovementById(MV_MAN_HMRKICK);
+ int end = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+ bool flip = false;
+
+ for (int i = 0; i < end; i++) {
+ ExCommand *ex = mov->getDynamicPhaseByIndex(i)->_exCommand;
+
+ if (ex)
+ if (ex->_messageKind == 35)
+ if (ex->_messageNum == SND_CMN_015) {
+ if (flip) {
+ ex->_messageNum = SND_CMN_055;
+ } else {
+ ex->_messageNum = SND_CMN_054;
+ flip = true;
+ }
+ }
+ }
+
+ mov = g_fp->_aniMan->getMovementById(MV_MAN_HMRKICK_COINLESS);
+ end = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+ flip = false;
+
+ for (int i = 0; i < end; i++) {
+ ExCommand *ex = mov->getDynamicPhaseByIndex(i)->_exCommand;
+
+ if (ex)
+ if (ex->_messageKind == 35)
+ if (ex->_messageNum == SND_CMN_015) {
+ if (flip) {
+ ex->_messageNum = SND_CMN_055;
+ } else {
+ ex->_messageNum = SND_CMN_054;
+ flip = true;
+ }
+ }
+ }
}
void global_messageHandler_KickMetal() {
- warning("STUB: global_messageHandler_KickMetal()");
+ Movement *mov = g_fp->_aniMan->getMovementById(MV_MAN_HMRKICK);
+ int end = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+
+ for (int i = 0; i < end; i++) {
+ ExCommand *ex = mov->getDynamicPhaseByIndex(i)->_exCommand;
+
+ if (ex)
+ if (ex->_messageKind == 35)
+ if (ex->_messageNum == SND_CMN_054 || ex->_messageNum == SND_CMN_055)
+ ex->_messageNum = SND_CMN_015;
+ }
+
+ mov = g_fp->_aniMan->getMovementById(MV_MAN_HMRKICK_COINLESS);
+ end = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+
+ for (int i = 0; i < end; i++) {
+ ExCommand *ex = mov->getDynamicPhaseByIndex(i)->_exCommand;
+
+ if (ex)
+ if (ex->_messageKind == 35)
+ if (ex->_messageNum == SND_CMN_054 || ex->_messageNum == SND_CMN_055)
+ ex->_messageNum = SND_CMN_015;
+ }
}
int global_messageHandler1(ExCommand *cmd) {
@@ -528,9 +586,9 @@ int global_messageHandler4(ExCommand *cmd) {
ExCommand2 *cmd2 = (ExCommand2 *)cmd;
if (cmd->_excFlags & 1) {
- ani->startAnimSteps(cmd->_messageNum, 0, cmd->_x, cmd->_y, cmd2->_points, cmd2->_pointsSize >> 3, flags);
+ ani->startAnimSteps(cmd->_messageNum, 0, cmd->_x, cmd->_y, cmd2->_points, cmd2->_pointsSize, flags);
} else {
- ani->startAnimSteps(cmd->_messageNum, cmd->_parId, cmd->_x, cmd->_y, cmd2->_points, cmd2->_pointsSize >> 3, flags);
+ ani->startAnimSteps(cmd->_messageNum, cmd->_parId, cmd->_x, cmd->_y, cmd2->_points, cmd2->_pointsSize, flags);
}
break;
}
diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp
index 9c8f5ac4e2..8257d1459f 100644
--- a/engines/fullpipe/messages.cpp
+++ b/engines/fullpipe/messages.cpp
@@ -699,6 +699,10 @@ void GlobalMessageQueueList::addMessageQueue(MessageQueue *msg) {
push_back(msg);
}
+void clearGlobalMessageQueueList() {
+ g_fp->_globalMessageQueueList->clear();
+}
+
void clearGlobalMessageQueueList1() {
clearMessages();
diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h
index da579d58c0..e6f7f05150 100644
--- a/engines/fullpipe/messages.h
+++ b/engines/fullpipe/messages.h
@@ -193,6 +193,7 @@ void clearMessageHandlers();
void processMessages();
void updateGlobalMessageQueue(int id, int objid);
void clearMessages();
+void clearGlobalMessageQueueList();
void clearGlobalMessageQueueList1();
bool chainQueue(int queueId, int flags);
diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp
index 603aaff026..459c714984 100644
--- a/engines/fullpipe/modal.cpp
+++ b/engines/fullpipe/modal.cpp
@@ -21,12 +21,13 @@
*/
#include "fullpipe/fullpipe.h"
-#include "fullpipe/modal.h"
#include "fullpipe/messages.h"
#include "fullpipe/constants.h"
#include "fullpipe/motion.h"
#include "fullpipe/scenes.h"
#include "fullpipe/gameloader.h"
+#include "fullpipe/statics.h"
+#include "fullpipe/modal.h"
#include "fullpipe/constants.h"
@@ -718,7 +719,7 @@ bool ModalCredits::init(int counterdiff) {
g_fp->_modalObject = menu;
- menu->_field_34 = 1;
+ menu->_mfield_34 = 1;
}
return true;
@@ -750,9 +751,513 @@ void ModalCredits::update() {
}
ModalMainMenu::ModalMainMenu() {
- warning("STUB: ModalMainMenu::ModalMainMenu()");
+ _areas.clear();
+
+ _lastArea = 0;
+ _hoverAreaId = 0;
+ _mfield_34 = 0;
+ _scene = g_fp->accessScene(SC_MAINMENU);
+ _debugKeyCount = 0;
+ _sliderOffset = 0;
+ _screct.left = g_fp->_sceneRect.left;
+ _screct.top = g_fp->_sceneRect.top;
+ _screct.right = g_fp->_sceneRect.right;
+ _screct.bottom = g_fp->_sceneRect.bottom;
+
+ if (g_fp->_currentScene) {
+ _bgX = g_fp->_currentScene->_x;
+ _bgY = g_fp->_currentScene->_y;
+ } else {
+ _bgX = 0;
+ _bgY = 0;
+ }
+
+ g_fp->_sceneRect.top = 0;
+ g_fp->_sceneRect.left = 0;
+ g_fp->_sceneRect.right = 800;
+ g_fp->_sceneRect.bottom = 600;
+
+ MenuArea *area;
+
+ area = new MenuArea();
+ area->picIdL = PIC_MNU_EXIT_L;
+ area->picObjD = 0;
+ area->picObjL = _scene->getPictureObjectById(area->picIdL, 0);
+ area->picObjL->_flags &= 0xFFFB;
+ _areas.push_back(area);
+
+ area = new MenuArea();
+ area->picIdL = PIC_MNU_CONTINUE_L;
+ area->picObjD = 0;
+ area->picObjL = _scene->getPictureObjectById(area->picIdL, 0);
+ area->picObjL->_flags &= 0xFFFB;
+ _areas.push_back(area);
+
+ if (isSaveAllowed()) {
+ area = new MenuArea();
+ area->picIdL = PIC_MNU_SAVE_L;
+ area->picObjD = 0;
+ area->picObjL = _scene->getPictureObjectById(area->picIdL, 0);
+ area->picObjL->_flags &= 0xFFFB;
+ _areas.push_back(area);
+ }
+
+ area = new MenuArea();
+ area->picIdL = PIC_MNU_LOAD_L;
+ area->picObjD = 0;
+ area->picObjL = _scene->getPictureObjectById(area->picIdL, 0);
+ area->picObjL->_flags &= 0xFFFB;
+ _areas.push_back(area);
+
+ area = new MenuArea();
+ area->picIdL = PIC_MNU_RESTART_L;
+ area->picObjD = 0;
+ area->picObjL = _scene->getPictureObjectById(area->picIdL, 0);
+ area->picObjL->_flags &= 0xFFFB;
+ _areas.push_back(area);
+
+ area = new MenuArea();
+ area->picIdL = PIC_MNU_AUTHORS_L;
+ area->picObjD = 0;
+ area->picObjL = _scene->getPictureObjectById(area->picIdL, 0);
+ area->picObjL->_flags &= 0xFFFB;
+ _areas.push_back(area);
+
+ area = new MenuArea();
+ area->picIdL = PIC_MNU_SLIDER_L;
+ area->picObjD = _scene->getPictureObjectById(PIC_MNU_SLIDER_D, 0);
+ area->picObjD->_flags |= 4;
+ area->picObjL = _scene->getPictureObjectById(area->picIdL, 0);
+ area->picObjL->_flags &= 0xFFFB;
+ _areas.push_back(area);
+ _menuSliderIdx = _areas.size() - 1;
+
+ area = new MenuArea();
+ area->picIdL = PIC_MNU_MUSICSLIDER_L;
+ area->picObjD = _scene->getPictureObjectById(PIC_MNU_MUSICSLIDER_D, 0);
+ area->picObjD->_flags |= 4;
+ area->picObjL = _scene->getPictureObjectById(area->picIdL, 0);
+ area->picObjL->_flags &= 0xFFFB;
+ _areas.push_back(area);
+ _musicSliderIdx = _areas.size() - 1;
+
+ if (g_fp->_mainMenu_debugEnabled)
+ enableDebugMenuButton();
+
+ setSliderPos();
+}
- _field_34 = 0;
+void ModalMainMenu::update() {
+ _scene->draw();
+}
+
+bool ModalMainMenu::handleMessage(ExCommand *message) {
+ if (message->_messageKind != 17)
+ return false;
+
+ Common::Point point;
+
+ if (message->_messageNum == 29) {
+ point.x = message->_x;
+ point.y = message->_y;
+
+ int numarea = checkHover(point);
+
+ if (numarea >= 0) {
+ if (numarea == _menuSliderIdx) {
+ _lastArea = _areas[_menuSliderIdx];
+ _sliderOffset = _lastArea->picObjL->_ox - point.x;
+
+ return false;
+ }
+
+ if (numarea == _musicSliderIdx) {
+ _lastArea = _areas[_musicSliderIdx];
+ _sliderOffset = _lastArea->picObjL->_ox - point.x;
+
+ return false;
+ }
+
+ _hoverAreaId = _areas[numarea]->picIdL;
+ }
+
+ return false;
+ }
+
+ if (message->_messageNum == 30) {
+ if (_lastArea)
+ _lastArea = 0;
+
+ return false;
+ }
+
+ if (message->_messageNum != 36)
+ return false;
+
+ if (message->_keyCode == 27)
+ _hoverAreaId = PIC_MNU_CONTINUE_L;
+ else
+ enableDebugMenu(message->_keyCode);
+
+ return false;
+}
+
+bool ModalMainMenu::init(int counterdiff) {
+ switch (_hoverAreaId) {
+ case PIC_MNU_RESTART_L:
+ g_fp->restartGame();
+
+ if (this == g_fp->_modalObject)
+ return false;
+
+ delete this;
+ break;
+
+ case PIC_MNU_EXIT_L:
+ {
+ ModalQuery *mq = new ModalQuery();
+
+ g_fp->_modalObject = mq;
+
+ mq->_parentObj = this;
+ mq->create(_scene, (PictureObject *)_scene->_picObjList[0], PIC_MEX_BGR);
+
+ _hoverAreaId = 0;
+
+ return true;
+ }
+
+ case PIC_MNU_DEBUG_L:
+ g_fp->_gameLoader->unloadScene(SC_MAINMENU);
+ g_fp->_sceneRect = _screct;
+
+ if (!g_fp->_currentScene)
+ error("ModalMainMenu::init: Bad state");
+
+ g_fp->_currentScene->_x = _bgX;
+ g_fp->_currentScene->_y = _bgY;
+
+ g_fp->_gameLoader->preloadScene(g_fp->_currentScene->_sceneId, SC_DBGMENU);
+
+ return false;
+
+ case PIC_MNU_CONTINUE_L:
+ if (!_mfield_34) {
+ g_fp->_gameLoader->unloadScene(SC_MAINMENU);
+ g_fp->_sceneRect = _screct;
+
+ if (g_fp->_currentScene) {
+ g_fp->_currentScene->_x = _bgX;
+ g_fp->_currentScene->_y = _bgY;
+ }
+
+ return false;
+ }
+
+ g_fp->restartGame();
+
+ if (this == g_fp->_modalObject)
+ return false;
+
+ delete this;
+ break;
+
+ case PIC_MNU_AUTHORS_L:
+ g_fp->_modalObject = new ModalCredits();
+ g_fp->_modalObject->_parentObj = this;
+
+ _hoverAreaId = 0;
+
+ return true;
+
+ case PIC_MNU_SAVE_L:
+ case PIC_MNU_LOAD_L:
+ {
+ ModalSaveGame *sg = new ModalSaveGame();
+
+ g_fp->_modalObject = sg;
+ g_fp->_modalObject->_parentObj = _parentObj;
+
+ int mode = 0;
+ if (_hoverAreaId == PIC_MNU_SAVE_L)
+ mode = 1;
+
+ sg->setup(g_fp->accessScene(SC_MAINMENU), mode);
+ sg->setScene(g_fp->accessScene(SC_MAINMENU));
+
+ sg->_rect = _screct;
+ sg->_oldBgX = _bgX;
+ sg->_oldBgY = _bgY;
+
+ delete this;
+ }
+
+ break;
+
+ default:
+ if (_lastArea) {
+ updateSliderPos();
+ } else {
+ g_fp->_cursorId = PIC_CSR_DEFAULT;
+
+ int idx = checkHover(g_fp->_mouseScreenPos);
+
+ if (idx < 0)
+ goto LABEL_40;
+
+ g_fp->_cursorId = PIC_CSR_DEFAULT;
+
+ if (idx != this->_menuSliderIdx && idx != this->_musicSliderIdx )
+ goto LABEL_40;
+ }
+
+ g_fp->_cursorId = PIC_CSR_LIFT;
+
+ LABEL_40:
+ g_fp->setCursor(g_fp->_cursorId);
+
+ updateVolume();
+
+ return true;
+ }
+
+ return true;
+}
+
+void ModalMainMenu::updateVolume() {
+ if (g_fp->_soundEnabled ) {
+ for (int s = 0; s < g_fp->_currSoundListCount; s++)
+ for (int i = 0; i < g_fp->_currSoundList1[s]->getCount(); i++) {
+ updateSoundVolume(g_fp->_currSoundList1[s]->getSoundByIndex(i));
+ }
+ }
+}
+
+void ModalMainMenu::updateSoundVolume(Sound *snd) {
+ if (!snd->_objectId)
+ return;
+
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(snd->_objectId, -1);
+ if (!ani)
+ return;
+
+ int a, b;
+
+ if (ani->_ox >= _screct.left) {
+ int par, pan;
+
+ if (ani->_ox <= _screct.right) {
+ int dx;
+
+ if (ani->_oy <= _screct.bottom) {
+ if (ani->_oy >= _screct.top) {
+ snd->setPanAndVolume(g_fp->_sfxVolume, 0);
+
+ return;
+ }
+ dx = _screct.top - ani->_oy;
+ } else {
+ dx = ani->_oy - _screct.bottom;
+ }
+
+ par = 0;
+
+ if (dx > 800) {
+ snd->setPanAndVolume(-3500, 0);
+ return;
+ }
+
+ pan = -3500;
+ a = g_fp->_sfxVolume - (-3500);
+ b = 800 - dx;
+ } else {
+ int dx = ani->_ox - _screct.right;
+
+ if (dx > 800) {
+ snd->setPanAndVolume(-3500, 0);
+ return;
+ }
+
+ pan = -3500;
+ par = dx * (-3500) / -800;
+ a = g_fp->_sfxVolume - (-3500);
+ b = 800 - dx;
+ }
+
+ int32 pp = b * a; //(0x51EB851F * b * a) >> 32) >> 8; // TODO FIXME
+
+ snd->setPanAndVolume(pan + (pp >> 31) + pp, par);
+
+ return;
+ }
+
+ int dx = _screct.left - ani->_ox;
+ if (dx <= 800) {
+ int32 s = 0x51EB851F * (800 - dx) * (g_fp->_sfxVolume - (-3500)); // TODO FIXME
+ int32 p = -3500 + (s >> 31) + (s >> 8);
+
+ if (p > g_fp->_sfxVolume)
+ p = g_fp->_sfxVolume;
+
+ snd->setPanAndVolume(p, dx * (-3500) / 800);
+ } else {
+ snd->setPanAndVolume(-3500, 0);
+ }
+
+ warning("STUB: ModalMainMenu::updateSoundVolume()");
+}
+
+void ModalMainMenu::updateSliderPos() {
+ if (_lastArea->picIdL == PIC_MNU_SLIDER_L) {
+ int x = g_fp->_mouseScreenPos.x + _sliderOffset;
+
+ if (x >= 65) {
+ if (x > 238)
+ x = 238;
+ } else {
+ x = 65;
+ }
+
+ _lastArea->picObjD->setOXY(x, _lastArea->picObjD->_oy);
+ _lastArea->picObjL->setOXY(x, _lastArea->picObjD->_oy);
+
+ int vol = 1000 * (3 * x - 195);
+ g_fp->_sfxVolume = vol / 173 - 3000;
+
+ if (!(vol / 173))
+ g_fp->_sfxVolume = -10000;
+
+ g_fp->updateSoundVolume();
+ } else if (_lastArea->picIdL == PIC_MNU_MUSICSLIDER_L) {
+ int x = g_fp->_mouseScreenPos.x + _sliderOffset;
+
+ if (x >= 65) {
+ if (x > 238)
+ x = 238;
+ } else {
+ x = 65;
+ }
+
+ _lastArea->picObjD->setOXY(x, _lastArea->picObjD->_oy);
+ _lastArea->picObjL->setOXY(x, _lastArea->picObjD->_oy);
+
+ g_fp->setMusicVolume(255 * (x - 65) / 173);
+ }
+}
+
+int ModalMainMenu::checkHover(Common::Point &point) {
+ for (uint i = 0; i < _areas.size(); i++) {
+ if (_areas[i]->picObjL->isPixelHitAtPos(point.x, point.y)) {
+ _areas[i]->picObjL->_flags |= 4;
+
+ return i;
+ } else {
+ _areas[i]->picObjL->_flags &= 0xFFFB;
+ }
+ }
+
+ if (isOverArea(_areas[_menuSliderIdx]->picObjL, &point)) {
+ _areas[_menuSliderIdx]->picObjL->_flags |= 4;
+
+ return _menuSliderIdx;
+ }
+
+ if (isOverArea(_areas[_musicSliderIdx]->picObjL, &point)) {
+ _areas[_musicSliderIdx]->picObjL->_flags |= 4;
+
+ return _musicSliderIdx;
+ }
+
+ return -1;
+}
+
+bool ModalMainMenu::isOverArea(PictureObject *obj, Common::Point *point) {
+ Common::Point p;
+
+ obj->getDimensions(&p);
+
+ int left = point->x - 8;
+ int right = point->x + 12;
+ int down = point->y - 11;
+ int up = point->y + 9;
+
+ if (left >= obj->_ox && right < obj->_ox + p.x && down >= obj->_oy && up < obj->_oy + p.y)
+ return true;
+
+ return false;
+}
+
+bool ModalMainMenu::isSaveAllowed() {
+ if (!g_fp->_isSaveAllowed)
+ return false;
+
+ if (g_fp->_aniMan->_flags & 0x100)
+ return false;
+
+ for (Common::Array<MessageQueue *>::iterator s = g_fp->_globalMessageQueueList->begin(); s != g_fp->_globalMessageQueueList->end(); ++s) {
+ if (!(*s)->_isFinished && ((*s)->getFlags() & 1))
+ return false;
+ }
+
+ return true;
+}
+
+void ModalMainMenu::enableDebugMenu(char c) {
+ const char deb[] = "DEBUGER";
+
+ if (c == deb[_debugKeyCount]) {
+ _debugKeyCount++;
+
+ if (deb[_debugKeyCount] )
+ return;
+
+ enableDebugMenuButton();
+ }
+
+ _debugKeyCount = 0;
+}
+
+void ModalMainMenu::enableDebugMenuButton() {
+ MenuArea *area;
+
+ for (uint i = 0; i < _areas.size(); i++)
+ if (_areas[i]->picIdL == PIC_MNU_DEBUG_L)
+ return;
+
+ area = new MenuArea();
+ area->picIdL = PIC_MNU_DEBUG_L;
+ area->picObjD = 0;
+ area->picObjL = _scene->getPictureObjectById(area->picIdL, 0);
+ area->picObjL->_flags &= 0xFFFB;
+ _areas.push_back(area);
+}
+
+void ModalMainMenu::setSliderPos() {
+ int x = 173 * (g_fp->_sfxVolume + 3000) / 3000 + 65;
+ PictureObject *obj = _areas[_menuSliderIdx]->picObjD;
+
+ if (x >= 65) {
+ if (x > 238)
+ x = 238;
+ } else {
+ x = 65;
+ }
+
+ obj->setOXY(x, obj->_oy);
+ _areas[_menuSliderIdx]->picObjL->setOXY(x, obj->_oy);
+
+ x = 173 * g_fp->_musicVolume / 255 + 65;
+ obj = _areas[_musicSliderIdx]->picObjD;
+
+ if (x >= 65) {
+ if (x > 238)
+ x = 238;
+ } else {
+ x = 65;
+ }
+
+ obj->setOXY(x, obj->_oy);
+ _areas[_musicSliderIdx]->picObjL->setOXY(x, obj->_oy);
}
ModalHelp::ModalHelp() {
@@ -816,6 +1321,222 @@ void ModalHelp::launch() {
}
}
+ModalQuery::ModalQuery() {
+ _picObjList = 0;
+ _bg = 0;
+ _okBtn = 0;
+ _cancelBtn = 0;
+ _queryResult = -1;
+}
+
+ModalQuery::~ModalQuery() {
+ _bg->_flags &= 0xFFFB;
+ _cancelBtn->_flags &= 0xFFFB;
+ _okBtn->_flags &= 0xFFFB;
+}
+
+bool ModalQuery::create(Scene *sc, PictureObject *picObjList, int id) {
+ if (id == PIC_MEX_BGR) {
+ _bg = sc->getPictureObjectById(PIC_MEX_BGR, 0);
+
+ if (!_bg)
+ return false;
+
+ _okBtn = sc->getPictureObjectById(PIC_MEX_OK, 0);
+
+ if (!_okBtn)
+ return false;
+
+ _cancelBtn = sc->getPictureObjectById(PIC_MEX_CANCEL, 0);
+
+ if (!_cancelBtn)
+ return 0;
+ } else {
+ if (id != PIC_MOV_BGR)
+ return false;
+
+ _bg = sc->getPictureObjectById(PIC_MOV_BGR, 0);
+
+ if (!_bg)
+ return false;
+
+ _okBtn = sc->getPictureObjectById(PIC_MOV_OK, 0);
+
+ if (!_okBtn)
+ return false;
+
+ _cancelBtn = sc->getPictureObjectById(PIC_MOV_CANCEL, 0);
+
+ if (!_cancelBtn)
+ return false;
+ }
+
+ _queryResult = -1;
+ _picObjList = picObjList;
+
+ return true;
+}
+
+void ModalQuery::update() {
+ if (_picObjList)
+ _picObjList->draw();
+
+ _bg->draw();
+
+ if (_okBtn->_flags & 4)
+ _okBtn->draw();
+
+ if (_cancelBtn->_flags & 4)
+ _cancelBtn->draw();
+}
+
+bool ModalQuery::handleMessage(ExCommand *cmd) {
+ if (cmd->_messageKind == 17) {
+ if (cmd->_messageNum == 29) {
+ if (_okBtn->isPointInside(g_fp->_mouseScreenPos.x, g_fp->_mouseScreenPos.y)) {
+ _queryResult = 1;
+
+ return false;
+ }
+
+ if (_cancelBtn->isPointInside(g_fp->_mouseScreenPos.x, g_fp->_mouseScreenPos.y))
+ _queryResult = 0;
+ } else if (cmd->_messageNum == 36 && cmd->_keyCode == 27) {
+ _queryResult = 0;
+
+ return false;
+ }
+ }
+
+ return false;
+}
+
+bool ModalQuery::init(int counterdiff) {
+ if (_okBtn->isPointInside(g_fp->_mouseScreenPos.x, g_fp->_mouseScreenPos.y))
+ _okBtn->_flags |= 4;
+ else
+ _okBtn->_flags &= 0xFFFB;
+
+ if (_cancelBtn->isPointInside(g_fp->_mouseScreenPos.x, g_fp->_mouseScreenPos.y))
+ _cancelBtn->_flags |= 4;
+ else
+ _cancelBtn->_flags &= 0xFFFB;
+
+ if (_queryResult == -1) {
+ return true;
+ } else {
+ if (_bg->_id == PIC_MEX_BGR) {
+ _cancelBtn->_flags &= 0xFFFB;
+ _okBtn->_flags &= 0xFFFB;
+
+ if (_queryResult == 1) {
+ warning("STUB: ModalQuery::init()");
+ //sceneFade(g_vrtDrawHandle, (Scene *)this->_picObjList, 0);
+
+ //if (inputArFlag) {
+ // g_needRestart = 1;
+ // return 0;
+ //}
+ //SendMessageA(hwndCallback, WM_DESTROY, 0, 0);
+ }
+ }
+ }
+
+ return false;
+}
+
+ModalSaveGame::ModalSaveGame() {
+ _oldBgX = 0;
+ _oldBgY = 0;
+
+ _bgr = 0;
+ _okD = 0;
+ _okL = 0;
+ _cancelD = 0;
+ _cancelL = 0;
+ _emptyD = 0;
+ _emptyL = 0;
+ _queryRes = -1;
+ _rect = g_fp->_sceneRect;
+ _queryDlg = 0;
+ _mode = 1;
+}
+
+ModalSaveGame::~ModalSaveGame() {
+ g_fp->_sceneRect = _rect;
+
+ _arrayD.clear();
+ _arrayL.clear();
+
+ for (uint i = 0; i < _filenames.size(); i++)
+ free(_filenames[i]);
+
+ _filenames.clear();
+}
+
+void ModalSaveGame::setScene(Scene *sc) {
+ _queryRes = -1;
+ _menuScene = sc;
+}
+
+void ModalSaveGame::processKey(int key) {
+ if (key == 27)
+ _queryRes = 0;
+}
+
+bool ModalSaveGame::init(int counterdiff) {
+ if (_queryDlg) {
+ if (!_queryDlg->init(counterdiff)) {
+ if (!_queryDlg->getQueryResult())
+ _queryRes = -1;
+
+ delete _queryDlg;
+ _queryDlg = 0;
+ }
+
+ return true;
+ }
+
+ if (_queryRes == -1)
+ return true;
+
+ g_fp->_sceneRect = _rect;
+
+ if (g_fp->_currentScene) {
+ g_fp->_currentScene->_x = _oldBgX;
+ g_fp->_currentScene->_y = _oldBgY;
+ }
+
+ if (!_queryRes) {
+ ModalMainMenu *m = new ModalMainMenu;
+
+ g_fp->_modalObject = m;
+
+ m->_parentObj = _parentObj;
+ m->_screct = _rect;
+ m->_bgX = _oldBgX;
+ m->_bgY = _oldBgY;
+
+ delete this;
+
+ return true;
+ }
+
+ return false;
+}
+
+void ModalSaveGame::setup(Scene *sc, int mode) {
+ warning("STUB: ModalSaveGame::setup()");
+}
+
+char *ModalSaveGame::getSaveName() {
+ if (_queryRes < 0)
+ return 0;
+
+ return _filenames[_queryRes];
+}
+
+
void FullpipeEngine::openHelp() {
if (!_modalObject) {
ModalHelp *help = new ModalHelp;
diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h
index 7ed433b125..e2962ab595 100644
--- a/engines/fullpipe/modal.h
+++ b/engines/fullpipe/modal.h
@@ -27,6 +27,7 @@ namespace Fullpipe {
class PictureObject;
class Picture;
+class Sound;
class BaseModalObject {
public:
@@ -147,19 +148,47 @@ class ModalCredits : public BaseModalObject {
virtual void saveload() {}
};
+struct MenuArea {
+ int picIdL;
+ PictureObject *picObjD;
+ PictureObject *picObjL;
+};
+
class ModalMainMenu : public BaseModalObject {
public:
- int _field_34;
+ Scene *_scene;
+ int _hoverAreaId;
+ Common::Array<MenuArea *> _areas;
+ int _menuSliderIdx;
+ int _musicSliderIdx;
+ MenuArea *_lastArea;
+ int _sliderOffset;
+ int _mfield_34;
+ Common::Rect _screct;
+ int _bgX;
+ int _bgY;
+ int _debugKeyCount;
public:
ModalMainMenu();
virtual ~ModalMainMenu() {}
virtual bool pollEvent() { return true; }
- virtual bool handleMessage(ExCommand *message) { return false; }
- virtual bool init(int counterdiff) { return true; }
- virtual void update() {}
+ virtual bool handleMessage(ExCommand *message);
+ virtual bool init(int counterdiff);
+ virtual void update();
virtual void saveload() {}
+
+private:
+ bool isSaveAllowed();
+ void enableDebugMenuButton();
+ void setSliderPos();
+ void enableDebugMenu(char c);
+ int checkHover(Common::Point &point);
+ void updateVolume();
+ void updateSoundVolume(Sound *snd);
+ void updateSliderPos();
+ bool isOverArea(PictureObject *obj, Common::Point *point);
};
class ModalHelp : public BaseModalObject {
@@ -187,25 +216,63 @@ public:
class ModalQuery : public BaseModalObject {
public:
ModalQuery();
- virtual ~ModalQuery() {}
+ virtual ~ModalQuery();
virtual bool pollEvent() { return true; }
- virtual bool handleMessage(ExCommand *message) { return false; }
- virtual bool init(int counterdiff) { return true; }
- virtual void update() {}
+ virtual bool handleMessage(ExCommand *message);
+ virtual bool init(int counterdiff);
+ virtual void update();
virtual void saveload() {}
+
+ bool create(Scene *sc, PictureObject *picObjList, int picId);
+ int getQueryResult() { return _queryResult; }
+
+
+private:
+ PictureObject *_picObjList;
+ PictureObject *_bg;
+ PictureObject *_okBtn;
+ PictureObject *_cancelBtn;
+ int _queryResult;
+
};
class ModalSaveGame : public BaseModalObject {
public:
ModalSaveGame();
- virtual ~ModalSaveGame() {}
+ virtual ~ModalSaveGame();
virtual bool pollEvent() { return true; }
virtual bool handleMessage(ExCommand *message) { return false; }
- virtual bool init(int counterdiff) { return true; }
+ virtual bool init(int counterdiff);
virtual void update() {}
virtual void saveload() {}
+
+ void setScene(Scene *sc);
+ void setup(Scene *sc, int mode);
+ void processKey(int key);
+
+ char *getSaveName();
+
+ Common::Rect _rect;
+ int _oldBgX;
+ int _oldBgY;
+ PictureObject *_bgr;
+ PictureObject *_okD;
+ PictureObject *_okL;
+ PictureObject *_cancelD;
+ PictureObject *_cancelL;
+ PictureObject *_emptyD;
+ PictureObject *_emptyL;
+ PictureObject *_fullD;
+ PictureObject *_fullL;
+ Scene *_menuScene;
+ int _mode;
+ ModalQuery *_queryDlg;
+ Common::Array <char *> _filenames;
+ Common::Array <PictureObject *> _arrayL;
+ Common::Array <PictureObject *> _arrayD;
+ int _queryRes;
};
diff --git a/engines/fullpipe/module.mk b/engines/fullpipe/module.mk
index db97fa202b..3962fe64ba 100644
--- a/engines/fullpipe/module.mk
+++ b/engines/fullpipe/module.mk
@@ -52,6 +52,7 @@ MODULE_OBJS = \
scenes/scene26.o \
scenes/scene27.o \
scenes/scene28.o \
+ scenes/scene29.o \
scenes/scene30.o \
scenes/scene31.o \
scenes/scene32.o \
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 0881a19692..35da154570 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -159,10 +159,72 @@ void MctlCompound::freeItems() {
_motionControllers[i]->_motionControllerObj->freeItems();
}
-MessageQueue *MctlCompound::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
- warning("STUB: MctlCompound::method34()");
+MessageQueue *MctlCompound::method34(StaticANIObject *ani, int sourceX, int sourceY, int fuzzyMatch, int staticsId) {
+ int idx = -1;
+ int sourceIdx = -1;
- return 0;
+ if (!ani)
+ return 0;
+
+ for (uint i = 0; i < _motionControllers.size(); i++) {
+ if (_motionControllers[i]->_movGraphReactObj) {
+ if (_motionControllers[i]->_movGraphReactObj->pointInRegion(ani->_ox, ani->_oy)) {
+ idx = i;
+ break;
+ }
+ }
+ }
+
+ for (uint i = 0; i < _motionControllers.size(); i++) {
+ if (_motionControllers[i]->_movGraphReactObj) {
+ if (_motionControllers[i]->_movGraphReactObj->pointInRegion(sourceX, sourceY)) {
+ sourceIdx = i;
+ break;
+ }
+ }
+ }
+
+ if (idx == -1)
+ return 0;
+
+ if (sourceIdx == -1)
+ return 0;
+
+ if (idx == sourceIdx)
+ return _motionControllers[idx]->_motionControllerObj->method34(ani, sourceX, sourceY, fuzzyMatch, staticsId);
+
+ MctlConnectionPoint *cp = findClosestConnectionPoint(ani->_ox, ani->_oy, idx, sourceX, sourceY, sourceIdx, &sourceIdx);
+
+ if (!cp)
+ return 0;
+
+ MessageQueue *mq = _motionControllers[idx]->_motionControllerObj->doWalkTo(ani, cp->_connectionX, cp->_connectionY, 1, cp->_field_14);
+
+ if (!mq)
+ return 0;
+
+ for (uint i = 0; i < cp->_messageQueueObj->getCount(); i++) {
+ ExCommand *ex = new ExCommand(cp->_messageQueueObj->getExCommandByIndex(i));
+
+ ex->_excFlags |= 2;
+
+ mq->addExCommandToEnd(ex);
+ }
+
+ ExCommand *ex = new ExCommand(ani->_id, 51, 0, sourceX, sourceY, 0, 1, 0, 0, 0);
+
+ ex->_excFlags |= 2;
+ ex->_field_20 = fuzzyMatch;
+ ex->_keyCode = ani->_okeyCode;
+
+ mq->addExCommandToEnd(ex);
+
+ if (!mq->chain(ani)) {
+ delete mq;
+ return 0;
+ }
+
+ return mq;
}
MessageQueue *MctlCompound::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
@@ -598,6 +660,14 @@ void MovGraph::calcNodeDistancesAndAngles() {
}
}
+int MovGraph::getItemIndexByStaticAni(StaticANIObject *ani) {
+ for (uint i = 0; i < _items.size(); i++)
+ if (_items[i]->ani == ani)
+ return i;
+
+ return -1;
+}
+
int MovGraph2::getItemIndexByGameObjectId(int objectId) {
for (uint i = 0; i < _items2.size(); i++)
if (_items2[i]->_objectId == objectId)
@@ -1754,6 +1824,89 @@ void MGM::clear() {
_items.clear();
}
+MessageQueue *MGM::genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr) {
+ int idx = getItemIndexById(ani->_id);
+
+ if (idx == -1)
+ return 0;
+
+ int stid = staticsId;
+
+ if (!staticsId) {
+ if (ani->_movement) {
+ stid = ani->_movement->_staticsObj2->_staticsId;
+ } else {
+ if (!ani->_statics)
+ return 0;
+
+ stid = ani->_statics->_staticsId;
+ }
+ }
+
+ if (stid == staticsIndex)
+ return new MessageQueue(g_fp->_globalMessageQueueList->compact());
+
+ int startidx = getStaticsIndexById(idx, stid);
+ int endidx = getStaticsIndexById(idx, staticsIndex);
+ int subidx = startidx + endidx * _items[idx]->statics.size();
+
+ if (!_items[idx]->subItems[subidx]->movement) {
+ clearMovements2(idx);
+ recalcOffsets(idx, startidx, endidx, 0, 1);
+ }
+
+ if (!_items[idx]->subItems[subidx]->movement)
+ return 0;
+
+ MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
+ Common::Point point;
+ ExCommand *ex;
+
+ int i = 0;
+ do {
+ subidx = startidx + endidx * _items[idx]->statics.size();
+
+ _items[idx]->subItems[subidx]->movement->calcSomeXY(point, 0);
+
+ if (pointArr) {
+ int sz;
+
+ if (_items[idx]->subItems[subidx]->movement->_currMovement)
+ sz = _items[idx]->subItems[subidx]->movement->_currMovement->_dynamicPhases.size();
+ else
+ sz = _items[idx]->subItems[subidx]->movement->_dynamicPhases.size();
+
+ ex = new ExCommand2(20, ani->_id, &pointArr[i], sz);
+
+ ex->_messageNum = _items[idx]->subItems[subidx]->movement->_id;
+ } else {
+ ex = new ExCommand(ani->_id, 1, _items[idx]->subItems[subidx]->movement->_id, 0, 0, 0, 1, 0, 0, 0);
+ }
+
+ ex->_keyCode = ani->_okeyCode;
+ ex->_field_3C = 1;
+ ex->_field_24 = 1;
+
+ mq->addExCommandToEnd(ex);
+
+ if (resStatId)
+ *resStatId = _items[idx]->subItems[subidx]->movement->_id;
+
+ startidx = _items[idx]->subItems[subidx]->staticsIndex;
+
+ uint step;
+
+ if (_items[idx]->subItems[subidx]->movement->_currMovement)
+ step = _items[idx]->subItems[subidx]->movement->_currMovement->_dynamicPhases.size();
+ else
+ step = _items[idx]->subItems[subidx]->movement->_dynamicPhases.size();
+
+ i += step;
+ } while (startidx != endidx);
+
+ return mq;
+}
+
MGMItem::MGMItem() {
objId = 0;
}
@@ -1811,15 +1964,10 @@ int MGM::getItemIndexById(int objId) {
}
MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
- warning("STUB: MGM::genMovement()");
-
- return 0;
-
-#if 0
if (!mgminfo->ani)
return 0;
- mov = mgminfo->ani->_movement;
+ Movement *mov = mgminfo->ani->_movement;
if (!mov && !mgminfo->ani->_statics)
return 0;
@@ -1831,14 +1979,17 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
mgminfo->staticsId1 = mgminfo->ani->_statics->_staticsId;
}
+ Common::Point point;
+
if (!(mgminfo->flags & 0x10) || !(mgminfo->flags & 0x20)) {
int nx = mgminfo->ani->_ox;
int ny = mgminfo->ani->_oy;
if (mgminfo->ani->_movement) {
- mgminfo->ani->calcNextStep(&point2);
- nx += point2.x;
- ny += point2.y;
+ mgminfo->ani->calcNextStep(&point);
+
+ nx += point.x;
+ ny += point.y;
}
if (!(mgminfo->flags & 0x10))
@@ -1853,40 +2004,37 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
if (!mov)
return 0;
- itemIdx = getItemIndexById(mgminfo->ani->_id);
- subIdx = getStaticsIndexById(itemIdx, mgminfo->staticsId1);
- st2idx = getStaticsIndexById(itemIdx, mov->_staticsObj1->_staticsId);
- st1idx = getStaticsIndexById(itemIdx, mov->_staticsObj2->_staticsId);
- subOffset = getStaticsIndexById(itemIdx, mgminfo->staticsId2);
+ int itemIdx = getItemIndexById(mgminfo->ani->_id);
+ int subIdx = getStaticsIndexById(itemIdx, mgminfo->staticsId1);
+ int st2idx = getStaticsIndexById(itemIdx, mov->_staticsObj1->_staticsId);
+ int st1idx = getStaticsIndexById(itemIdx, mov->_staticsObj2->_staticsId);
+ int subOffset = getStaticsIndexById(itemIdx, mgminfo->staticsId2);
clearMovements2(itemIdx);
recalcOffsets(itemIdx, subIdx, st2idx, 0, 1);
clearMovements2(itemIdx);
recalcOffsets(itemIdx, st1idx, subOffset, 0, 1);
- v71 = (Message *)(28 * itemIdx);
- v16 = items[itemIdx].objId;
- v17 = *(_DWORD *)(v16 + offsetof(MGMItem, staticsListCount));
- off = *(_DWORD *)(v16 + offsetof(MGMItem, subItems));
- v18 = (MGMSubItem *)(off + 24 * (subIdx + st2idx * v17));
- x1 = (int)&v18->movement->go.CObject.vmt;
- v19 = (MGMSubItem *)(off + 24 * (st1idx + subOffset * v17));
- v69 = (LONG)&v19->movement->go.CObject.vmt;
+ MGMSubItem *sub1 = _items[itemIdx]->subItems[subIdx + st2idx * _items[itemIdx]->statics.size()];
+ MGMSubItem *sub2 = _items[itemIdx]->subItems[st1idx + subOffset * _items[itemIdx]->statics.size()];
- if (subIdx != st2idx && !x1)
+ if (subIdx != st2idx && !sub1->movement)
return 0;
- if (st1idx != subOffset && !v69)
+ if (st1idx != subOffset && !sub2->movement)
return 0;
- int n1x = mgminfo->x1 - mgminfo->x2 - v18->x - v19->x;
- int n1y = mgminfo->y1 - mgminfo->y2 - v18->y - v19->y;
+ int n1x = mgminfo->x1 - mgminfo->x2 - sub1->x - sub2->x;
+ int n1y = mgminfo->y1 - mgminfo->y2 - sub1->y - sub2->y;
- mov->calcSomeXY(&point1, 0);
+ Common::Point point1;
+
+ mov->calcSomeXY(point1, 0);
int n2x = point1.x;
int n2y = point1.y;
int mult;
+ int len;
if (mgminfo->flags & 0x40) {
mult = mgminfo->field_10;
@@ -1903,20 +2051,20 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
len = -1;
n2x = mult * point1.x;
n1x = mult * point1.x;
- mgminfo->x1 = mgminfo->x2 + mult * point1.x + v18->x + v19->x;
+ mgminfo->x1 = mgminfo->x2 + mult * point1.x + sub1->x + sub2->x;
}
if (!(mgminfo->flags & 4)) {
n2y = mult * point1.y;
n1y = mult * point1.y;
len = -1;
- mgminfo->y1 = mgminfo->y2 + mult * point1.y + v18->y + v19->y;
+ mgminfo->y1 = mgminfo->y2 + mult * point1.y + sub1->y + sub2->y;
}
int px = 0;
int py = 0;
- if (x1) {
+ if (sub1->movement) {
px = countPhases(itemIdx, subIdx, st2idx, 1);
py = countPhases(itemIdx, subIdx, st2idx, 2);
}
@@ -1931,13 +2079,14 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
py += mov->countPhasesWithFlag(len, 2);
}
- if (v69) {
+ if (sub2->movement) {
px += countPhases(itemIdx, st1idx, subOffset, 1);
py += countPhases(itemIdx, st1idx, subOffset, 2);
}
int dx1 = n1x - n2x;
int dy1 = n1y - n2y;
+ int x1, y1;
if (px) {
x1 = (int)((double)dx1 / (double)px);
@@ -1951,6 +2100,8 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
y1 = 0;
}
+ Common::Point x2, y2;
+
y2.x = dx1 - px * x1;
y2.y = dy1 - py * y1;
@@ -1967,16 +2118,19 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact());
ExCommand2 *ex2;
- for (v42 = subIdx; v42 != st2idx; v42 = v43->staticsIndex) {
- v43 = &(*(MGMSubItem **)((char *)&this->items->subItems + (unsigned int)v71))[v42 + st2idx * *(int *)((char *)&this->items->staticsListCount + (unsigned int)v71)];
- ex2 = buildExCommand2(v43->movement, mgminfo->ani->go._id, x1, y1, &x2, &y2, -1);
+ for (int i = subIdx; i != st2idx;) {
+ MGMSubItem *s = _items[itemIdx]->subItems[i + subOffset * _items[itemIdx]->statics.size()];
+
+ ex2 = buildExCommand2(s->movement, mgminfo->ani->_id, x1, y1, &x2, &y2, -1);
ex2->_parId = mq->_id;
ex2->_keyCode = mgminfo->ani->_okeyCode;
mq->addExCommandToEnd(ex2);
+
+ i = s->staticsIndex;
}
- for (i = 0; i < mult; ++i) {
+ for (int i = 0; i < mult; ++i) {
int plen;
if (i == mult - 1)
@@ -1991,14 +2145,16 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
mq->addExCommandToEnd(ex2);
}
- for (j = st1idx; j != subOffset; j = v50->staticsIndex) {
- v50 = &(*(MGMSubItem **)((char *)&this->items->subItems + (unsigned int)v71))[j + subOffset * *(int *)((char *)&this->items->staticsListCount + (unsigned int)v71)];
+ for (int j = st1idx; j != subOffset;) {
+ MGMSubItem *s = _items[itemIdx]->subItems[j + subOffset * _items[itemIdx]->statics.size()];
- ex2 = buildExCommand2(v50->movement, mgminfo->ani->_id, x1, y1, &x2, &y2, -1);
+ ex2 = buildExCommand2(s->movement, mgminfo->ani->_id, x1, y1, &x2, &y2, -1);
ex2->_parId = mq->_id;
ex2->_keyCode = mgminfo->ani->_okeyCode;
mq->addExCommandToEnd(ex2);
+
+ j = s->staticsIndex;
}
ExCommand *ex = new ExCommand(mgminfo->ani->_id, 5, -1, mgminfo->x1, mgminfo->y1, 0, 1, 0, 0, 0);
@@ -2011,9 +2167,25 @@ MessageQueue *MGM::genMovement(MGMInfo *mgminfo) {
mq->addExCommandToEnd(ex);
return mq;
-#endif
}
+int MGM::countPhases(int idx, int subIdx, int endIdx, int flag) {
+ int res = 0;
+
+ if (endIdx < 0)
+ return 0;
+
+ while (subIdx != endIdx) {
+ if (subIdx < 0)
+ break;
+
+ res += _items[idx]->subItems[subIdx + endIdx * _items[idx]->statics.size()]->movement->countPhasesWithFlag(-1, flag);
+
+ subIdx = _items[idx]->subItems[subIdx + 6 * endIdx * _items[idx]->statics.size()]->staticsIndex;
+ }
+
+ return res;
+}
void MGM::updateAnimStatics(StaticANIObject *ani, int staticsId) {
if (getItemIndexById(ani->_id) == -1)
return;
@@ -2112,9 +2284,99 @@ void MGM::clearMovements2(int idx) {
}
int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) {
- warning("STUB: MGM::recalcOffsets()");
+ MGMItem *item = _items[idx];
+ int subIdx = st1idx + st2idx * item->statics.size();
- return 0;
+ if (st1idx == st2idx) {
+ memset(&item->subItems[subIdx], 0, sizeof(item->subItems[subIdx]));
+ return 0;
+ }
+
+ if (item->subItems[subIdx])
+ return item->subItems[subIdx]->field_8;
+
+ Common::Point point;
+
+ for (uint i = 0; i < item->movements1.size(); i++) {
+ Movement *mov = item->movements1[i];
+
+ if (mov->_staticsObj1 == item->statics[st1idx]) {
+ if (!item->movements2[i] && (!flop || mov->_field_50)) {
+ item->movements2[i] = 1;
+
+ int stidx = getStaticsIndex(idx, item->movements1[i]->_staticsObj2);
+ int recalc = recalcOffsets(idx, stidx, st2idx, flip, flop);
+ int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+ int newsz = sz + item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->field_C;
+
+ if (recalc >= 0) {
+ if (!item->subItems[subIdx]->movement || item->subItems[subIdx]->field_8 > recalc + 1 ||
+ (item->subItems[subIdx]->field_8 == recalc + 1 && item->subItems[subIdx]->field_C > newsz)) {
+ item->subItems[subIdx]->movement = mov;
+ item->subItems[subIdx]->staticsIndex = stidx;
+ item->subItems[subIdx]->field_8 = recalc + 1;
+ item->subItems[subIdx]->field_C = newsz;
+
+ mov->calcSomeXY(point, 0);
+
+ item->subItems[subIdx]->x = item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->x + point.x;
+ item->subItems[subIdx]->y = item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->y + point.y;
+ }
+ }
+ }
+ } else if (flip) {
+ if (mov->_staticsObj2 == item->statics[st1idx]) {
+ if (!item->movements2[i] && (!flop || mov->_field_50)) {
+ item->movements2[i] = 1;
+
+ int stidx = getStaticsIndex(idx, mov->_staticsObj1);
+ int recalc = recalcOffsets(idx, stidx, st2idx, flip, flop);
+
+ if (recalc >= 0) {
+ if (!item->subItems[subIdx]->movement || item->subItems[subIdx]->field_8 > recalc + 1) {
+ item->subItems[subIdx]->movement = mov;
+ item->subItems[subIdx]->staticsIndex = stidx;
+ item->subItems[subIdx]->field_8 = recalc + 1;
+
+ int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+
+ item->subItems[subIdx]->field_C = sz + item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->field_C;
+
+ mov->calcSomeXY(point, 0);
+
+ item->subItems[subIdx]->x = item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->x - point.x;
+ item->subItems[subIdx]->y = item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->y - point.y;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (item->subItems[subIdx]->movement)
+ return item->subItems[subIdx]->field_8;
+
+ return -1;
+}
+
+int MGM::refreshOffsets(int objectId, int idx1, int idx2) {
+ int idx = getItemIndexById(objectId);
+
+ if (idx != -1) {
+ int from = getStaticsIndexById(idx, idx1);
+ int to = getStaticsIndexById(idx, idx2);
+
+ MGMSubItem *sub = _items[idx]->subItems[from + to * _items[idx]->statics.size()];
+
+ if (sub->movement) {
+ idx = sub->field_8;
+ } else {
+ clearMovements2(idx);
+ idx = recalcOffsets(idx, from, to, 0, 1);
+ }
+ }
+
+ return idx;
}
Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y, int *mult, int *len, int flag) {
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index a9695e8094..4d92fd7fed 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -138,7 +138,7 @@ struct MGMItem {
Common::Array<MGMSubItem *> subItems;
Common::Array<Statics *> statics;
Common::Array<Movement *> movements1;
- Common::Array<Movement *> movements2;
+ Common::Array<int> movements2;
MGMItem();
};
@@ -178,6 +178,9 @@ public:
int recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop);
Common::Point *calcLength(Common::Point *point, Movement *mov, int x, int y, int *mult, int *len, int flag);
ExCommand2 *buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len);
+ MessageQueue *genMQ(StaticANIObject *ani, int staticsIndex, int staticsId, int *resStatId, Common::Point **pointArr);
+ int countPhases(int idx, int subIdx, int subOffset, int flag);
+ int refreshOffsets(int objectId, int idx1, int idx2);
};
struct MctlLadderMovementVars {
@@ -347,6 +350,7 @@ public:
double calcDistance(Common::Point *point, MovGraphLink *link, int fuzzyMatch);
void calcNodeDistancesAndAngles();
MovGraphNode *calcOffset(int ox, int oy);
+ int getItemIndexByStaticAni(StaticANIObject *ani);
};
class Movement;
diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp
index 1c6369341a..7420c1b1cf 100644
--- a/engines/fullpipe/scenes.cpp
+++ b/engines/fullpipe/scenes.cpp
@@ -270,43 +270,38 @@ Vars::Vars() {
scene17_handPhase = false;
scene17_sceneEdgeX = 0;
- scene18_var01 = 0;
- scene18_var16 = 200;
- scene18_var17 = 200;
- scene18_var18 = 300;
- scene18_var19 = 300;
+ scene18_inScene18p1 = false;
scene18_whirlgig = 0;
- scene18_var20 = 1032;
- scene18_var04 = -318;
- scene18_var08 = 0;
- scene18_var09 = 0;
- scene18_var03 = false;
- scene18_var21 = 0;
- scene18_var11 = 0;
- scene18_var12 = 0;
- scene18_var22 = 1;
- scene18_var23 = -1;
- scene18_var24 = 0;
- scene18_var25 = 0;
- scene18_var26 = 1;
- scene18_var27 = -1;
- scene18_var13 = -1;
- scene18_var14 = -1;
- scene18_var28 = 0;
- scene18_var15 = 0;
+ scene18_wheelCenterX = 0;
+ scene18_wheelCenterY = 0;
+ scene18_bridgeIsConvoluted = false;
+ scene18_whirlgigMovMum = 0;
+ scene18_girlIsSwinging = false;
+ scene18_rotationCounter = 0;
+ scene18_manY = 0;
+ scene18_wheelFlipper = false;
+ scene18_wheelIsTurning = true;
+ scene18_kidIsOnWheel = -1;
+ scene18_boyIsOnWheel = 0;
+ scene18_girlIsOnWheel = 0;
+ scene18_boyJumpedOff = true;
+ scene18_jumpDistance = -1;
+ scene18_jumpAngle = -1;
+ scene18_manIsReady = false;
+ scene18_enteredTrubaRight = false;
+ scene18_manWheelPos = 0;
+ scene18_manWheelPosTo = -1;
+ scene18_kidWheelPos = 0;
+ scene18_kidWheelPosTo = 0;
scene18_boy = 0;
scene18_girl = 0;
scene18_domino = 0;
- scene18_var29 = 290;
- scene18_var30 = -363;
- scene18_var05 = 283;
- scene18_var06 = -350;
+ scene18_boyJumpX = 290;
+ scene18_boyJumpY = -363;
+ scene18_girlJumpX = 283;
+ scene18_girlJumpY = -350;
- scene19_var01 = 0;
- scene19_var02 = 0;
- scene19_var03 = 0;
- scene19_var04 = 0;
- scene19_var05 = false;
+ scene19_enteredTruba3 = false;
scene20_fliesCountdown = 0;
scene20_grandma = 0;
@@ -383,6 +378,23 @@ Vars::Vars() {
scene28_headBeardedFlipper = false;
scene28_lift6inside = false;
+ scene29_porter = 0;
+ scene29_shooter1 = 0;
+ scene29_shooter2 = 0;
+ scene29_ass = 0;
+ scene29_manIsRiding = false;
+ scene29_arcadeIsOn = false;
+ scene29_reachedFarRight = false;
+ scene29_rideBackEnabled = false;
+ scene29_shootCountdown = 0;
+ scene29_shootDistance = 75;
+ scene29_manIsHit = 0;
+ scene29_scrollSpeed = 0;
+ scene29_scrollingDisabled = 0;
+ scene29_hitBall = 0;
+ scene29_manX = 0;
+ scene29_manY = 0;
+
scene30_leg = 0;
scene30_liftFlag = 1;
@@ -801,7 +813,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
scene->preloadMovements(sceneVar);
g_fp->stopAllSounds();
- if (g_vars->scene18_var01)
+ if (g_vars->scene18_inScene18p1)
scene18_initScene1(scene);
else
scene18_initScene2(scene);
@@ -817,10 +829,12 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
if (!g_fp->_scene3) {
g_fp->_scene3 = accessScene(SC_18);
g_fp->_gameLoader->loadScene(SC_18);
+
scene18_initScene2(g_fp->_scene3);
scene18_preload();
scene19_setMovements(g_fp->_scene3, entrance->_field_4);
- g_vars->scene18_var01 = 1;
+
+ g_vars->scene18_inScene18p1 = true;
}
scene19_preload();
@@ -828,7 +842,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
scene->preloadMovements(sceneVar);
g_fp->stopAllSounds();
- if (g_vars->scene18_var01)
+ if (g_vars->scene18_inScene18p1)
scene18_initScene1(scene);
else
scene19_initScene2();
@@ -945,7 +959,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
_updateCursorCallback = scene28_updateCursor;
break;
-#if 0
case SC_29:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_29");
scene->preloadMovements(sceneVar);
@@ -956,7 +969,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
addMessageHandler(sceneHandler29, 2);
_updateCursorCallback = scene29_updateCursor;
break;
-#endif
case SC_30:
sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_30");
@@ -1094,10 +1106,6 @@ int defaultUpdateCursor() {
return g_fp->_cursorId;
}
-void FullpipeEngine::processArcade(ExCommand *ex) {
- warning("STUB: FullpipeEngine::processArcade()");
-}
-
void FullpipeEngine::updateMapPiece(int mapId, int update) {
for (int i = 0; i < 200; i++) {
int hiWord = (_mapTable[i] >> 16) & 0xffff;
@@ -1453,5 +1461,31 @@ Ball *BallChain::sub04(Ball *ballP, Ball *ballN) {
return pTail;
}
+void BallChain::removeBall(Ball *ball) {
+ if (ball == pHead)
+ pHead = ball->p0;
+ else
+ ball->p1->p0 = ball->p0;
+
+ if (ball == field_8)
+ field_8 = ball->p1;
+ else
+ ball->p0->p1 = ball->p1;
+
+ ball->p0 = pTail;
+ pTail = ball;
+
+ numBalls--;
+
+ if (!numBalls) {
+ numBalls = 0;
+ pTail = 0;
+ field_8 = 0;
+ pHead = 0;
+ free(cPlex);
+ cPlex = 0;
+ }
+}
+
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h
index 30306fa9ab..0b7c4e7c8f 100644
--- a/engines/fullpipe/scenes.h
+++ b/engines/fullpipe/scenes.h
@@ -33,6 +33,7 @@ class MctlLadder;
struct Ring;
class StaticANIObject;
struct Swinger;
+struct WalkingBearder;
int defaultUpdateCursor();
@@ -163,6 +164,10 @@ void scene28_initScene(Scene *sc);
int sceneHandler28(ExCommand *ex);
int scene28_updateCursor();
+int scene29_updateCursor();
+void scene29_initScene(Scene *sc);
+int sceneHandler29(ExCommand *cmd);
+
int scene30_updateCursor();
void scene30_initScene(Scene *sc, int flag);
int sceneHandler30(ExCommand *cmd);
@@ -227,6 +232,7 @@ struct BallChain {
void init(Ball **ball);
Ball *sub04(Ball *ballP, Ball *ballN);
+ void removeBall(Ball *ball);
void reset() { pHead = 0; pTail = 0; field_8 = 0; numBalls = 0; free(cPlex); cPlex = 0; cPlexLen = 0; }
};
@@ -473,44 +479,39 @@ public:
bool scene17_handPhase;
int scene17_sceneEdgeX;
- int scene18_var01;
- int scene18_var16;
- int scene18_var17;
- int scene18_var18;
- int scene18_var19;
+ bool scene18_inScene18p1;
StaticANIObject *scene18_whirlgig;
- Common::Array<Swinger *> scene18_var07;
- int scene18_var20;
- int scene18_var04;
- int scene18_var08;
- int scene18_var09;
- bool scene18_var03;
- int scene18_var21;
- int scene18_var11;
- int scene18_var12;
- int scene18_var22;
- int scene18_var23;
- int scene18_var24;
- int scene18_var25;
- int scene18_var26;
- int scene18_var27;
- int scene18_var13;
- int scene18_var14;
- int scene18_var28;
- int scene18_var15;
+ Common::Array<Swinger *> scene18_swingers;
+ int scene18_wheelCenterX;
+ int scene18_wheelCenterY;
+ bool scene18_bridgeIsConvoluted;
+ int scene18_whirlgigMovMum;
+ bool scene18_girlIsSwinging;
+ int scene18_rotationCounter;
+ int scene18_manY;
+ bool scene18_wheelFlipper;
+ bool scene18_wheelIsTurning;
+ int scene18_kidIsOnWheel;
+ int scene18_boyIsOnWheel;
+ int scene18_girlIsOnWheel;
+ bool scene18_boyJumpedOff;
+ int scene18_manWheelPos;
+ int scene18_manWheelPosTo;
+ int scene18_kidWheelPos;
+ int scene18_kidWheelPosTo;
+ int scene18_jumpDistance;
+ int scene18_jumpAngle;
+ bool scene18_manIsReady;
+ bool scene18_enteredTrubaRight;
StaticANIObject *scene18_boy;
StaticANIObject *scene18_girl;
StaticANIObject *scene18_domino;
- int scene18_var29;
- int scene18_var30;
- int scene18_var05;
- int scene18_var06;
+ int scene18_boyJumpX;
+ int scene18_boyJumpY;
+ int scene18_girlJumpX;
+ int scene18_girlJumpY;
- int scene19_var01;
- int scene19_var02;
- int scene19_var03;
- int scene19_var04;
- bool scene19_var05;
+ bool scene19_enteredTruba3;
int scene20_fliesCountdown;
StaticANIObject *scene20_grandma;
@@ -590,6 +591,29 @@ public:
bool scene28_headBeardedFlipper;
bool scene28_lift6inside;
+ StaticANIObject *scene29_porter;
+ StaticANIObject *scene29_shooter1;
+ StaticANIObject *scene29_shooter2;
+ StaticANIObject *scene29_ass;
+ BallChain scene29_balls;
+ BallChain scene29_redBalls;
+ BallChain scene29_flyingRedBalls;
+ BallChain scene29_greenBalls;
+ bool scene29_manIsRiding;
+ bool scene29_arcadeIsOn;
+ bool scene29_reachedFarRight;
+ bool scene29_rideBackEnabled;
+ int scene29_shootCountdown;
+ int scene29_shootDistance;
+ int scene29_manIsHit;
+ int scene29_scrollSpeed;
+ bool scene29_scrollingDisabled;
+ int scene29_hitBall;
+ Common::Array<WalkingBearder *> scene29_bearders;
+ int scene29_manX;
+ int scene29_manY;
+ MGM scene29_mgm;
+
StaticANIObject *scene30_leg;
int scene30_liftFlag;
diff --git a/engines/fullpipe/scenes/scene18and19.cpp b/engines/fullpipe/scenes/scene18and19.cpp
index ea816bb5d1..4f6677876b 100644
--- a/engines/fullpipe/scenes/scene18and19.cpp
+++ b/engines/fullpipe/scenes/scene18and19.cpp
@@ -48,6 +48,9 @@ struct Swinger {
int sfield_24;
};
+
+#define ANGLE(x) ((x) * M_PI / 180)
+
void scene18_preload() {
g_fp->_scene3 = 0;
@@ -82,29 +85,29 @@ void scene19_setSugarState(Scene *sc) {
void scene19_setMovements(Scene *sc, int entranceId) {
if (entranceId == TrubaRight) {
- g_vars->scene18_var15 = 1;
+ g_vars->scene18_enteredTrubaRight = true;
} else {
- g_vars->scene18_var15 = 0;
- g_vars->scene19_var05 = (entranceId == PIC_SC19_RTRUBA3);
+ g_vars->scene18_enteredTrubaRight = false;
+ g_vars->scene19_enteredTruba3 = (entranceId == PIC_SC19_RTRUBA3);
}
- for (uint i = 0; i < g_vars->scene18_var07.size(); i++) {
- if (!g_vars->scene18_var15 && (g_vars->scene18_var07[i]->sflags & 0x20)) {
+ for (uint i = 0; i < g_vars->scene18_swingers.size(); i++) {
+ if (!g_vars->scene18_enteredTrubaRight && (g_vars->scene18_swingers[i]->sflags & 0x20)) {
Scene *oldsc = g_fp->_currentScene;
- g_vars->scene18_var07[i]->sflags = 1;
+ g_vars->scene18_swingers[i]->sflags = 1;
g_fp->_currentScene = sc;
- g_vars->scene18_var07[i]->ani->changeStatics2(ST_KSL_NORM);
- g_vars->scene18_var07[i]->ani->_priority = 30;
+ g_vars->scene18_swingers[i]->ani->changeStatics2(ST_KSL_NORM);
+ g_vars->scene18_swingers[i]->ani->_priority = 30;
g_fp->_currentScene = oldsc;
}
- sc->deleteStaticANIObject(g_vars->scene18_var07[i]->ani);
+ sc->deleteStaticANIObject(g_vars->scene18_swingers[i]->ani);
}
if (g_vars->scene18_whirlgig->_movement) {
- g_vars->scene18_var09 = g_vars->scene18_whirlgig->_movement->_currDynamicPhaseIndex + 1;
+ g_vars->scene18_whirlgigMovMum = g_vars->scene18_whirlgig->_movement->_currDynamicPhaseIndex + 1;
int mx;
@@ -113,10 +116,10 @@ void scene19_setMovements(Scene *sc, int entranceId) {
else
mx = g_vars->scene18_whirlgig->_movement->_dynamicPhases.size();
- if (g_vars->scene18_var09 > mx - 1)
- g_vars->scene18_var09 = -1;
+ if (g_vars->scene18_whirlgigMovMum > mx - 1)
+ g_vars->scene18_whirlgigMovMum = -1;
} else {
- g_vars->scene18_var09 = 0;
+ g_vars->scene18_whirlgigMovMum = 0;
}
sc->deleteStaticANIObject(g_vars->scene18_boy);
@@ -137,7 +140,7 @@ void scene19_preload() {
void scene18_setupSwingers(StaticANIObject *ani, Scene *sc) {
Swinger *swinger;
- g_vars->scene18_var07.clear();
+ g_vars->scene18_swingers.clear();
Scene *oldsc = g_fp->_currentScene;
g_fp->_currentScene = sc;
@@ -145,9 +148,9 @@ void scene18_setupSwingers(StaticANIObject *ani, Scene *sc) {
for (int i = 0; i < 8; i++) {
swinger = new Swinger;
- swinger->angle = (double)i * M_PI / 4.0;
- swinger->sx = g_vars->scene18_var20 - (int)(cos(swinger->angle) * -575.0);
- swinger->sy = g_vars->scene18_var04 - (int)(sin(swinger->angle) * -575.0) + 87;
+ swinger->angle = (double)i * ANGLE(45);
+ swinger->sx = g_vars->scene18_wheelCenterX - (int)(cos(swinger->angle) * -575.0);
+ swinger->sy = g_vars->scene18_wheelCenterY - (int)(sin(swinger->angle) * -575.0) + 87;
swinger->ix = swinger->sx;
swinger->iy = swinger->sy;
@@ -162,27 +165,25 @@ void scene18_setupSwingers(StaticANIObject *ani, Scene *sc) {
sc->addStaticANIObject(newani, 1);
} else {
swinger->ani = ani;
- swinger->sflags = g_vars->scene18_var03 != 0 ? 4 : 1;
+ swinger->sflags = g_vars->scene18_girlIsSwinging ? 4 : 1;
}
ani->_statics = ani->getStaticsById(ST_KSL_NORM);
- ani->_movement = 0;
+ //ani->_movement = 0;
ani->setOXY(swinger->sx, swinger->sy);
ani->_priority = 30;
ani->_flags |= 4;
- if (swinger->sflags & 2) {
+ if (swinger->sflags & 2)
ani->startAnim(MV_KSL_SWINGBOY, 0, -1);
- } else {
- if (swinger->sflags & 4)
- ani->startAnim(MV_KSL_SWINGGIRL, 0, -1);
- else
- ani->startAnim(MV_KSL_SWING, 0, -1);
- }
+ else if (swinger->sflags & 4)
+ ani->startAnim(MV_KSL_SWINGGIRL, 0, -1);
+ else
+ ani->startAnim(MV_KSL_SWING, 0, -1);
ani->_movement->setDynamicPhaseIndex(g_fp->_rnd->getRandomNumber(17));
- g_vars->scene18_var07.push_back(swinger);
+ g_vars->scene18_swingers.push_back(swinger);
}
g_fp->_currentScene = oldsc;
@@ -191,63 +192,63 @@ void scene18_setupSwingers(StaticANIObject *ani, Scene *sc) {
void scene18_initScene1(Scene *sc) {
PicAniInfo info;
- int oldx = g_vars->scene18_var20;
- int oldy = g_vars->scene18_var04;
+ int oldx = g_vars->scene18_wheelCenterX;
+ int oldy = g_vars->scene18_wheelCenterY;
- g_vars->scene18_var03 = (g_fp->getObjectState(sO_Girl) == g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging));
+ g_vars->scene18_girlIsSwinging = (g_fp->getObjectState(sO_Girl) == g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging));
if (sc->_sceneId == SC_18) {
g_vars->scene18_whirlgig = sc->getStaticANIObject1ById(ANI_WHIRLIGIG_18, -1);
- g_vars->scene18_var20 = 1032;
- g_vars->scene18_var04 = -318;
+ g_vars->scene18_wheelCenterX = 1032;
+ g_vars->scene18_wheelCenterY = -318;
} else {
g_vars->scene18_whirlgig = sc->getStaticANIObject1ById(ANI_WHIRLGIG_19, -1);
- g_vars->scene18_var20 = 1024;
- g_vars->scene18_var04 = 242;
+ g_vars->scene18_wheelCenterX = 1024;
+ g_vars->scene18_wheelCenterY = 242;
}
- int newx = g_vars->scene18_var20 - oldx;
- int newy = g_vars->scene18_var04 - oldy;
+ int newx = g_vars->scene18_wheelCenterX - oldx;
+ int newy = g_vars->scene18_wheelCenterY - oldy;
- g_vars->scene18_var29 += newx;
- g_vars->scene18_var30 += newy;
- g_vars->scene18_var05 += newx;
- g_vars->scene18_var06 += newy;
+ g_vars->scene18_boyJumpX += newx;
+ g_vars->scene18_boyJumpY += newy;
+ g_vars->scene18_girlJumpX += newx;
+ g_vars->scene18_girlJumpY += newy;
- for (uint i = 0; i < g_vars->scene18_var07.size(); i++) {
- g_vars->scene18_var07[i]->ani->getPicAniInfo(&info);
- sc->addStaticANIObject(g_vars->scene18_var07[i]->ani, 1);
- g_vars->scene18_var07[i]->ani->setPicAniInfo(&info);
+ for (uint i = 0; i < g_vars->scene18_swingers.size(); i++) {
+ g_vars->scene18_swingers[i]->ani->getPicAniInfo(&info);
+ sc->addStaticANIObject(g_vars->scene18_swingers[i]->ani, 1);
+ g_vars->scene18_swingers[i]->ani->setPicAniInfo(&info);
- g_vars->scene18_var07[i]->sx += newx;
- g_vars->scene18_var07[i]->sy += newy;
- g_vars->scene18_var07[i]->ix += newx;
- g_vars->scene18_var07[i]->iy += newy;
+ g_vars->scene18_swingers[i]->sx += newx;
+ g_vars->scene18_swingers[i]->sy += newy;
+ g_vars->scene18_swingers[i]->ix += newx;
+ g_vars->scene18_swingers[i]->iy += newy;
GameObject *go;
- if (g_vars->scene18_var07[i]->ani->_movement)
- go = g_vars->scene18_var07[i]->ani->_movement;
+ if (g_vars->scene18_swingers[i]->ani->_movement)
+ go = g_vars->scene18_swingers[i]->ani->_movement;
else
- go = g_vars->scene18_var07[i]->ani;
+ go = g_vars->scene18_swingers[i]->ani;
go->setOXY(newx + go->_ox, newy + go->_oy);
}
- if (g_vars->scene18_var08 && g_vars->scene18_var09 != -1) {
+ if (g_vars->scene18_bridgeIsConvoluted && g_vars->scene18_whirlgigMovMum != -1) {
g_vars->scene18_whirlgig->startAnim(sc->_sceneId != SC_18 ? MV_WHR19_SPIN : MV_WHR18_SPIN, 0, -1);
- g_vars->scene18_whirlgig->_movement->setDynamicPhaseIndex(g_vars->scene18_var09);
+ g_vars->scene18_whirlgig->_movement->setDynamicPhaseIndex(g_vars->scene18_whirlgigMovMum);
}
int sndid;
if (sc->_sceneId == SC_19) {
- if (g_vars->scene18_var08)
+ if (g_vars->scene18_bridgeIsConvoluted)
sndid = SND_19_015;
else
sndid = SND_19_016;
} else {
- if (g_vars->scene18_var08)
+ if (g_vars->scene18_bridgeIsConvoluted)
sndid = SND_18_006;
else
sndid = SND_18_010;
@@ -285,85 +286,77 @@ void scene18_initScene1(Scene *sc) {
g_vars->scene18_girl->setOXY(newx + x, newy + y);
- g_vars->scene18_var12 = 0;
- g_vars->scene18_var13 = -1;
- g_vars->scene18_var14 = -1;
+ g_vars->scene18_wheelFlipper = false;
+ g_vars->scene18_jumpDistance = -1;
+ g_vars->scene18_jumpAngle = -1;
- if (g_vars->scene18_var15) {
+ if (g_vars->scene18_enteredTrubaRight) {
if (sc->_sceneId == SC_19)
g_fp->_aniMan2 = 0;
else
- g_fp->_aniMan2 = g_vars->scene18_var07[g_vars->scene18_var27]->ani;
+ g_fp->_aniMan2 = g_vars->scene18_swingers[g_vars->scene18_manWheelPosTo]->ani;
} else {
g_fp->_aniMan2 = g_fp->_aniMan;
}
}
void scene18_initScene2(Scene *sc) {
- g_vars->scene18_var16 = 200;
- g_vars->scene18_var17 = 200;
- g_vars->scene18_var18 = 300;
- g_vars->scene18_var19 = 300;
g_vars->scene18_whirlgig = sc->getStaticANIObject1ById(ANI_WHIRLIGIG_18, -1);
- g_vars->scene18_var20 = 1032;
- g_vars->scene18_var04 = -318;
+ g_vars->scene18_wheelCenterX = 1032;
+ g_vars->scene18_wheelCenterY = -318;
StaticANIObject *armchair = sc->getStaticANIObject1ById(ANI_KRESLO, -1);
armchair->loadMovementsPixelData();
- g_vars->scene18_var03 = (g_fp->getObjectState(sO_Girl) == g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging));
+ g_vars->scene18_girlIsSwinging = (g_fp->getObjectState(sO_Girl) == g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging));
if (g_fp->getObjectState(sO_Bridge) == g_fp->getObjectEnumState(sO_Bridge, sO_Convoluted)) {
- g_vars->scene18_var08 = 1;
+ g_vars->scene18_bridgeIsConvoluted = true;
g_fp->playSound(SND_18_006, 1);
} else {
- g_vars->scene18_var08 = 0;
+ g_vars->scene18_bridgeIsConvoluted = false;
g_fp->playSound(SND_18_010, 1);
}
scene18_setupSwingers(armchair, sc);
- g_vars->scene18_var21 = 0;
- g_vars->scene18_var12 = 0;
- g_vars->scene18_var22 = 1;
- g_vars->scene18_var23 = -1;
- g_vars->scene18_var24 = 0;
- g_vars->scene18_var25 = 0;
- g_vars->scene18_var26 = 1;
- g_vars->scene18_var27 = -1;
- g_vars->scene18_var13 = -1;
- g_vars->scene18_var14 = -1;
- g_vars->scene18_var28 = 0;
- g_vars->scene18_var15 = 0;
+ g_vars->scene18_rotationCounter = 0;
+ g_vars->scene18_wheelFlipper = false;
+ g_vars->scene18_wheelIsTurning = true;
+ g_vars->scene18_kidIsOnWheel = -1;
+ g_vars->scene18_boyIsOnWheel = 0;
+ g_vars->scene18_girlIsOnWheel = 0;
+ g_vars->scene18_boyJumpedOff = true;
+ g_vars->scene18_manWheelPosTo = -1;
+ g_vars->scene18_jumpDistance = -1;
+ g_vars->scene18_jumpAngle = -1;
+ g_vars->scene18_manIsReady = false;
+ g_vars->scene18_enteredTrubaRight = 0;
g_vars->scene18_boy = sc->getStaticANIObject1ById(ANI_BOY18, -1);
g_vars->scene18_girl = sc->getStaticANIObject1ById(ANI_GIRL18, -1);
g_vars->scene18_domino = sc->getStaticANIObject1ById(ANI_DOMINO_18, -1);
- g_vars->scene18_var29 = 290;
- g_vars->scene18_var30 = -363;
- g_vars->scene18_var05 = 283;
- g_vars->scene18_var06 = -350;
+ g_vars->scene18_boyJumpX = 290;
+ g_vars->scene18_boyJumpY = -363;
+ g_vars->scene18_girlJumpX = 283;
+ g_vars->scene18_girlJumpY = -350;
g_fp->initArcadeKeys("SC_18");
}
void scene19_initScene2() {
g_fp->_aniMan2 = 0;
- g_vars->scene19_var01 = 200;
- g_vars->scene19_var02 = 200;
- g_vars->scene19_var03 = 300;
- g_vars->scene19_var04 = 300;
}
int scene18_updateCursor() {
- if (g_vars->scene18_var15) {
+ if (g_vars->scene18_enteredTrubaRight) {
g_fp->_cursorId = PIC_CSR_DEFAULT;
} else {
g_fp->updateCursorCommon();
if (g_fp->_cursorId == PIC_CSR_ITN) {
if (g_fp->_objectIdAtCursor == PIC_SC18_LADDER1) {
- g_fp->_cursorId = (g_vars->scene18_var11 <= 250) ? PIC_CSR_GOD : PIC_CSR_GOU;
+ g_fp->_cursorId = (g_vars->scene18_manY <= 250) ? PIC_CSR_GOD : PIC_CSR_GOU;
} else if (g_fp->_objectIdAtCursor == PIC_SC18_LADDER2 || g_fp->_objectIdAtCursor == PIC_SC18_LADDER3) {
g_fp->_cursorId = PIC_CSR_GOU;
}
@@ -379,64 +372,316 @@ int scene19_updateCursor() {
g_fp->updateCursorCommon();
if (g_fp->_objectIdAtCursor == PIC_SC19_RTRUBA31)
- g_fp->_cursorId = g_vars->scene19_var05 != 0 ? PIC_CSR_GOR : PIC_CSR_DEFAULT;
+ g_fp->_cursorId = g_vars->scene19_enteredTruba3 ? PIC_CSR_GOR : PIC_CSR_DEFAULT;
return g_fp->_cursorId;
}
void sceneHandler18_clickBoard() {
- warning("STUB: sceneHandler18_clickBoard()");
+ if (ABS(967 - g_fp->_aniMan->_ox) > 1 || ABS(379 - g_fp->_aniMan->_oy) > 1 || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
+ MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 967, 379, 1, ST_MAN_RIGHT);
+ ExCommand *ex = new ExCommand(0, 17, MSG_SC18_MANREADY, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_excFlags = 2;
+
+ mq->addExCommandToEnd(ex);
+
+ postExCommand(g_fp->_aniMan->_id, 2, 967, 379, 0, -1);
+ } else {
+ g_vars->scene18_manIsReady = true;
+ }
}
-void sceneHandler18and19_showManJump() {
+void sceneHandler18_showManJumpTo() {
g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT);
g_fp->_aniMan->_flags &= 0xFFFB;
g_fp->_aniMan->_flags &= 0xFEFF;
- g_vars->scene18_var07[g_vars->scene18_var27]->sflags = 0x20;
+ g_vars->scene18_swingers[g_vars->scene18_manWheelPosTo]->sflags = 0x20;
- g_vars->scene18_var07[g_vars->scene18_var27]->ani->changeStatics2(ST_KSL_JUMPMAN);
- g_vars->scene18_var07[g_vars->scene18_var27]->ani->startAnim(MV_KSL_INMAN, 0, -1);
- g_vars->scene18_var07[g_vars->scene18_var27]->ani->_priority = 20;
+ g_vars->scene18_swingers[g_vars->scene18_manWheelPosTo]->ani->changeStatics2(ST_KSL_JUMPMAN);
+ g_vars->scene18_swingers[g_vars->scene18_manWheelPosTo]->ani->startAnim(MV_KSL_INMAN, 0, -1);
+ g_vars->scene18_swingers[g_vars->scene18_manWheelPosTo]->ani->_priority = 20;
- g_vars->scene18_var28 = 0;
- g_vars->scene18_var15 = 1;
+ g_vars->scene18_manIsReady = false;
+ g_vars->scene18_enteredTrubaRight = true;
- g_fp->_aniMan2 = g_vars->scene18_var07[g_vars->scene18_var27]->ani;
+ g_fp->_aniMan2 = g_vars->scene18_swingers[g_vars->scene18_manWheelPosTo]->ani;
}
-void sceneHandler18_showManJumpTo() {
- warning("STUB: sceneHandler18_showManJumpTo()");
+void sceneHandler18and19_showManJump() {
+ int x, y;
+
+ if (g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_movement) {
+ x = g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_movement->_ox;
+ y = g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_movement->_oy;
+ } else {
+ x = g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_ox;
+ y = g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_oy;
+ }
+
+ g_fp->_aniMan->show1(x + 62, y + 5, MV_MAN18_JUMPTOTRUBA, 0);
+ g_fp->_aniMan->_priority = 35;
+
+ int mqid = 0;
+
+ if (g_vars->scene18_jumpDistance == 1) {
+ mqid = QU_SC19_MANJUMP1;
+ } else if (g_vars->scene18_jumpDistance == 2) {
+ mqid = QU_SC19_MANJUMP2;
+ } else if (g_vars->scene18_jumpDistance == 3) {
+ mqid = QU_SC19_MANJUMP3;
+ }
+
+ if (mqid) {
+ MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(mqid), 0, 0);
+
+ g_fp->_aniMan2 = g_fp->_aniMan;
+ g_vars->scene18_enteredTrubaRight = false;
+
+ mq->setFlags(mq->getFlags() | 1);
+ mq->chain(0);
+ }
+
+ g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->sflags = 1;
+
+ g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->changeStatics2(ST_KSL_NORM);
+ g_vars->scene18_swingers[g_vars->scene18_manWheelPos]->ani->_priority = 30;
}
void sceneHandler18and19_showGirlJumpTo() {
- warning("STUB: sceneHandler18and19_showGirlJumpTo()");
+ g_vars->scene18_girl->stopAnim_maybe();
+ g_vars->scene18_girl->hide();
+
+ g_vars->scene18_swingers[g_vars->scene18_kidWheelPosTo]->sflags = 4;
+
+ g_vars->scene18_swingers[g_vars->scene18_kidWheelPosTo]->ani->changeStatics2(ST_KSL_JUMPGIRL);
+ g_vars->scene18_swingers[g_vars->scene18_kidWheelPosTo]->ani->startAnim(MV_KSL_INGIRL, 0, -1);
+
+ g_vars->scene18_kidIsOnWheel--;
+ g_vars->scene18_girlIsOnWheel--;
}
void sceneHandler18and19_showGirlJump() {
- warning("STUB: sceneHandler18and19_showGirlJump()");
+ StaticANIObject *ani = g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->ani;
+ int x, y;
+
+ if (ani->_movement) {
+ x = ani->_movement->_ox;
+ y = ani->_movement->_oy;
+ } else {
+ x = ani->_ox;
+ y = ani->_oy;
+ }
+
+ g_vars->scene18_girl->show1(x - 62, y - 10, MV_GRL18_JUMPFROM, 0);
+ g_vars->scene18_girl->_priority = 50;
+ g_vars->scene18_girl->startAnim(MV_GRL18_JUMPFROM, 0, -1);
+
+ g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->sflags = 1;
+
+ g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->ani->changeStatics2(ST_KSL_REACT);
+ g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->ani->startAnim(MV_KSL_CALMDOWN, 0, -1);
+
+ g_vars->scene18_kidIsOnWheel = 1;
+ g_vars->scene18_girlIsOnWheel++;
}
void sceneHandler18and19_showBoyJumpTo() {
- warning("STUB: sceneHandler18and19_showBoyJumpTo()");
+ g_vars->scene18_boy->stopAnim_maybe();
+ g_vars->scene18_boy->hide();
+
+ g_vars->scene18_swingers[g_vars->scene18_kidWheelPosTo]->sflags = 2;
+ g_vars->scene18_swingers[g_vars->scene18_kidWheelPosTo]->ani->changeStatics2(ST_KSL_JUMPBOY);
+ g_vars->scene18_swingers[g_vars->scene18_kidWheelPosTo]->ani->startAnim(MV_KSL_INBOY, 0, -1);
+
+ g_vars->scene18_kidIsOnWheel--;
+ g_vars->scene18_boyIsOnWheel--;
}
void sceneHandler18and19_showBoyJump() {
- warning("STUB: sceneHandler18and19_showBoyJump()");
+ StaticANIObject *ani = g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->ani;
+ int x, y;
+
+ if (ani->_movement) {
+ x = ani->_movement->_ox;
+ y = ani->_movement->_oy;
+ } else {
+ x = ani->_ox;
+ y = ani->_oy;
+ }
+
+ g_vars->scene18_boy->show1(x - 48, y + 8, MV_BOY18_JUMPFROM, 0);
+ g_vars->scene18_boy->_priority = 50;
+ g_vars->scene18_boy->startAnim(MV_BOY18_JUMPFROM, 0, -1);
+
+ g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->sflags = 1;
+
+ g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->ani->changeStatics2(ST_KSL_REACT);
+ g_vars->scene18_swingers[g_vars->scene18_kidWheelPos]->ani->startAnim(MV_KSL_CALMDOWN, 0, -1);
+
+ g_vars->scene18_boyJumpedOff = true;
}
void sceneHandler18and19_boyJumpTo() {
g_vars->scene18_boy->stopAnim_maybe();
- g_vars->scene18_boy->show1(g_vars->scene18_var29, g_vars->scene18_var30, MV_BOY18_JUMPTO, 0);
+ g_vars->scene18_boy->show1(g_vars->scene18_boyJumpX, g_vars->scene18_boyJumpY, MV_BOY18_JUMPTO, 0);
g_vars->scene18_boy->_priority = 50;
g_vars->scene18_boy->startAnim(MV_BOY18_JUMPTO, 0, -1);
}
+void sceneHandler18and19_girlJumpTo() {
+ g_vars->scene18_girl->stopAnim_maybe();
+ g_vars->scene18_girl->show1(g_vars->scene18_girlJumpX, g_vars->scene18_girlJumpY, MV_GRL18_JUMPTO, 0);
+ g_vars->scene18_girl->_priority = 50;
+ g_vars->scene18_girl->startAnim(MV_GRL18_JUMPTO, 0, -1);
+}
+
+void sceneHandler18and19_manStandArmchair() {
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT);
+ g_fp->_aniMan->_flags |= 1;
+ g_fp->_aniMan->_priority = 35;
+ g_fp->_aniMan->startAnim(MV_MAN18_STANDKRESLO, 0, -1);
+}
+
void sceneHandler18and19_drawRiders() {
- warning("STUB: sceneHandler18and19_drawRiders()");
+ g_vars->scene18_rotationCounter++;
+
+ if (g_vars->scene18_rotationCounter >= 359)
+ g_vars->scene18_rotationCounter = 0;
+
+ for (uint i = 0; i < g_vars->scene18_swingers.size(); i++) {
+ Swinger *swinger = g_vars->scene18_swingers[i];
+
+ double oldangle = swinger->angle;
+
+ swinger->angle += ANGLE(1);
+
+ if (swinger->angle > ANGLE(360)) {
+ swinger->angle -= ANGLE(360);
+ oldangle -= ANGLE(360);
+ }
+
+ int ix = g_vars->scene18_wheelCenterX - (int)(cos(swinger->angle) * -575.0);
+ int iy = g_vars->scene18_wheelCenterY - (int)(sin(swinger->angle) * -575.0) + 87;
+
+ if (!g_vars->scene18_rotationCounter) {
+ ix = swinger->sx;
+ iy = swinger->sy;
+ swinger->angle = (double)i * ANGLE(45);
+ }
+
+ if (swinger->ani->_movement)
+ swinger->ani->setOXY(ix - swinger->ix + swinger->ani->_movement->_ox, iy - swinger->iy + swinger->ani->_movement->_oy);
+ else
+ swinger->ani->setOXY(ix - swinger->ix + swinger->ani->_ox, iy - swinger->iy + swinger->ani->_oy);
+
+ swinger->ix = ix;
+ swinger->iy = iy;
+
+ if (!swinger->ani->_movement) {
+ int mv = 0;
+
+ if (swinger->sflags & 2) {
+ mv = MV_KSL_SWINGBOY;
+ } else if (swinger->sflags & 4) {
+ mv = MV_KSL_SWINGGIRL;
+ } else if (swinger->sflags & 0x20) {
+ mv = MV_KSL_SWINGMAN;
+ } else if (swinger->sflags & 1) {
+ mv = MV_KSL_SWING;
+ }
+
+ if (mv)
+ swinger->ani->startAnim(mv, 0, -1);
+
+ if (swinger->ani->_movement)
+ swinger->ani->_movement->_counter = 0;
+ }
+
+ if (g_vars->scene18_wheelIsTurning) {
+ if ((swinger->sflags & 2) && swinger->angle >= ANGLE(160) && oldangle < ANGLE(160)) {
+ swinger->sflags = 8;
+ swinger->ani->changeStatics2(ST_KSL_BOY);
+ swinger->ani->startAnim(MV_KSL_JUMPBOY, 0, -1);
+ g_vars->scene18_kidWheelPos = i;
+ } else if ((swinger->sflags & 4) && swinger->angle >= ANGLE(162) && oldangle < ANGLE(162)) {
+ swinger->sflags = 16;
+ swinger->ani->changeStatics2(ST_KSL_GIRL);
+ swinger->ani->startAnim(MV_KSL_JUMPGIRL, 0, -1);
+ g_vars->scene18_kidWheelPos = i;
+ } else if (g_vars->scene18_kidIsOnWheel) {
+ if (g_vars->scene18_boyIsOnWheel > 0 && (swinger->sflags & 1) && swinger->angle >= ANGLE(185) && oldangle < ANGLE(185)) {
+ g_vars->scene18_kidWheelPosTo = i;
+ sceneHandler18and19_boyJumpTo();
+ }
+ } else if (g_vars->scene18_girlIsOnWheel > 0 && (swinger->sflags & 1) && swinger->angle >= ANGLE(187) && oldangle < ANGLE(187)) {
+ g_vars->scene18_kidWheelPosTo = i;
+ sceneHandler18and19_girlJumpTo();
+ }
+
+ if (swinger->angle >= ANGLE(200) && oldangle < ANGLE(200)) {
+ if (g_vars->scene18_boyJumpedOff)
+ g_vars->scene18_boyIsOnWheel++;
+
+ g_vars->scene18_boyJumpedOff = false;
+ }
+ }
+
+ if (g_vars->scene18_manIsReady && (swinger->sflags & 1) && swinger->angle >= ANGLE(83) && oldangle < ANGLE(83)) {
+ g_vars->scene18_manWheelPosTo = i;
+ sceneHandler18and19_manStandArmchair();
+ }
+
+ if (!g_vars->scene18_enteredTrubaRight)
+ continue;
+
+ if ((int)i == g_vars->scene18_manWheelPosTo) {
+ if (swinger->angle >= ANGLE(170) && oldangle < ANGLE(170)) {
+ g_fp->_gameLoader->preloadScene(SC_18, TrubaRight);
+ } else if (swinger->angle >= ANGLE(25) && oldangle < ANGLE(25)) {
+ g_fp->_gameLoader->preloadScene(SC_19, TrubaRight);
+ } else if (swinger->angle >= ANGLE(270) && oldangle < ANGLE(270)) {
+ g_fp->_sceneRect.translate(1200, 0);
+ }
+ }
+
+ if (g_vars->scene18_jumpDistance > 0) {
+ if (swinger->sflags & 0x20) {
+ double newa = (double)g_vars->scene18_jumpAngle * ANGLE(1);
+
+ if (newa <= swinger->angle && oldangle < newa) {
+ swinger->ani->changeStatics2(ST_KSL_MAN);
+ swinger->ani->startAnim(MV_KSL_JUMPMAN, 0, -1);
+ swinger->ani->_priority = 35;
+
+ g_vars->scene18_manWheelPos = i;
+ }
+ }
+ }
+ }
}
void sceneHandler18and19_animateRiders() {
- warning("STUB: sceneHandler18and19_animateRiders()");
+ for (uint i = 0; i < g_vars->scene18_swingers.size(); i++) {
+ Swinger *swinger = g_vars->scene18_swingers[i];
+
+ if (!swinger->ani->_movement) {
+ int mv = 0;
+
+ if (swinger->sflags & 2)
+ mv = MV_KSL_SWINGBOY;
+ else if (swinger->sflags & 4)
+ mv = MV_KSL_SWINGGIRL;
+ else if (swinger->sflags & 0x20)
+ mv = MV_KSL_SWINGMAN;
+
+ if (mv)
+ swinger->ani->startAnim(mv, 0, -1);
+
+ if (swinger->ani->_movement)
+ swinger->ani->_movement->_counter = 0;
+ }
+ }
}
int sceneHandler18(ExCommand *cmd) {
@@ -457,7 +702,7 @@ int sceneHandler18(ExCommand *cmd) {
break;
case MSG_SC18_MANREADY:
- g_vars->scene18_var28 = 1;
+ g_vars->scene18_manIsReady = true;
break;
case MSG_SC18_SHOWMANJUMPTO:
@@ -482,8 +727,9 @@ int sceneHandler18(ExCommand *cmd) {
case 29:
{
- if (g_vars->scene18_var15) {
+ if (g_vars->scene18_enteredTrubaRight) {
cmd->_messageKind = 0;
+
break;
}
@@ -498,6 +744,7 @@ int sceneHandler18(ExCommand *cmd) {
if (!(g_fp->_aniMan->_flags & 0x100) && g_fp->_msgObjectId2 != g_vars->scene18_domino->_id) {
handleObjectInteraction(g_fp->_aniMan, g_vars->scene18_domino, cmd->_keyCode);
cmd->_messageKind = 0;
+
break;
}
}
@@ -507,7 +754,7 @@ int sceneHandler18(ExCommand *cmd) {
|| (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) {
g_fp->processArcade(cmd);
- g_vars->scene18_var28 = 0;
+ g_vars->scene18_manIsReady = false;
break;
}
@@ -520,27 +767,28 @@ int sceneHandler18(ExCommand *cmd) {
if (g_fp->_aniMan2) {
int x = g_fp->_aniMan2->_ox;
- g_vars->scene18_var11 = g_fp->_aniMan2->_oy;
+ g_vars->scene18_manY = g_fp->_aniMan2->_oy;
- if (x < g_fp->_sceneRect.left + g_vars->scene18_var16)
- g_fp->_currentScene->_x = x - g_vars->scene18_var18 - g_fp->_sceneRect.left;
+ if (x < g_fp->_sceneRect.left + 200)
+ g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left;
- if (x > g_fp->_sceneRect.right - g_vars->scene18_var16)
- g_fp->_currentScene->_x = x + g_vars->scene18_var18 - g_fp->_sceneRect.right;
+ if (x > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right;
}
- if (g_vars->scene18_var28 && g_fp->_aniMan->_movement)
- g_vars->scene18_var28 = 0;
+ if (g_vars->scene18_manIsReady && g_fp->_aniMan->_movement)
+ g_vars->scene18_manIsReady = false;
- if (g_vars->scene18_var08) {
- if (!g_vars->scene18_var12)
+ if (g_vars->scene18_bridgeIsConvoluted) {
+ if (!g_vars->scene18_wheelFlipper)
sceneHandler18and19_drawRiders();
- g_vars->scene18_var12 = g_vars->scene18_var12 == 0;
+ g_vars->scene18_wheelFlipper = !g_vars->scene18_wheelFlipper;
if (!g_vars->scene18_whirlgig->_movement) {
g_vars->scene18_whirlgig->startAnim(MV_WHR18_SPIN, 0, -1);
g_fp->_behaviorManager->updateBehaviors();
+
break;
}
} else {
@@ -548,6 +796,7 @@ int sceneHandler18(ExCommand *cmd) {
}
g_fp->_behaviorManager->updateBehaviors();
+
break;
}
@@ -560,8 +809,8 @@ void sceneHandler19_updateNumRides() {
if (numRides > 1) {
g_fp->setObjectState(sO_Girl, g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging));
- g_vars->scene18_var23 = 1;
- g_vars->scene18_var25++;
+ g_vars->scene18_kidIsOnWheel = 1;
+ g_vars->scene18_girlIsOnWheel++;
numRides = 0;
}
@@ -599,36 +848,36 @@ int sceneHandler19(ExCommand *cmd) {
break;
case 29:
- if (g_vars->scene18_var15) {
+ if (g_vars->scene18_enteredTrubaRight) {
switch (g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY)) {
case PIC_SC19_RTRUBA1:
- g_vars->scene18_var13 = 1;
- g_vars->scene18_var14 = 331;
+ g_vars->scene18_jumpDistance = 1;
+ g_vars->scene18_jumpAngle = 331;
cmd->_messageKind = 0;
break;
case PIC_SC19_RTRUBA2:
- g_vars->scene18_var13 = 2;
- g_vars->scene18_var14 = 350;
+ g_vars->scene18_jumpDistance = 2;
+ g_vars->scene18_jumpAngle = 350;
cmd->_messageKind = 0;
break;
case PIC_SC19_RTRUBA3:
- g_vars->scene18_var13 = 3;
- g_vars->scene18_var14 = 9;
+ g_vars->scene18_jumpDistance = 3;
+ g_vars->scene18_jumpAngle = 9;
cmd->_messageKind = 0;
break;
default:
- g_vars->scene18_var13 = -1;
- g_vars->scene18_var14 = -1;
+ g_vars->scene18_jumpDistance = -1;
+ g_vars->scene18_jumpAngle = -1;
cmd->_messageKind = 0;
break;
}
break;
}
- if (g_vars->scene19_var05) {
+ if (g_vars->scene19_enteredTruba3) {
if (g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY) == PIC_SC19_RTRUBA3) {
if (g_fp->_aniMan->isIdle()) {
if (!(g_fp->_aniMan->_flags & 0x100)) {
@@ -646,25 +895,26 @@ int sceneHandler19(ExCommand *cmd) {
if (g_fp->_aniMan2) {
int x = g_fp->_aniMan2->_ox;
- g_vars->scene18_var11 = g_fp->_aniMan2->_oy;
+ g_vars->scene18_manY = g_fp->_aniMan2->_oy;
- if (x < g_fp->_sceneRect.left + g_vars->scene18_var16)
- g_fp->_currentScene->_x = x - g_vars->scene18_var18 - g_fp->_sceneRect.left;
+ if (x < g_fp->_sceneRect.left + 200)
+ g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left;
- if (x > g_fp->_sceneRect.right - g_vars->scene18_var16)
- g_fp->_currentScene->_x = x + g_vars->scene18_var18 - g_fp->_sceneRect.right;
+ if (x > g_fp->_sceneRect.right - 200)
+ g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right;
}
- if (g_vars->scene18_var08) {
- if (!g_vars->scene18_var12)
+ if (g_vars->scene18_bridgeIsConvoluted) {
+ if (!g_vars->scene18_wheelFlipper)
sceneHandler18and19_drawRiders();
- g_vars->scene18_var12 = !g_vars->scene18_var12;
+ g_vars->scene18_wheelFlipper = !g_vars->scene18_wheelFlipper;
if (!g_vars->scene18_whirlgig->_movement) {
g_vars->scene18_whirlgig->startAnim(MV_WHR19_SPIN, 0, -1);
g_fp->_behaviorManager->updateBehaviors();
+
break;
}
} else {
@@ -672,6 +922,7 @@ int sceneHandler19(ExCommand *cmd) {
}
g_fp->_behaviorManager->updateBehaviors();
+
break;
}
diff --git a/engines/fullpipe/scenes/scene29.cpp b/engines/fullpipe/scenes/scene29.cpp
new file mode 100644
index 0000000000..2d5127137d
--- /dev/null
+++ b/engines/fullpipe/scenes/scene29.cpp
@@ -0,0 +1,1125 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * 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.
+ *
+ */
+
+#include "fullpipe/fullpipe.h"
+
+#include "fullpipe/objectnames.h"
+#include "fullpipe/constants.h"
+
+#include "fullpipe/gameloader.h"
+#include "fullpipe/motion.h"
+#include "fullpipe/scenes.h"
+#include "fullpipe/statics.h"
+
+#include "fullpipe/interaction.h"
+#include "fullpipe/behavior.h"
+
+
+namespace Fullpipe {
+
+struct WalkingBearder {
+ StaticANIObject *ani;
+ int wbflag;
+ int wbcounter;
+};
+
+void scene29_initScene(Scene *sc) {
+ g_vars->scene29_porter = sc->getStaticANIObject1ById(ANI_PORTER, -1);
+ g_vars->scene29_shooter1 = sc->getStaticANIObject1ById(ANI_SHOOTER1, -1);
+ g_vars->scene29_shooter2 = sc->getStaticANIObject1ById(ANI_SHOOTER2, -1);
+ g_vars->scene29_ass = sc->getStaticANIObject1ById(ANI_ASS, -1);
+
+ g_vars->scene29_balls.numBalls = 0;
+ g_vars->scene29_balls.pTail = 0;
+ g_vars->scene29_balls.field_8 = 0;
+ g_vars->scene29_balls.pHead = 0;
+
+ free(g_vars->scene29_balls.cPlex);
+ g_vars->scene29_balls.cPlex = 0;
+
+ StaticANIObject *ani;
+
+ g_vars->scene29_greenBalls.numBalls = 0;
+ g_vars->scene29_greenBalls.pTail = 0;
+ g_vars->scene29_greenBalls.field_8 = 0;
+ g_vars->scene29_greenBalls.pHead = 0;
+
+ free(g_vars->scene29_greenBalls.cPlex);
+ g_vars->scene29_greenBalls.cPlex = 0;
+
+ ani = sc->getStaticANIObject1ById(ANI_SHELL_GREEN, -1);
+ Ball *b = g_vars->scene29_balls.sub04(g_vars->scene29_balls.field_8, 0);
+ b->ani = ani;
+
+ if (g_vars->scene29_balls.field_8)
+ g_vars->scene29_balls.field_8->p0 = b;
+ else
+ g_vars->scene29_balls.pHead = b;
+
+ g_vars->scene29_balls.field_8 = b;
+
+ for (int i = 0; i < 2; i++) {
+ StaticANIObject *newani = new StaticANIObject(ani);
+
+ sc->addStaticANIObject(newani, 1);
+
+ b = g_vars->scene29_balls.sub04(g_vars->scene29_balls.field_8, 0);
+ b->ani = ani;
+
+ if (g_vars->scene29_balls.field_8)
+ g_vars->scene29_balls.field_8->p0 = b;
+ else
+ g_vars->scene29_balls.pHead = b;
+
+ g_vars->scene29_balls.field_8 = b;
+ }
+
+ g_vars->scene29_redBalls.numBalls = 0;
+ g_vars->scene29_redBalls.pTail = 0;
+ g_vars->scene29_redBalls.field_8 = 0;
+ g_vars->scene29_redBalls.pHead = 0;
+
+ free(g_vars->scene29_redBalls.cPlex);
+ g_vars->scene29_redBalls.cPlex = 0;
+
+ g_vars->scene29_flyingRedBalls.numBalls = 0;
+ g_vars->scene29_flyingRedBalls.pTail = 0;
+ g_vars->scene29_flyingRedBalls.field_8 = 0;
+ g_vars->scene29_flyingRedBalls.pHead = 0;
+
+ free(g_vars->scene29_flyingRedBalls.cPlex);
+ g_vars->scene29_flyingRedBalls.cPlex = 0;
+
+ ani = sc->getStaticANIObject1ById(ANI_SHELL_RED, -1);
+
+ b = g_vars->scene29_redBalls.sub04(g_vars->scene29_redBalls.field_8, 0);
+ b->ani = ani;
+
+ if (g_vars->scene29_redBalls.field_8)
+ g_vars->scene29_redBalls.field_8->p0 = b;
+ else
+ g_vars->scene29_redBalls.pHead = b;
+
+ g_vars->scene29_redBalls.field_8 = b;
+
+ for (int i = 0; i < 2; i++) {
+ StaticANIObject *newani = new StaticANIObject(ani);
+
+ sc->addStaticANIObject(newani, 1);
+
+ b = g_vars->scene29_redBalls.sub04(g_vars->scene29_redBalls.field_8, 0);
+ b->ani = ani;
+
+ if (g_vars->scene29_redBalls.field_8)
+ g_vars->scene29_redBalls.field_8->p0 = b;
+ else
+ g_vars->scene29_redBalls.pHead = b;
+
+ g_vars->scene29_redBalls.field_8 = b;
+ }
+
+ g_vars->scene29_bearders.clear();
+
+ ani = new StaticANIObject(g_fp->accessScene(SC_COMMON)->getStaticANIObject1ById(ANI_BEARDED_CMN, -1));
+
+ ani->_statics = ani->getStaticsById(ST_BRDCMN_EMPTY);
+
+ sc->addStaticANIObject(ani, 1);
+
+ WalkingBearder *wb = new WalkingBearder;
+
+ wb->ani = ani;
+ wb->wbflag = 0;
+ wb->wbcounter = 0;
+
+ g_vars->scene29_bearders.push_back(wb);
+
+ g_vars->scene29_manIsRiding = false;
+ g_vars->scene29_arcadeIsOn = false;
+ g_vars->scene29_reachedFarRight = false;
+ g_vars->scene29_rideBackEnabled = false;
+ g_vars->scene29_shootCountdown = 0;
+ g_vars->scene29_shootDistance = 75;
+ g_vars->scene29_manIsHit = false;
+ g_vars->scene29_scrollSpeed = 0;
+ g_vars->scene29_scrollingDisabled = false;
+ g_vars->scene29_hitBall = 0;
+
+ g_fp->setArcadeOverlay(PIC_CSR_ARCADE8);
+}
+
+void sceneHandler29_winArcade() {
+ if (g_vars->scene29_shooter2->_flags & 4) {
+ g_vars->scene29_shootCountdown = 0;
+
+ g_vars->scene29_shooter1->changeStatics2(ST_STR1_STAND);
+ g_vars->scene29_shooter2->changeStatics2(ST_STR2_STAND);
+
+ g_vars->scene29_shooter2->_flags &= 0xFFFB;
+
+ StaticANIObject *ani;
+ Ball *newball, *ball, *oldp0;
+
+ while (g_vars->scene29_greenBalls.numBalls) {
+ ball = g_vars->scene29_greenBalls.pHead;
+ ani = g_vars->scene29_greenBalls.pHead->ani;
+ oldp0 = g_vars->scene29_greenBalls.pHead->p0;
+ g_vars->scene29_greenBalls.pHead = g_vars->scene29_greenBalls.pHead->p0;
+
+ if (g_vars->scene29_greenBalls.pHead)
+ oldp0->p1 = 0;
+ else
+ g_vars->scene29_greenBalls.field_8 = 0;
+
+ ball->p0 = g_vars->scene29_greenBalls.pTail;
+ g_vars->scene29_greenBalls.pTail = ball;
+ g_vars->scene29_greenBalls.numBalls--;
+
+ if (!g_vars->scene29_greenBalls.numBalls)
+ g_vars->scene29_greenBalls.reset();
+
+ ani->hide();
+
+ newball = g_vars->scene29_balls.sub04(g_vars->scene29_balls.field_8, 0);
+ newball->ani = ani;
+
+ if (g_vars->scene29_balls.field_8)
+ g_vars->scene29_balls.field_8->p0 = newball;
+ else
+ g_vars->scene29_balls.pHead = newball;
+
+ g_vars->scene29_balls.field_8 = newball;
+ }
+
+ while (g_vars->scene29_flyingRedBalls.numBalls) {
+ ball = g_vars->scene29_flyingRedBalls.pHead;
+ ani = g_vars->scene29_flyingRedBalls.pHead->ani;
+ oldp0 = g_vars->scene29_flyingRedBalls.pHead->p0;
+ g_vars->scene29_flyingRedBalls.pHead = g_vars->scene29_flyingRedBalls.pHead->p0;
+
+ if (g_vars->scene29_flyingRedBalls.pHead)
+ oldp0->p1 = 0;
+ else
+ g_vars->scene29_flyingRedBalls.field_8 = 0;
+
+ ball->p0 = g_vars->scene29_flyingRedBalls.pTail;
+ g_vars->scene29_flyingRedBalls.pTail = ball;
+ g_vars->scene29_flyingRedBalls.numBalls--;
+
+ if (!g_vars->scene29_flyingRedBalls.numBalls) {
+ g_vars->scene29_flyingRedBalls.numBalls = 0;
+ g_vars->scene29_flyingRedBalls.pTail = 0;
+ g_vars->scene29_flyingRedBalls.field_8 = 0;
+ g_vars->scene29_flyingRedBalls.pHead = 0;
+
+ free(g_vars->scene29_flyingRedBalls.cPlex);
+
+ g_vars->scene29_flyingRedBalls.cPlex = 0;
+ }
+
+ ani->hide();
+
+ newball = g_vars->scene29_redBalls.sub04(g_vars->scene29_redBalls.field_8, 0);
+ newball->ani = ani;
+
+ if (g_vars->scene29_redBalls.field_8)
+ g_vars->scene29_redBalls.field_8->p0 = newball;
+ else
+ g_vars->scene29_redBalls.pHead = newball;
+
+ g_vars->scene29_redBalls.field_8 = newball;
+ }
+
+ g_vars->scene29_ass->queueMessageQueue(0);
+ g_vars->scene29_ass->_flags &= 0xFFFB;
+
+ chainQueue(QU_SC29_ESCAPE, 1);
+ }
+
+ g_fp->setObjectState(sO_LeftPipe_29, g_fp->getObjectEnumState(sO_LeftPipe_29, sO_IsOpened));
+}
+
+void sceneHandler29_shootGreen() {
+ if (g_vars->scene29_balls.numBalls) {
+ int x = g_vars->scene29_shooter1->_ox - 113;
+ int y = g_vars->scene29_shooter1->_oy - 48;
+ StaticANIObject *ani = g_vars->scene29_balls.pHead->ani;
+ Ball *oldhead = g_vars->scene29_balls.pHead;
+ Ball *oldp0 = g_vars->scene29_balls.pHead->p0;
+
+ g_vars->scene29_balls.pHead = g_vars->scene29_balls.pHead->p0;
+
+ if (g_vars->scene29_balls.pHead)
+ oldp0->p1 = 0;
+ else
+ g_vars->scene29_balls.field_8 = 0;
+
+ oldhead->p0 = g_vars->scene29_balls.pTail;
+
+ g_vars->scene29_balls.pTail = oldhead;
+ g_vars->scene29_balls.numBalls--;
+
+ if (!g_vars->scene29_balls.numBalls) {
+ g_vars->scene29_balls.numBalls = 0;
+ g_vars->scene29_balls.pTail = 0;
+ g_vars->scene29_balls.field_8 = 0;
+ g_vars->scene29_balls.pHead = 0;
+
+ free(g_vars->scene29_balls.cPlex);
+ g_vars->scene29_balls.cPlex = 0;
+ }
+
+ ani->show1(x, y, MV_SHG_NORM, 0);
+ ani->_priority = 5;
+
+ Ball *runPtr = g_vars->scene29_greenBalls.pTail;
+ Ball *lastP = g_vars->scene29_greenBalls.field_8;
+
+ if (!g_vars->scene29_greenBalls.pTail) {
+ g_vars->scene29_greenBalls.cPlex = (byte *)calloc(g_vars->scene29_greenBalls.cPlexLen, sizeof(Ball));
+
+ byte *p1 = g_vars->scene29_greenBalls.cPlex + (g_vars->scene29_greenBalls.cPlexLen - 1) * sizeof(Ball);
+
+ if (g_vars->scene29_greenBalls.cPlexLen - 1 < 0) {
+ runPtr = g_vars->scene29_greenBalls.pTail;
+ } else {
+ runPtr = g_vars->scene29_greenBalls.pTail;
+
+ for (int j = 0; j < g_vars->scene29_greenBalls.cPlexLen; j++) {
+ ((Ball *)p1)->p1 = runPtr;
+ runPtr = (Ball *)p1;
+
+ p1 -= sizeof(Ball);
+ }
+
+ g_vars->scene29_greenBalls.pTail = runPtr;
+ }
+ }
+ g_vars->scene29_greenBalls.pTail = runPtr->p0;
+ runPtr->p1 = lastP;
+ runPtr->p0 = 0;
+ runPtr->ani = ani;
+
+ g_vars->scene29_greenBalls.numBalls++;
+
+ if (g_vars->scene29_greenBalls.field_8) {
+ g_vars->scene29_greenBalls.field_8->p0 = runPtr;
+ g_vars->scene29_greenBalls.field_8 = runPtr;
+ } else {
+ g_vars->scene29_greenBalls.pHead = runPtr;
+ g_vars->scene29_greenBalls.field_8 = runPtr;
+ }
+ }
+}
+
+void sceneHandler29_shootRed() {
+ if (g_vars->scene29_balls.numBalls) {
+ int x = g_vars->scene29_shooter1->_ox - 101;
+ int y = g_vars->scene29_shooter1->_oy - 14;
+ StaticANIObject *ani = g_vars->scene29_balls.pHead->ani;
+ Ball *oldhead = g_vars->scene29_balls.pHead;
+ Ball *oldp0 = g_vars->scene29_balls.pHead->p0;
+
+ g_vars->scene29_balls.pHead = g_vars->scene29_balls.pHead->p0;
+
+ if (g_vars->scene29_balls.pHead)
+ oldp0->p1 = 0;
+ else
+ g_vars->scene29_balls.field_8 = 0;
+
+ oldhead->p0 = g_vars->scene29_balls.pTail;
+
+ g_vars->scene29_balls.pTail = oldhead;
+ g_vars->scene29_balls.numBalls--;
+
+ if (!g_vars->scene29_balls.numBalls) {
+ g_vars->scene29_balls.numBalls = 0;
+ g_vars->scene29_balls.pTail = 0;
+ g_vars->scene29_balls.field_8 = 0;
+ g_vars->scene29_balls.pHead = 0;
+
+ free(g_vars->scene29_balls.cPlex);
+ g_vars->scene29_balls.cPlex = 0;
+ }
+
+ ani->show1(x, y, MV_SHR_NORM, 0);
+ ani->_priority = 5;
+
+ Ball *runPtr = g_vars->scene29_flyingRedBalls.pTail;
+ Ball *lastP = g_vars->scene29_flyingRedBalls.field_8;
+
+ if (!g_vars->scene29_flyingRedBalls.pTail) {
+ g_vars->scene29_flyingRedBalls.cPlex = (byte *)calloc(g_vars->scene29_flyingRedBalls.cPlexLen, sizeof(Ball));
+
+ byte *p1 = g_vars->scene29_flyingRedBalls.cPlex + (g_vars->scene29_flyingRedBalls.cPlexLen - 1) * sizeof(Ball);
+
+ if (g_vars->scene29_flyingRedBalls.cPlexLen - 1 < 0) {
+ runPtr = g_vars->scene29_flyingRedBalls.pTail;
+ } else {
+ runPtr = g_vars->scene29_flyingRedBalls.pTail;
+
+ for (int j = 0; j < g_vars->scene29_flyingRedBalls.cPlexLen; j++) {
+ ((Ball *)p1)->p1 = runPtr;
+ runPtr = (Ball *)p1;
+
+ p1 -= sizeof(Ball);
+ }
+
+ g_vars->scene29_flyingRedBalls.pTail = runPtr;
+ }
+ }
+ g_vars->scene29_flyingRedBalls.pTail = runPtr->p0;
+ runPtr->p1 = lastP;
+ runPtr->p0 = 0;
+ runPtr->ani = ani;
+
+ g_vars->scene29_flyingRedBalls.numBalls++;
+
+ if (g_vars->scene29_flyingRedBalls.field_8) {
+ g_vars->scene29_flyingRedBalls.field_8->p0 = runPtr;
+ g_vars->scene29_flyingRedBalls.field_8 = runPtr;
+ } else {
+ g_vars->scene29_flyingRedBalls.pHead = runPtr;
+ g_vars->scene29_flyingRedBalls.field_8 = runPtr;
+ }
+ }
+}
+
+void sceneHandler29_manJump() {
+ if (!g_fp->_aniMan->_movement || g_fp->_aniMan->_movement->_id == MV_MAN29_RUN || g_fp->_aniMan->_movement->_id == MV_MAN29_STANDUP) {
+ g_vars->scene29_rideBackEnabled = false;
+ g_vars->scene29_manIsHit = false;
+ g_vars->scene29_reachedFarRight = true;
+
+ g_fp->_aniMan->changeStatics2(ST_MAN29_RUNR);
+ g_fp->_aniMan->startAnim(MV_MAN29_JUMP, 0, -1);
+ }
+
+ g_vars->scene29_manX = g_fp->_aniMan->_ox;
+ g_vars->scene29_manY = g_fp->_aniMan->_oy;
+}
+
+void sceneHandler29_manBend() {
+ if (!g_fp->_aniMan->_movement || g_fp->_aniMan->_movement->_id == MV_MAN29_RUN || g_fp->_aniMan->_movement->_id == MV_MAN29_STANDUP) {
+ g_vars->scene29_rideBackEnabled = false;
+ g_vars->scene29_manIsHit = false;
+ g_vars->scene29_reachedFarRight = true;
+
+ g_fp->_aniMan->changeStatics2(ST_MAN29_RUNR);
+ g_fp->_aniMan->startAnim(MV_MAN29_BEND, 0, -1);
+ }
+
+ g_vars->scene29_manX = g_fp->_aniMan->_ox;
+ g_vars->scene29_manY = g_fp->_aniMan->_oy;
+}
+
+bool sceneHandler29_checkRedBallHit(StaticANIObject *ani, int maxx) {
+ if (!g_vars->scene29_arcadeIsOn || g_vars->scene29_manIsHit)
+ return false;
+
+ if ((ani->_ox >= g_vars->scene29_manX + 42 || ani->_ox <= g_vars->scene29_manX + 8)
+ && (ani->_ox < g_vars->scene29_manX + 8 || maxx > g_vars->scene29_manX + 27))
+ return false;
+
+ if (!g_fp->_aniMan->_movement)
+ return true;
+
+ int phase = g_fp->_aniMan->_movement->_currDynamicPhaseIndex;
+
+ if (g_fp->_aniMan->_movement->_id != MV_MAN29_BEND && g_fp->_aniMan->_movement->_id != MV_MAN29_RUN
+ && (g_fp->_aniMan->_movement->_id != MV_MAN29_JUMP || (phase >= 3 && phase <= 6)))
+ return false;
+ else
+ return true;
+}
+
+bool sceneHandler29_checkGreenBallHit(StaticANIObject *ani, int maxx) {
+ if (!g_vars->scene29_arcadeIsOn || g_vars->scene29_manIsHit)
+ return false;
+
+ if (ani->_ox >= g_vars->scene29_manX + 40) {
+ if (maxx > g_vars->scene29_manX + 27)
+ return false;
+ } else {
+ if (ani->_ox <= g_vars->scene29_manX + 10) {
+ if (ani->_ox < g_vars->scene29_manX + 40)
+ return false;
+
+ if (maxx > g_vars->scene29_manX + 27)
+ return false;
+ }
+ }
+
+ if (!g_fp->_aniMan->_movement)
+ return true;
+
+ if (g_fp->_aniMan->_movement->_id == MV_MAN29_JUMP)
+ return true;
+
+ if (g_fp->_aniMan->_movement->_id == MV_MAN29_RUN)
+ return true;
+
+ if (g_fp->_aniMan->_movement->_id == MV_MAN29_BEND) {
+ if (g_fp->_aniMan->_movement->_currDynamicPhaseIndex < 1 || g_fp->_aniMan->_movement->_currDynamicPhaseIndex > 5)
+ return true;
+ }
+
+ return false;
+}
+
+void sceneHandler29_manHit() {
+ MGMInfo mgminfo;
+
+ g_vars->scene29_manIsHit = true;
+
+ g_fp->_aniMan->changeStatics2(ST_MAN29_RUNR);
+ g_fp->_aniMan->setOXY(g_vars->scene29_manX, g_vars->scene29_manY);
+
+ mgminfo.ani = g_fp->_aniMan;
+ mgminfo.staticsId2 = ST_MAN29_SITR;
+ mgminfo.y1 = 463;
+ mgminfo.x1 = g_vars->scene29_manX <= 638 ? 351 : 0;
+ mgminfo.field_1C = 10;
+ mgminfo.field_10 = 1;
+ mgminfo.flags = (g_vars->scene29_manX <= 638 ? 2 : 0) | 0x44;
+ mgminfo.movementId = MV_MAN29_HIT;
+
+ MessageQueue *mq = g_vars->scene29_mgm.genMovement(&mgminfo);
+ ExCommand *ex;
+
+ if (mq) {
+ if (g_vars->scene29_manX <= 638) {
+ ex = new ExCommand(ANI_MAN, 1, MV_MAN29_STANDUP_NORM, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags = 2;
+ ex->_keyCode = g_fp->_aniMan->_okeyCode;
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(0, 17, MSG_SC29_STOPRIDE, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags = 2;
+ mq->addExCommandToEnd(ex);
+
+ g_vars->scene29_manIsRiding = false;
+ g_vars->scene29_arcadeIsOn = false;
+ g_vars->scene29_reachedFarRight = false;
+ g_vars->scene29_rideBackEnabled = false;
+ } else {
+ ex = new ExCommand(ANI_MAN, 1, MV_MAN29_STANDUP, 0, 0, 0, 1, 0, 0, 0);
+ ex->_excFlags = 2;
+ ex->_keyCode = g_fp->_aniMan->_okeyCode;
+ mq->addExCommandToEnd(ex);
+ }
+
+ mq->setFlags(mq->getFlags() | 1);
+
+ if (!mq->chain(g_fp->_aniMan))
+ delete mq;
+ }
+}
+
+void sceneHandler29_assHitRed() {
+ if (g_vars->scene29_ass->_statics->_staticsId == ST_ASS_NORM) {
+ g_vars->scene29_ass->changeStatics2(ST_ASS_NORM);
+ g_vars->scene29_ass->startAnim(MV_ASS_HITRED, 0, -1);
+ }
+}
+
+void sceneHandler29_assHitGreen() {
+ if (g_vars->scene29_ass->_statics->_staticsId == ST_ASS_NORM) {
+ g_vars->scene29_ass->changeStatics2(ST_ASS_NORM);
+ g_vars->scene29_ass->startAnim(MV_ASS_HITGREEN, 0, -1);
+ }
+}
+
+void sceneHandler29_ballHitCheck() {
+ Ball *ball = g_vars->scene29_greenBalls.pHead;
+ Ball *newball;
+ int x, y;
+
+ while (ball) {
+ x = ball->ani->_ox - 30;
+ y = ball->ani->_oy;
+
+ if (x >= 186) {
+ if (sceneHandler29_checkGreenBallHit(ball->ani, x)) {
+ newball = g_vars->scene29_balls.sub04(g_vars->scene29_balls.field_8, 0);
+ newball->ani = ball->ani;
+
+ if (g_vars->scene29_balls.field_8)
+ g_vars->scene29_balls.field_8->p0 = newball;
+ else
+ g_vars->scene29_balls.pHead = newball;
+
+ g_vars->scene29_balls.field_8 = newball;
+
+ if (ball == g_vars->scene29_greenBalls.pHead)
+ g_vars->scene29_greenBalls.pHead = ball->p0;
+ else
+ ball->p1->p0 = ball->p0;
+
+ if (ball == g_vars->scene29_greenBalls.field_8)
+ g_vars->scene29_greenBalls.field_8 = ball->p1;
+ else
+ ball->p0->p1 = ball->p1;
+
+ g_vars->scene29_greenBalls.init(&ball);
+
+ sceneHandler29_manHit();
+
+ g_fp->playSound(SND_29_014, 0);
+
+ ball->ani->startAnim(MV_SHG_HITMAN, 0, -1);
+
+ g_vars->scene29_hitBall = ball->ani->_id;
+ } else {
+ ball->ani->setOXY(x, y);
+ }
+ } else {
+ newball = g_vars->scene29_balls.sub04(g_vars->scene29_balls.field_8, 0);
+ newball->ani = ball->ani;
+
+ if (g_vars->scene29_balls.field_8)
+ g_vars->scene29_balls.field_8->p0 = newball;
+ else
+ g_vars->scene29_balls.pHead = newball;
+
+ g_vars->scene29_balls.field_8 = newball;
+
+ ball->ani->hide();
+
+ if (ball == g_vars->scene29_greenBalls.pHead)
+ g_vars->scene29_greenBalls.pHead = ball->p0;
+ else
+ ball->p1->p0 = ball->p0;
+
+ if (ball == g_vars->scene29_greenBalls.field_8)
+ g_vars->scene29_greenBalls.field_8 = ball->p1;
+ else
+ ball->p0->p1 = ball->p1;
+
+ g_vars->scene29_greenBalls.init(&ball);
+
+ sceneHandler29_assHitGreen();
+ }
+
+ ball = ball->p0;
+ }
+
+ ball = g_vars->scene29_flyingRedBalls.pHead;
+
+ while (ball) {
+ x = ball->ani->_ox - 30;
+ y = ball->ani->_oy;
+
+ if (x >= 147) {
+ if (sceneHandler29_checkRedBallHit(ball->ani, x)) {
+ newball = g_vars->scene29_redBalls.sub04(g_vars->scene29_redBalls.field_8, 0);
+ newball->ani = ball->ani;
+
+ if (g_vars->scene29_redBalls.field_8)
+ g_vars->scene29_redBalls.field_8->p0 = newball;
+ else
+ g_vars->scene29_redBalls.pHead = newball;
+
+ g_vars->scene29_redBalls.field_8 = newball;
+
+ g_vars->scene29_flyingRedBalls.removeBall(ball);
+
+ sceneHandler29_manHit();
+
+ g_fp->playSound(SND_29_027, 0);
+
+ ball->ani->startAnim(MV_SHR_HITMAN, 0, -1);
+
+ g_vars->scene29_hitBall = ball->ani->_id;
+ } else {
+ ball->ani->setOXY(x, y);
+ }
+ } else {
+ newball = g_vars->scene29_redBalls.sub04(g_vars->scene29_redBalls.field_8, 0);
+ newball->ani = ball->ani;
+
+ if (g_vars->scene29_redBalls.field_8)
+ g_vars->scene29_redBalls.field_8->p0 = newball;
+ else
+ g_vars->scene29_redBalls.pHead = newball;
+
+ g_vars->scene29_redBalls.field_8 = newball;
+
+ ball->ani->hide();
+
+ if (ball == g_vars->scene29_flyingRedBalls.pHead)
+ g_vars->scene29_flyingRedBalls.pHead = ball->p0;
+ else
+ ball->p1->p0 = ball->p0;
+
+ if (ball == g_vars->scene29_flyingRedBalls.field_8)
+ g_vars->scene29_flyingRedBalls.field_8 = ball->p1;
+ else
+ ball->p0->p1 = ball->p1;
+
+ g_vars->scene29_flyingRedBalls.init(&ball);
+
+ sceneHandler29_assHitRed();
+ }
+
+ ball = ball->p0;
+ }
+}
+
+void sceneHandler29_manFromL() {
+ if (g_vars->scene29_manX < 497 && !g_vars->scene29_scrollingDisabled) {
+ getCurrSceneSc2MotionController()->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
+
+ g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
+ chainQueue(QU_SC29_MANFROM_L, 1);
+
+ g_vars->scene29_scrollingDisabled = true;
+
+ g_fp->_scrollSpeed = g_vars->scene29_scrollSpeed;
+ }
+}
+
+void sceneHandler29_manFromR() {
+ getCurrSceneSc2MotionController()->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
+
+ chainQueue(QU_SC29_MANFROM_R, 1);
+
+ g_vars->scene29_arcadeIsOn = false;
+ g_vars->scene29_rideBackEnabled = false;
+}
+
+int sceneHandler29_updateScreenCallback() {
+ int res;
+
+ res = g_fp->drawArcadeOverlay(g_vars->scene29_arcadeIsOn);
+
+ if (!res)
+ g_fp->_updateScreenCallback = 0;
+
+ return res;
+}
+
+void sceneHandler29_manToL() {
+ getCurrSceneSc2MotionController()->clearEnabled();
+ getGameLoaderInteractionController()->disableFlag24();
+
+ chainQueue(QU_SC29_MANTO_L, 1);
+
+ g_vars->scene29_arcadeIsOn = true;
+
+ g_vars->scene29_mgm.addItem(g_fp->_aniMan->_id);
+
+ g_fp->_updateScreenCallback = sceneHandler29_updateScreenCallback;
+
+ g_fp->_msgY = -1;
+ g_fp->_msgX = -1;
+}
+
+void sceneHandler29_manToR() {
+ getCurrSceneSc2MotionController()->clearEnabled();
+ getGameLoaderInteractionController()->disableFlag24();
+
+ chainQueue(QU_SC29_MANTO_R, 1);
+
+ g_vars->scene29_manIsRiding = true;
+ g_fp->_msgY = -1;
+ g_fp->_msgX = -1;
+
+ g_vars->scene29_scrollingDisabled = false;
+
+ g_vars->scene29_scrollSpeed = g_fp->_scrollSpeed;
+ g_fp->_scrollSpeed = 4;
+}
+
+void sceneHandler29_clickPorter(ExCommand *cmd) {
+ if (!g_fp->_aniMan->isIdle() || g_fp->_aniMan->_flags & 0x100) {
+ cmd->_messageKind = 0;
+
+ return;
+ }
+
+ if (g_vars->scene29_manX <= g_vars->scene29_porter->_ox) {
+ if (ABS(351 - g_vars->scene29_manX) > 1 || ABS(443 - g_vars->scene29_manY) > 1
+ || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
+ if (g_fp->_msgX != 351 || g_fp->_msgY != 443) {
+ MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 351, 443, 1, ST_MAN_RIGHT);
+
+ if (mq) {
+ mq->addExCommandToEnd(cmd->createClone());
+
+ postExCommand(g_fp->_aniMan->_id, 2, 351, 443, 0, -1);
+ }
+ }
+ } else {
+ sceneHandler29_manToL();
+ }
+ } else {
+ g_vars->scene29_manX = g_fp->_aniMan->_ox;
+ g_vars->scene29_manY = g_fp->_aniMan->_oy;
+
+ if (ABS(1582 - g_vars->scene29_manX) > 1 || ABS(445 - g_fp->_aniMan->_oy) > 1
+ || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != (0x4000 | ST_MAN_RIGHT)) {
+ if (g_fp->_msgX != 1582 || g_fp->_msgY != 445) {
+ MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1582, 445, 1, (0x4000 | ST_MAN_RIGHT));
+
+ if (mq) {
+ mq->addExCommandToEnd(cmd->createClone());
+
+ postExCommand(g_fp->_aniMan->_id, 2, 1582, 445, 0, -1);
+ }
+ }
+ } else {
+ sceneHandler29_manToR();
+ }
+ }
+}
+
+void sceneHandler29_shootersProcess() {
+ if (g_fp->_aniMan->_statics->_staticsId == ST_MAN29_RUNR) {
+ if (g_vars->scene29_manX > 1436) {
+ sceneHandler29_manFromR();
+ } else {
+ g_vars->scene29_shootDistance = (1310 - g_vars->scene29_manX) * 5213 / 100000 + 25;
+
+ if (!g_vars->scene29_manIsHit)
+ g_fp->_aniMan->startAnim(MV_MAN29_RUN, 0, -1);
+ }
+ }
+
+ g_vars->scene29_manX = g_fp->_aniMan->_ox;
+ g_vars->scene29_manY = g_fp->_aniMan->_oy;
+}
+
+void sceneHandler29_shootersEscape() {
+ if (g_vars->scene29_arcadeIsOn) {
+ g_vars->scene29_manX += 2;
+
+ g_fp->_aniMan->setOXY(g_vars->scene29_manX, g_vars->scene29_manY);
+
+ if (g_vars->scene29_manX > 1310 && !g_vars->scene29_shooter1->_movement && !g_vars->scene29_shooter2->_movement
+ && g_vars->scene29_shooter1->_statics->_staticsId == ST_STR1_RIGHT) {
+ g_vars->scene29_shootCountdown = 0;
+
+ g_vars->scene29_shooter1->changeStatics2(ST_STR1_STAND);
+ g_vars->scene29_shooter2->changeStatics2(ST_STR2_STAND);
+
+ chainQueue(QU_SC29_ESCAPE, 1);
+
+ g_vars->scene29_ass->queueMessageQueue(0);
+ g_vars->scene29_ass->hide();
+
+ g_fp->setObjectState(sO_LeftPipe_29, g_fp->getObjectEnumState(sO_LeftPipe_29, sO_IsOpened));
+ }
+ } else if (g_vars->scene29_manIsRiding) {
+ g_vars->scene29_manX -= 4;
+
+ g_fp->_aniMan->setOXY(g_vars->scene29_manX, g_vars->scene29_manY);
+ }
+}
+
+void sceneHandler29_manRideBack() {
+ g_vars->scene29_manX -= 2;
+
+ g_fp->_aniMan->setOXY(g_vars->scene29_manX, g_vars->scene29_manY);
+}
+
+void sceneHandler29_shoot() {
+ if (g_vars->scene29_arcadeIsOn && g_vars->scene29_manX < 1310) {
+ if (g_fp->_rnd->getRandomNumber(1) || g_vars->scene29_shooter1->_movement || g_vars->scene29_shooter1->_statics->_staticsId != ST_STR1_RIGHT) {
+ if (!g_vars->scene29_shooter2->_movement && g_vars->scene29_shooter2->_statics->_staticsId == ST_STR2_RIGHT) {
+ if (g_vars->scene29_shooter2->_flags & 4) {
+ g_vars->scene29_shooter2->startAnim(MV_STR2_SHOOT, 0, -1);
+
+ g_vars->scene29_shootCountdown = 0;
+ }
+ }
+ } else {
+ g_vars->scene29_shooter1->startAnim(MV_STR1_SHOOT, 0, -1);
+
+ g_vars->scene29_shootCountdown = 0;
+ }
+ }
+}
+
+void sceneHandler29_animBearded() {
+ MessageQueue *mq;
+
+ for (uint i = 0; i < g_vars->scene29_bearders.size(); i++) {
+ StaticANIObject *ani = g_vars->scene29_bearders[i]->ani;
+
+ if (g_vars->scene29_bearders[i]->wbflag) {
+ int x = ani->_ox;
+ int y = ani->_oy;
+
+ if (!ani->_movement && ani->_statics->_staticsId == (ST_BRDCMN_RIGHT | 0x4000)) {
+ x -= 4;
+
+ if (x - g_vars->scene29_manX < 100 || !g_vars->scene29_arcadeIsOn) {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC29_BRDOUT1), 0, 1);
+
+ mq->replaceKeyCode(-1, ani->_okeyCode);
+ mq->chain(0);
+
+ g_vars->scene29_bearders[i]->wbflag = 0;
+ g_vars->scene29_bearders[i]->wbcounter = 0;
+ }
+ }
+
+ if (!ani->_movement && ani->_statics->_staticsId == ST_BRDCMN_GOR)
+ ani->startAnim(MV_BRDCMN_GOR, 0, -1);
+
+ if (ani->_movement) {
+ if (ani->_movement->_id == MV_BRDCMN_GOR) {
+ x -= 4;
+
+ if (g_vars->scene29_manX - x < 60 || x - g_vars->scene29_manX < -260 || !g_vars->scene29_arcadeIsOn) {
+ ani->changeStatics2(ST_BRDCMN_RIGHT);
+
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC29_BRDOUT2), 0, 1);
+
+ mq->replaceKeyCode(-1, ani->_okeyCode);
+ mq->chain(0);
+
+ g_vars->scene29_bearders[i]->wbflag = 0;
+ g_vars->scene29_bearders[i]->wbcounter = 0;
+ }
+ }
+ }
+
+ ani->setOXY(x, y);
+ continue;
+ }
+
+ if (g_vars->scene29_arcadeIsOn && g_vars->scene29_bearders[i]->wbcounter > 30) {
+ int newx;
+
+ if (g_fp->_rnd->getRandomNumber(1))
+ goto dostuff;
+
+ if (g_vars->scene29_manX <= 700) {
+ g_vars->scene29_bearders[i]->wbcounter++;
+ continue;
+ }
+
+ if (g_vars->scene29_manX >= 1100) {
+ dostuff:
+ if (g_vars->scene29_manX <= 700 || g_vars->scene29_manX >= 1350) {
+ g_vars->scene29_bearders[i]->wbcounter++;
+ continue;
+ }
+
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC29_BRD2), 0, 1);
+
+ newx = g_vars->scene29_manX - 200;
+ } else {
+ mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC29_BRD1), 0, 1);
+
+ newx = g_vars->scene29_manX + 350;
+ }
+
+ mq->getExCommandByIndex(0)->_x = newx;
+ mq->replaceKeyCode(-1, ani->_okeyCode);
+ mq->chain(0);
+
+ g_vars->scene29_bearders[i]->wbflag = 1;
+ g_vars->scene29_bearders[i]->wbcounter = 0;
+ }
+
+ g_vars->scene29_bearders[i]->wbcounter++;
+ }
+}
+
+
+
+int sceneHandler29(ExCommand *cmd) {
+ if (cmd->_messageKind != 17)
+ return 0;
+
+ switch (cmd->_messageNum) {
+ case MSG_CMN_WINARCADE:
+ sceneHandler29_winArcade();
+ break;
+
+ case MSG_SC29_LAUGH:
+ if (g_vars->scene29_hitBall == ANI_SHELL_GREEN) {
+ g_fp->playSound(SND_29_028, 0);
+ break;
+ }
+
+ g_fp->playSound(SND_29_029, 0);
+
+ break;
+
+ case MSG_SC29_SHOWLASTRED:
+ if (g_vars->scene29_balls.numBalls) {
+ g_vars->scene29_redBalls.field_8->ani->show1(-1, -1, -1, 0);
+ g_vars->scene29_redBalls.field_8->ani->startAnim(MV_SHR_HITASS, 0, -1);
+ }
+
+ break;
+
+ case MSG_SC29_SHOOTGREEN:
+ sceneHandler29_shootGreen();
+ break;
+
+ case MSG_SC29_SHOOTRED:
+ sceneHandler29_shootRed();
+ break;
+
+ case MSG_SC29_SHOWLASTGREEN:
+ if (g_vars->scene29_balls.numBalls) {
+ g_vars->scene29_balls.field_8->ani->show1(-1, -1, -1, 0);
+ g_vars->scene29_balls.field_8->ani->startAnim(MV_SHG_HITASS, 0, -1);
+ }
+
+ break;
+
+ case MSG_SC29_STOPRIDE:
+ g_vars->scene29_manIsRiding = false;
+ g_vars->scene29_arcadeIsOn = false;
+ g_vars->scene29_reachedFarRight = false;
+ g_vars->scene29_rideBackEnabled = false;
+
+ getCurrSceneSc2MotionController()->setEnabled();
+ getGameLoaderInteractionController()->enableFlag24();
+ break;
+
+ case MSG_SC29_DISABLERIDEBACK:
+ g_vars->scene29_rideBackEnabled = false;
+ break;
+
+ case MSG_SC29_ENABLERIDEBACK:
+ g_vars->scene29_rideBackEnabled = true;
+ g_vars->scene29_reachedFarRight = false;
+ break;
+
+ case MSG_SC29_DISABLEPORTER:
+ g_vars->scene29_reachedFarRight = false;
+ break;
+
+ case MSG_SC29_ENABLEPORTER:
+ g_vars->scene29_reachedFarRight = true;
+ g_vars->scene29_rideBackEnabled = false;
+ g_vars->scene29_manIsHit = false;
+ break;
+
+ case 29:
+ if (!g_vars->scene29_manIsRiding || g_vars->scene29_arcadeIsOn) {
+ if (!g_vars->scene29_arcadeIsOn) {
+ StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y);
+
+ if (ani && ani == g_vars->scene29_porter) {
+ sceneHandler29_clickPorter(cmd);
+
+ cmd->_messageKind = 0;
+ break;
+ }
+ break;
+ }
+
+ sceneHandler29_manJump();
+
+ cmd->_messageKind = 0;
+ break;
+ }
+ break;
+
+ case 107:
+ if (g_vars->scene29_arcadeIsOn)
+ sceneHandler29_manBend();
+
+ break;
+
+ case 33:
+ if (g_vars->scene29_arcadeIsOn) {
+ if (g_vars->scene29_manX > g_fp->_sceneRect.right - 500)
+ g_fp->_currentScene->_x = g_fp->_sceneRect.right - g_vars->scene29_manX - 350;
+
+ if (g_vars->scene29_manX < g_fp->_sceneRect.left + 100)
+ g_fp->_currentScene->_x = g_vars->scene29_manX - g_fp->_sceneRect.left - 100;
+
+ } else if (g_fp->_aniMan2) {
+ int x = g_fp->_aniMan2->_ox;
+
+ if (x < g_fp->_sceneRect.left + 300)
+ g_fp->_currentScene->_x = x - 400 - g_fp->_sceneRect.left;
+
+ if (x > g_fp->_sceneRect.right - 300)
+ g_fp->_currentScene->_x = x + 400 - g_fp->_sceneRect.right;
+ }
+
+ g_vars->scene29_manX = g_fp->_aniMan->_ox;
+ g_vars->scene29_manY = g_fp->_aniMan->_oy;
+
+ sceneHandler29_ballHitCheck();
+
+ if (!g_vars->scene29_porter->_movement)
+ g_vars->scene29_porter->startAnim(MV_PTR_MOVEFAST, 0, -1);
+
+ if (g_vars->scene29_manIsRiding)
+ sceneHandler29_manFromL();
+ else if (g_vars->scene29_arcadeIsOn && !g_fp->_aniMan->_movement)
+ sceneHandler29_shootersProcess();
+
+ if (g_vars->scene29_reachedFarRight)
+ sceneHandler29_shootersEscape();
+ else if (g_vars->scene29_rideBackEnabled)
+ sceneHandler29_manRideBack();
+
+ g_vars->scene29_shootCountdown++;
+
+ if (g_vars->scene29_shootCountdown > g_vars->scene29_shootDistance)
+ sceneHandler29_shoot();
+
+ sceneHandler29_animBearded();
+
+ g_fp->_behaviorManager->updateBehaviors();
+ g_fp->startSceneTrack();
+
+ break;
+ }
+
+ return 0;
+}
+
+int scene29_updateCursor() {
+ g_fp->updateCursorCommon();
+
+ if (g_vars->scene29_arcadeIsOn) {
+ if (g_fp->_cursorId != PIC_CSR_DEFAULT_INV && g_fp->_cursorId != PIC_CSR_ITN_INV)
+ g_fp->_cursorId = -1;
+ } else if (g_vars->scene29_manIsRiding) {
+ if (g_fp->_cursorId != PIC_CSR_DEFAULT_INV && g_fp->_cursorId != PIC_CSR_ITN_INV)
+ g_fp->_cursorId = PIC_CSR_DEFAULT;
+ } else if (g_fp->_objectIdAtCursor == ANI_PORTER) {
+ if (g_fp->_cursorId == PIC_CSR_DEFAULT)
+ g_fp->_cursorId = PIC_CSR_ITN;
+ } else {
+ if (g_fp->_objectIdAtCursor == PIC_SC29_LTRUBA && g_fp->_cursorId == PIC_CSR_ITN)
+ g_fp->_cursorId = PIC_CSR_GOL;
+ }
+ return g_fp->_cursorId;
+}
+
+} // End of namespace Fullpipe
diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp
index bb6aabd2b5..3c13bad854 100644
--- a/engines/fullpipe/sound.cpp
+++ b/engines/fullpipe/sound.cpp
@@ -26,6 +26,7 @@
#include "fullpipe/scene.h"
#include "fullpipe/sound.h"
#include "fullpipe/ngiarchive.h"
+#include "fullpipe/messages.h"
#include "common/memstream.h"
#include "audio/audiostream.h"
#include "audio/decoders/vorbis.h"
@@ -73,6 +74,18 @@ bool SoundList::loadFile(const char *fname, char *libname) {
return load(archive, libname);
}
+Sound *SoundList::getSoundItemById(int id) {
+ if (_soundItemsCount == 0) {
+ return _soundItems[0]->getId() != id ? 0 : _soundItems[0];
+ }
+
+ for (int i = 0; i < _soundItemsCount; i++) {
+ if (_soundItems[i]->getId() == id)
+ return _soundItems[i];
+ }
+ return NULL;
+}
+
Sound::Sound() {
_id = 0;
_directSoundBuffer = 0;
@@ -80,10 +93,13 @@ Sound::Sound() {
_objectId = 0;
memset(_directSoundBuffers, 0, sizeof(_directSoundBuffers));
_description = 0;
+ _volume = 100;
}
Sound::~Sound() {
- warning("STUB: Sound::~Sound()");
+ freeSound();
+
+ free(_description);
}
bool Sound::load(MfcArchive &file, NGIArchive *archive) {
@@ -119,24 +135,157 @@ void Sound::setPanAndVolumeByStaticAni() {
debug(3, "STUB Sound::setPanAndVolumeByStaticAni()");
}
-void FullpipeEngine::setSceneMusicParameters(GameVar *var) {
+void Sound::setPanAndVolume(int vol, int pan) {
+ g_fp->_mixer->setChannelVolume(_handle, vol / 39); // 0..10000
+ g_fp->_mixer->setChannelBalance(_handle, pan / 78); // -10000..10000
+}
+
+void Sound::play(int flag) {
+ Audio::SoundHandle handle = getHandle();
+
+ if (g_fp->_mixer->isSoundHandleActive(handle))
+ return;
+
+ byte *soundData = loadData();
+ Common::MemoryReadStream *dataStream = new Common::MemoryReadStream(soundData, getDataSize());
+ Audio::RewindableAudioStream *wav = Audio::makeWAVStream(dataStream, DisposeAfterUse::YES);
+ Audio::AudioStream *audioStream = new Audio::LoopingAudioStream(wav, (flag == 1) ? 0 : 1);
+
+ g_fp->_mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream);
+}
+
+void Sound::freeSound() {
+ stop();
+
+ free(_soundData);
+}
+
+int Sound::getVolume() {
+ return g_fp->_mixer->getChannelVolume(_handle) * 39; // 0..10000
+}
+
+void Sound::stop() {
+ g_fp->_mixer->stopHandle(_handle);
+}
+
+void FullpipeEngine::setSceneMusicParameters(GameVar *gvar) {
warning("STUB: FullpipeEngine::setSceneMusicParameters()");
- // TODO: Finish this (MINDELAY, MAXDELAY, LOCAL, SEQUENCE, STARTDELAY etc)
- stopAllSoundStreams();
+#if 0
+ stopSoundStream2();
+
+ if (soundStream3)
+ FSOUND_Stream_Stop(soundStream4);
+#endif
+
+ if (_musicLocal)
+ stopAllSoundStreams();
+
+ GameVar *var = gvar->getSubVarByName("MUSIC");
+
+ memset(_sceneTracks, 0, sizeof(_sceneTracks));
+
+ _numSceneTracks = 0;
+ _sceneTrackHasSequence = false;
+
+ if (!var)
+ return;
+
_musicGameVar = var;
+
+ GameVar *tr = var->getSubVarByName("TRACKS");
+ if (tr) {
+ GameVar *sub = tr->_subVars;
+
+ while (sub) {
+ if (_musicAllowed & sub->_value.intValue) {
+ strcpy(_sceneTracks[_numSceneTracks], sub->_varName);
+
+ _numSceneTracks++;
+ }
+
+ sub = sub->_nextVarObj;
+ }
+ }
+
+ _musicMinDelay = var->getSubVarAsInt("MINDELAY");
+ _musicMaxDelay = var->getSubVarAsInt("MAXDELAY");
+ _musicLocal = var->getSubVarAsInt("LOCAL");
+
+ GameVar *seq = var->getSubVarByName("SEQUENCE");
+
+ if (seq) {
+ _sceneTrackHasSequence = true;
+
+ strcpy(_trackName, seq->_value.stringValue);
+ }
+
+ if (_musicLocal)
+ stopAllSoundStreams();
+
+ if (!_sceneTrackIsPlaying || _musicLocal)
+ _trackStartDelay = var->getSubVarAsInt("STARTDELAY");
}
void FullpipeEngine::startSceneTrack() {
- // TODO: Finish this
-#ifdef USE_VORBIS
- if (g_fp->_mixer->isSoundHandleActive(_sceneTrackHandle))
- return;
+ if (!_sceneTrackIsPlaying && _numSceneTracks > 0) {
+ if (_trackStartDelay > 0) {
+ _trackStartDelay--;
+ } else {
+ int trackNum = getSceneTrack();
+
+ if (trackNum == -1) {
+ strcpy(_sceneTracksCurrentTrack, "silence");
+
+ _trackStartDelay = 2880;
+ _sceneTrackIsPlaying = 0;
+ } else {
+ strcpy(_sceneTracksCurrentTrack, _sceneTracks[trackNum]);
+
+ startSoundStream1(_sceneTracksCurrentTrack);
+
+ _sceneTrackIsPlaying = true;
+ }
+ }
+ }
+}
+
+int FullpipeEngine::getSceneTrack() {
+ int res;
+
+ if (_sceneTrackHasSequence) {
+ int num = _musicGameVar->getSubVarAsInt("TRACKS");
+
+ if (_trackName[num + 1] == 's') { // 'silence'
+ res = -1;
+ } else {
+ res = _trackName[num + 1] - '0';
+
+ if (res < 0 || res >= _numSceneTracks)
+ res = 0;
+ }
- GameVar *musicTrackVar = _musicGameVar->getSubVarByName("MUSIC")->getSubVarByName("TRACKS")->_subVars;
- if (!musicTrackVar)
+ int track = num + 1;
+
+ if (!_trackName[num + 2])
+ track = 0;
+
+ _musicGameVar->setSubVarAsInt("TRACKS", track);
+ } else {
+ res = _numSceneTracks * (_updateTicks % 10) / 10;
+ }
+
+ return res;
+}
+
+void FullpipeEngine::startSoundStream1(char *trackName) {
+ warning("STUB: FullpipeEngine::startSoundStream1(%s)", trackName);
+
+ stopAllSoundStreams();
+
+#ifdef USE_VORBIS
+ if (_mixer->isSoundHandleActive(_sceneTrackHandle))
return;
- char *trackName = musicTrackVar->_varName;
Common::File *track = new Common::File();
if (!track->open(trackName)) {
warning("Could not open %s", trackName);
@@ -144,40 +293,130 @@ void FullpipeEngine::startSceneTrack() {
return;
}
Audio::RewindableAudioStream *ogg = Audio::makeVorbisStream(track, DisposeAfterUse::YES);
- g_fp->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_sceneTrackHandle, ogg);
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, &_sceneTrackHandle, ogg);
#endif
}
void FullpipeEngine::stopAllSounds() {
// TODO: Differences from stopAllSoundStreams()
- g_fp->_mixer->stopAll();
+ _mixer->stopAll();
}
void FullpipeEngine::toggleMute() {
- warning("STUB: FullpipeEngine::toggleMute()");
+ if (_soundEnabled) {
+ _sfxVolume = _sfxVolume != -10000 ? -10000 : 0;
+
+ updateSoundVolume();
+ }
}
void FullpipeEngine::playSound(int id, int flag) {
- SoundList *soundList = g_fp->_currentScene->_soundList;
- Sound *sound = soundList->getSoundById(id);
+ Sound *sound = 0;
+
+ for (int i = 0; i < _currSoundListCount; i++) {
+ sound = _currSoundList1[i]->getSoundItemById(id);
+
+ if (sound)
+ break;
+ }
+
if (!sound) {
warning("playSound: Can't find sound with ID %d", id);
return;
}
- byte *soundData = sound->loadData();
- Common::MemoryReadStream *dataStream = new Common::MemoryReadStream(soundData, sound->getDataSize());
- Audio::RewindableAudioStream *wav = Audio::makeWAVStream(dataStream, DisposeAfterUse::YES);
- Audio::AudioStream *audioStream = new Audio::LoopingAudioStream(wav, (flag == 1) ? 0 : 1);
- Audio::SoundHandle handle = sound->getHandle();
- g_fp->_mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream);
+
+ sound->play(flag);
}
void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed) {
warning("STUB: FullpipeEngine::playTrack(var, %s, %d)", name, delayed);
+#if 0
+ stopSoundStream2();
+
+ if (soundStream3)
+ FSOUND_Stream_Stop(soundStream4);
+#endif
+
+ if (_musicLocal)
+ stopAllSoundStreams();
+
+ GameVar *var = sceneVar->getSubVarByName(name);
+
+ memset(_sceneTracks, 0, sizeof(_sceneTracks));
+
+ _numSceneTracks = 0;
+ _sceneTrackHasSequence = false;
+
+ if (!var)
+ return;
+
+ _musicGameVar = var;
+
+ GameVar *tr = var->getSubVarByName("TRACKS");
+ if (tr) {
+ GameVar *sub = tr->_subVars;
+
+ while (sub) {
+ if (_musicAllowed & sub->_value.intValue) {
+ strcpy(_sceneTracks[_numSceneTracks], sub->_varName);
+
+ _numSceneTracks++;
+ }
+
+ sub = sub->_nextVarObj;
+ }
+ }
+
+ _musicMinDelay = var->getSubVarAsInt("MINDELAY");
+ _musicMaxDelay = var->getSubVarAsInt("MAXDELAY");
+ _musicLocal = var->getSubVarAsInt("LOCAL");
+
+ GameVar *seq = var->getSubVarByName("SEQUENCE");
+
+ if (seq) {
+ _sceneTrackHasSequence = true;
+
+ strcpy(_trackName, seq->_value.stringValue);
+ }
+
+ if (delayed) {
+ if (_sceneTrackIsPlaying && _numSceneTracks == 1) {
+ if (strcmp(_sceneTracksCurrentTrack, _sceneTracks[0]))
+ stopAllSoundStreams();
+ }
+
+ _trackStartDelay = var->getSubVarAsInt("STARTDELAY");
+ }
}
void global_messageHandler_handleSound(ExCommand *cmd) {
- debug(0, "STUB: global_messageHandler_handleSound()");
+ if (!g_fp->_soundEnabled)
+ return;
+
+ Sound *snd = 0;
+
+ for (int i = 0; i < g_fp->_currSoundListCount; i++)
+ snd = g_fp->_currSoundList1[i]->getSoundItemById(cmd->_messageNum);
+
+ if (!snd)
+ return;
+
+ if (cmd->_field_14 & 1) {
+ if (!g_fp->_flgSoundList && (cmd->_field_14 & 4))
+ snd->freeSound();
+
+ snd->updateVolume();
+
+ if (snd->_objectId && g_fp->_currentScene->getStaticANIObject1ById(snd->_objectId, -1))
+ snd->setPanAndVolumeByStaticAni();
+ else
+ snd->setPanAndVolume(g_fp->_sfxVolume, 0);
+
+ if (snd->getVolume() > -3500)
+ snd->play(cmd->_keyCode);
+ } else if (cmd->_field_14 & 2) {
+ snd->stop();
+ }
}
void FullpipeEngine::stopSoundStream2() {
@@ -186,21 +425,29 @@ void FullpipeEngine::stopSoundStream2() {
void FullpipeEngine::stopAllSoundStreams() {
// TODO: Differences from stopAllSounds()
- g_fp->_mixer->stopAll();
+ _mixer->stopAll();
}
void FullpipeEngine::stopAllSoundInstances(int id) {
- SoundList *soundList = g_fp->_currentScene->_soundList;
- for (int i = 0; i < soundList->getCount(); i++) {
- Sound *sound = soundList->getSoundByIndex(i);
- if (sound->getId() == id) {
- g_fp->_mixer->stopHandle(sound->getHandle());
- }
+ for (int i = 0; i < _currSoundListCount; i++) {
+ Sound *sound = _currSoundList1[i]->getSoundItemById(id);
+
+ if (sound)
+ sound->stop();
}
}
void FullpipeEngine::updateSoundVolume() {
- debug(3, "STUB FullpipeEngine::updateSoundVolume()");
+ for (int i = 0; i < _currSoundListCount; i++)
+ for (int j = 0; i < _currSoundList1[i]->getCount(); j++) {
+ _currSoundList1[i]->getSoundByIndex(j)->setPanAndVolume(_sfxVolume, 0);
+ }
+}
+
+void FullpipeEngine::setMusicVolume(int vol) {
+ _musicVolume = vol;
+
+ debug(3, "STUB FullpipeEngine::setMusicVolume()");
}
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h
index 8ddfc753ce..14e766f5bb 100644
--- a/engines/fullpipe/sound.h
+++ b/engines/fullpipe/sound.h
@@ -28,11 +28,14 @@ namespace Fullpipe {
class Sound : public MemoryObject {
int _id;
char *_description;
- int16 _objectId;
int _directSoundBuffer;
int _directSoundBuffers[7];
byte *_soundData;
Audio::SoundHandle _handle;
+ int _volume;
+
+public:
+ int16 _objectId;
public:
Sound();
@@ -44,7 +47,13 @@ public:
int getId() const { return _id; }
Audio::SoundHandle getHandle() const { return _handle; }
+ void play(int flag);
+ void freeSound();
+ int getVolume();
+ void stop();
+
void setPanAndVolumeByStaticAni();
+ void setPanAndVolume(int vol, int pan);
};
class SoundList : public CObject {
@@ -60,13 +69,7 @@ class SoundList : public CObject {
int getCount() { return _soundItemsCount; }
Sound *getSoundByIndex(int idx) { return _soundItems[idx]; }
- Sound *getSoundById(int id) {
- for (int i = 0; i < _soundItemsCount; i++) {
- if (_soundItems[i]->getId() == id)
- return _soundItems[i];
- }
- return NULL;
- }
+ Sound *getSoundItemById(int id);
};
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index 75c1c7d1ea..f1abac5778 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -105,6 +105,19 @@ bool StepArray::gotoNextPoint() {
}
}
+void StepArray::insertPoints(Common::Point **points, int pointsCount) {
+ if (_currPointIndex + pointsCount >= _pointsCount)
+ _points = (Common::Point **)realloc(_points, sizeof(Common::Point *) * (_currPointIndex + pointsCount));
+
+ _maxPointIndex = _currPointIndex + pointsCount;
+
+ for (int i = 0; i < pointsCount; i++) {
+ _points[_currPointIndex + i] = new Common::Point;
+
+ *_points[_currPointIndex + i] = *points[i];
+ }
+}
+
StaticANIObject::StaticANIObject() {
_shadowsOn = 1;
_field_30 = 0;
@@ -264,8 +277,11 @@ void StaticANIObject::deleteFromGlobalMessageQueue() {
}
}
-void StaticANIObject::queueMessageQueue(MessageQueue *mq) {
- if (isIdle() && !(_flags & 0x80)) {
+bool StaticANIObject::queueMessageQueue(MessageQueue *mq) {
+ if (_flags & 0x80)
+ return false;
+
+ if (isIdle()) {
deleteFromGlobalMessageQueue();
_messageQueueId = 0;
_messageNum = 0;
@@ -283,6 +299,8 @@ void StaticANIObject::queueMessageQueue(MessageQueue *mq) {
_messageQueueId = 0;
}
}
+
+ return true;
}
void StaticANIObject::restartMessageQueue(MessageQueue *mq) {
@@ -330,7 +348,35 @@ bool StaticANIObject::trySetMessageQueue(int msgNum, int qId) {
}
void StaticANIObject::startMQIfIdle(int qId, int flag) {
- warning("STUB: StaticANIObject::startMQIfIdle()");
+ MessageQueue *msg = g_fp->_currentScene->getMessageQueueById(qId);
+
+ if (msg && isIdle() && !(_flags & 0x100)) {
+ MessageQueue *mq = new MessageQueue(msg, 0, 0);
+
+ mq->setFlags(mq->getFlags() | flag);
+
+ ExCommand *ex = mq->getExCommandByIndex(0);
+
+ if (ex) {
+ while (ex->_messageKind != 1 || ex->_parentId != _id) {
+ ex->_parId = 0;
+ ex->_excFlags |= 2;
+ ex->handleMessage();
+
+ mq->deleteExCommandByIndex(0, 0);
+
+ ex = mq->getExCommandByIndex(0);
+
+ if (!ex)
+ return;
+ }
+
+ if (ex) {
+ startAnim(ex->_messageNum, mq->_id, -1);
+ mq->deleteExCommandByIndex(0, 1);
+ }
+ }
+ }
}
bool StaticANIObject::isIdle() {
@@ -978,9 +1024,26 @@ void StaticANIObject::adjustSomeXY() {
}
MessageQueue *StaticANIObject::changeStatics1(int msgNum) {
- warning("STUB: StaticANIObject::changeStatics1(%d)", msgNum);
+ g_fp->_mgm->addItem(_id);
- return 0;
+ MessageQueue *mq = g_fp->_mgm->genMQ(this, msgNum, 0, 0, 0);
+
+ if (!mq)
+ return 0;
+
+ if (mq->getCount() <= 0) {
+ g_fp->_globalMessageQueueList->addMessageQueue(mq);
+
+ if (_flags & 1)
+ _messageQueueId = mq->_id;
+ } else {
+ if (!queueMessageQueue(mq))
+ return 0;
+
+ g_fp->_globalMessageQueueList->addMessageQueue(mq);
+ }
+
+ return mq;
}
void StaticANIObject::changeStatics2(int objId) {
@@ -1060,7 +1123,47 @@ void StaticANIObject::show1(int x, int y, int movId, int mqId) {
}
void StaticANIObject::show2(int x, int y, int movementId, int mqId) {
- warning("STUB: StaticANIObject::show2(%d, %d, %d, %d)", x, y, movementId, mqId);
+ if (movementId == -1) {
+ _flags |= 4u;
+ return;
+ }
+
+ if (!_messageQueueId) {
+ _messageQueueId = mqId;
+
+ Movement *mov = getMovementById(movementId);
+
+ if (mov) {
+ _statics = mov->_staticsObj1;
+ _movement = mov;
+ mov->gotoLastFrame();
+ mov->setOXY(x, y);
+ mov->gotoFirstFrame();
+
+ Common::Point point;
+
+ mov->getCurrDynamicPhaseXY(point);
+ _statics->_x = mov->_ox - point.x - mov->_mx;
+ _statics->_y = mov->_oy - point.y - mov->_my;
+
+ _statics->getSomeXY(point);
+ _flags |= 4;
+ _ox = _statics->_x + point.x;
+ _oy = _statics->_y + point.y;
+
+ if (mov->_currMovement) {
+ _flags |= 8;
+ } else {
+ if (_flags & 8)
+ _flags ^= 8;
+ }
+
+ if (_flags & 1)
+ _flags ^= 1;
+
+ _flags |= 0x20;
+ }
+ }
}
void StaticANIObject::playIdle() {
@@ -1069,7 +1172,85 @@ void StaticANIObject::playIdle() {
}
void StaticANIObject::startAnimSteps(int movementId, int messageQueueId, int x, int y, Common::Point **points, int pointsCount, int someDynamicPhaseIndex) {
- warning("STUB: StaticANIObject::startAnimSteps()");
+ Movement *mov = 0;
+
+ if (!(_flags & 0x80)) {
+ if (!_messageQueueId)
+ for (uint i = 0; i < _movements.size(); i++) {
+ if (((Movement *)_movements[i])->_id == movementId) {
+ mov = (Movement *)_movements[i];
+ break;
+ }
+ }
+ }
+
+ if (!mov) {
+ updateGlobalMessageQueue(messageQueueId, _id);
+
+ return;
+ }
+
+
+ if (_movement || !_statics)
+ return;
+
+ Common::Point point;
+
+ _statics->getSomeXY(point);
+
+ int newx = _ox - point.x;
+ int newy = _oy - point.y;
+
+ _movement = mov;
+
+ if (_flags & 0x40)
+ _movement->gotoLastFrame();
+ else
+ _movement->gotoFirstFrame();
+
+ _stepArray.clear();
+ _stepArray.insertPoints(points, pointsCount);
+
+ if (!(_flags & 0x40)) {
+ if (!_movement->_currDynamicPhaseIndex) {
+ _stepArray.getCurrPoint(&point);
+ newx += point.x + _movement->_mx;
+ newy += point.y + _movement->_my;
+ _stepArray.gotoNextPoint();
+
+ ExCommand *ex = _movement->_currDynamicPhase->getExCommand();
+
+ if (ex) {
+ if (ex->_messageKind == 35) {
+ ExCommand *newEx = ex->createClone();
+
+ newEx->_excFlags |= 2u;
+ newEx->sendMessage();
+ }
+ }
+ }
+ }
+
+ _movement->getCurrDynamicPhaseXY(point);
+ setOXY(point.x + newx, point.y + newy);
+
+ if ((_movement->_staticsObj2->_staticsId >> 8) & 0x40)
+ _flags |= 8;
+ else
+ _flags &= 0xFFF7;
+
+ _flags |= 1;
+ _messageQueueId = messageQueueId;
+ _movement->_currDynamicPhase->_countdown = _movement->_currDynamicPhase->_initialCountdown;
+ _movement->_counter = 0;
+ _counter = _initialCounter;
+ _someDynamicPhaseIndex = someDynamicPhaseIndex;
+
+ ExCommand *ex = new ExCommand(_id, 17, 23, 0, 0, movementId, 1, 0, 0, 0);
+
+ ex->_keyCode = _okeyCode;
+ ex->_excFlags = 2;
+ ex->postMessage();
}
bool StaticANIObject::startAnimEx(int movid, int parId, int flag1, int flag2) {
@@ -1188,6 +1369,31 @@ bool StaticANIObject::startAnim(int movementId, int messageQueueId, int dynPhase
return true;
}
+Common::Point *StaticANIObject::calcStepLen(Common::Point *p) {
+ if (_movement) {
+ Common::Point point;
+
+ _movement->calcSomeXY(point, 0);
+
+ p->x = point.x;
+ p->y = point.y;
+
+ int idx = _stepArray.getCurrPointIndex() - _movement->_currDynamicPhaseIndex - 1;
+
+ if (idx >= 0) {
+ _stepArray.getPoint(&point, idx, _movement->_currDynamicPhaseIndex + 2);
+
+ p->x += point.x;
+ p->y += point.y;
+ }
+ } else {
+ p->x = 0;
+ p->y = 0;
+ }
+
+ return p;
+}
+
Statics::Statics() {
_staticsId = 0;
_picture = 0;
diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h
index 8328e7679b..d678957163 100644
--- a/engines/fullpipe/statics.h
+++ b/engines/fullpipe/statics.h
@@ -47,6 +47,7 @@ class StepArray : public CObject {
Common::Point *getCurrPoint(Common::Point *point);
Common::Point *getPoint(Common::Point *point, int index, int offset);
bool gotoNextPoint();
+ void insertPoints(Common::Point **points, int pointsCount);
};
class StaticPhase : public Picture {
@@ -216,7 +217,7 @@ public:
void setAlpha(int alpha);
void deleteFromGlobalMessageQueue();
- void queueMessageQueue(MessageQueue *msg);
+ bool queueMessageQueue(MessageQueue *msg);
void restartMessageQueue(MessageQueue *msg);
MessageQueue *getMessageQueue();
bool trySetMessageQueue(int msgNum, int qId);
@@ -245,6 +246,7 @@ public:
void draw2();
MovTable *countMovements();
+ Common::Point *calcStepLen(Common::Point *p);
void setSpeed(int speed);
void updateStepPos();
diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp
index 081afe4a05..3ee6d64bec 100644
--- a/engines/gob/draw.cpp
+++ b/engines/gob/draw.cpp
@@ -88,11 +88,6 @@ Draw::Draw(GobEngine *vm) : _vm(vm) {
_vgaPalette[i].blue = 0;
_vgaPalette[i].green = 0;
}
- for (int i = 0; i < 16; i++) {
- _vgaSmallPalette[i].red = 0;
- _vgaSmallPalette[i].blue = 0;
- _vgaSmallPalette[i].green = 0;
- }
_showCursor = 0;
_cursorIndex = 0;
diff --git a/engines/gob/draw.h b/engines/gob/draw.h
index ba6f183c6c..eb12e85468 100644
--- a/engines/gob/draw.h
+++ b/engines/gob/draw.h
@@ -115,7 +115,6 @@ public:
int16 _unusedPalette1[18];
int16 _unusedPalette2[16];
Video::Color _vgaPalette[256];
- Video::Color _vgaSmallPalette[16];
// 0 (00b): No cursor
// 1 (01b): Cursor would be on _backSurface
diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp
index 10364952f2..40134bbf17 100644
--- a/engines/gob/inter_v1.cpp
+++ b/engines/gob/inter_v1.cpp
@@ -1125,7 +1125,7 @@ void Inter_v1::o1_palLoad(OpFuncParams &params) {
_vm->_draw->_vgaPalette[i].blue = _vm->_game->_script->readByte();
}
- memcpy(_vm->_draw->_vgaSmallPalette, _vm->_draw->_vgaPalette, 16 * 3);
+ memcpy(_vm->_draw->_vgaPalette, _vm->_draw->_vgaPalette, 16 * 3);
break;
case 53:
@@ -1183,7 +1183,7 @@ void Inter_v1::o1_palLoad(OpFuncParams &params) {
_vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0);
return;
}
- _vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaSmallPalette;
+ _vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette;
_vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0);
}
}
@@ -2489,21 +2489,21 @@ void Inter_v1::animPalette() {
_vm->_video->waitRetrace();
if (_animPalDir[0] == -1) {
- col = _vm->_draw->_vgaSmallPalette[_animPalLowIndex[0]];
+ col = _vm->_draw->_vgaPalette[_animPalLowIndex[0]];
for (i = _animPalLowIndex[0]; i < _animPalHighIndex[0]; i++)
- _vm->_draw->_vgaSmallPalette[i] = _vm->_draw->_vgaSmallPalette[i + 1];
+ _vm->_draw->_vgaPalette[i] = _vm->_draw->_vgaPalette[i + 1];
- _vm->_draw->_vgaSmallPalette[_animPalHighIndex[0]] = col;
+ _vm->_draw->_vgaPalette[_animPalHighIndex[0]] = col;
} else {
- col = _vm->_draw->_vgaSmallPalette[_animPalHighIndex[0]];
+ col = _vm->_draw->_vgaPalette[_animPalHighIndex[0]];
for (i = _animPalHighIndex[0]; i > _animPalLowIndex[0]; i--)
- _vm->_draw->_vgaSmallPalette[i] = _vm->_draw->_vgaSmallPalette[i - 1];
+ _vm->_draw->_vgaPalette[i] = _vm->_draw->_vgaPalette[i - 1];
- _vm->_draw->_vgaSmallPalette[_animPalLowIndex[0]] = col;
+ _vm->_draw->_vgaPalette[_animPalLowIndex[0]] = col;
}
- _vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaSmallPalette;
+ _vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette;
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
}
diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
index 20c0688dd7..37ef291a93 100644
--- a/engines/gob/minigames/geisha/diving.cpp
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -389,8 +389,7 @@ void Diving::initScreen() {
_vm->_util->setFrameRate(15);
// Set palette
- memcpy(_vm->_draw->_vgaPalette , kPalette, sizeof(kPalette));
- memcpy(_vm->_draw->_vgaSmallPalette, kPalette, sizeof(kPalette));
+ memcpy(_vm->_draw->_vgaPalette, kPalette, sizeof(kPalette));
// Draw background decal
_vm->_draw->_backSurface->clear();
diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp
index 16742c712f..0ebcd2c55b 100644
--- a/engines/gob/minigames/geisha/penetration.cpp
+++ b/engines/gob/minigames/geisha/penetration.cpp
@@ -840,8 +840,7 @@ void Penetration::setPalette() {
_vm->_palAnim->fade(0, 0, 0);
// Set palette
- memcpy(_vm->_draw->_vgaPalette , kPalettes[_floor], 3 * kPaletteSize);
- memcpy(_vm->_draw->_vgaSmallPalette, kPalettes[_floor], 3 * kPaletteSize);
+ memcpy(_vm->_draw->_vgaPalette, kPalettes[_floor], 3 * kPaletteSize);
_needFadeIn = true;
}
diff --git a/engines/gob/resources.cpp b/engines/gob/resources.cpp
index ac2deadd5f..dbed825977 100644
--- a/engines/gob/resources.cpp
+++ b/engines/gob/resources.cpp
@@ -209,6 +209,7 @@ void Resources::unload(bool del) {
_totResourceTable = 0;
_extResourceTable = 0;
_totTextTable = 0;
+ _totResStart = 0;
_totData = 0;
_totSize = 0;
_imData = 0;
@@ -233,6 +234,8 @@ bool Resources::loadTOTResourceTable() {
if (!stream)
return false;
+ _totResStart = totProps.scriptEnd;
+
if ((totProps.resourcesOffset == 0xFFFFFFFF) ||
(totProps.resourcesOffset == 0))
// No resources here
@@ -271,7 +274,6 @@ bool Resources::loadTOTResourceTable() {
item.type = kResourceTOT;
}
- _totResStart = totProps.scriptEnd;
_totSize = stream->size() - _totResStart;
if (_totSize <= 0)
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index 4b3fb81828..2776a0455d 100644
--- a/engines/groovie/roq.cpp
+++ b/engines/groovie/roq.cpp
@@ -45,7 +45,7 @@ namespace Groovie {
ROQPlayer::ROQPlayer(GroovieEngine *vm) :
VideoPlayer(vm), _codingTypeCount(0),
- _fg(&_vm->_graphicsMan->_foreground), _bg(&_vm->_graphicsMan->_background) {
+ _bg(&_vm->_graphicsMan->_background) {
// Create the work surfaces
_currBuf = new Graphics::Surface();
diff --git a/engines/groovie/roq.h b/engines/groovie/roq.h
index 0e82983e63..cd5e91c82b 100644
--- a/engines/groovie/roq.h
+++ b/engines/groovie/roq.h
@@ -75,7 +75,7 @@ private:
byte _codebook4[256 * 4];
// Buffers
- Graphics::Surface *_fg, *_bg, *_thirdBuf;
+ Graphics::Surface *_bg;
Graphics::Surface *_currBuf, *_prevBuf;
void buildShowBuf();
byte _scaleX, _scaleY;
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 313386e86d..391de5e49c 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -620,14 +620,14 @@ void LoLEngine::updateCompass() {
if (_compassStep)
_compassStep -= (((ABS(_compassStep) >> 4) + 2) * dir);
- int16 d = _compassBroken ? (int8(_rnd.getRandomNumber(255)) - _compassDirection) : (_currentDirection << 6) - _compassDirection;
- if (d <= -128)
- d += 256;
- if (d >= 128)
- d -= 256;
-
- d >>= 2;
- _compassStep += d;
+ int16 diff = _compassBroken ? (int8(_rnd.getRandomNumber(255)) - _compassDirection) : (_currentDirection << 6) - _compassDirection;
+ if (diff <= -128)
+ diff += 256;
+ if (diff >= 128)
+ diff -= 256;
+
+ diff >>= 2;
+ _compassStep += diff;
_compassStep = CLIP(_compassStep, -24, 24);
_compassDirection += _compassStep;
@@ -636,14 +636,9 @@ void LoLEngine::updateCompass() {
if (_compassDirection > 255)
_compassDirection -= 256;
- if ((_compassDirection >> 6) == _currentDirection && _compassStep < 2) {
- int16 d2 = d >> 16;
- d ^= d2;
- d -= d2;
- if (d < 4) {
- _compassDirection = _currentDirection << 6;
- _compassStep = 0;
- }
+ if (((((_compassDirection + 3) & 0xFD) >> 6) == _currentDirection) && (_compassStep < 2) && (ABS(diff) < 4)) {
+ _compassDirection = _currentDirection << 6;
+ _compassStep = 0;
}
gui_drawCompass();
diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp
index 10cbc49c7c..725dedae3f 100644
--- a/engines/kyra/sound_towns.cpp
+++ b/engines/kyra/sound_towns.cpp
@@ -538,7 +538,8 @@ bool SoundTownsPC98_v2::init() {
// check if we have access to CD audio.
Resource *r = _vm->resource();
if (_musicEnabled &&
- (r->exists("track1.mp3") || r->exists("track1.ogg") || r->exists("track1.flac") || r->exists("track1.fla")))
+ (r->exists("track1.mp3") || r->exists("track1.ogg") || r->exists("track1.flac") || r->exists("track1.fla")
+ || r->exists("track01.mp3") || r->exists("track01.ogg") || r->exists("track01.flac") || r->exists("track01.fla")))
_musicEnabled = 2;
else
_musicEnabled = 1;
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index fbbe916a5c..9b3b92b9c7 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -39,7 +39,7 @@
namespace Kyra {
-#define RESFILE_VERSION 84
+#define RESFILE_VERSION 85
namespace {
bool checkKyraDat(Common::SeekableReadStream *file) {
diff --git a/engines/lastexpress/data/animation.cpp b/engines/lastexpress/data/animation.cpp
index 9c8cc202aa..148854e04d 100644
--- a/engines/lastexpress/data/animation.cpp
+++ b/engines/lastexpress/data/animation.cpp
@@ -39,7 +39,7 @@
namespace LastExpress {
-Animation::Animation() : _stream(NULL), _currentChunk(NULL), _overlay(NULL), _background1(NULL), _background2(NULL), _backgroundCurrent(0), _audio(NULL), _startTime(0), _changed(false), _flag(0) {
+Animation::Animation() : _stream(NULL), _currentChunk(NULL), _overlay(NULL), _background1(NULL), _background2(NULL), _backgroundCurrent(0), _audio(NULL), _startTime(0), _changed(false) {
}
Animation::~Animation() {
diff --git a/engines/lastexpress/data/animation.h b/engines/lastexpress/data/animation.h
index 7f6922866a..9523cddb78 100644
--- a/engines/lastexpress/data/animation.h
+++ b/engines/lastexpress/data/animation.h
@@ -113,7 +113,6 @@ private:
uint32 _startTime;
bool _changed;
- int _flag;
};
} // End of namespace LastExpress
diff --git a/engines/lastexpress/data/sequence.cpp b/engines/lastexpress/data/sequence.cpp
index c7073b560c..f43e2afdef 100644
--- a/engines/lastexpress/data/sequence.cpp
+++ b/engines/lastexpress/data/sequence.cpp
@@ -76,7 +76,7 @@ void FrameInfo::read(Common::SeekableReadStream *in, bool isSequence) {
// AnimFrame
-AnimFrame::AnimFrame(Common::SeekableReadStream *in, const FrameInfo &f, bool ignoreSubtype) : _palette(NULL), _ignoreSubtype(ignoreSubtype) {
+AnimFrame::AnimFrame(Common::SeekableReadStream *in, const FrameInfo &f, bool /* ignoreSubtype */) : _palette(NULL) {
_palSize = 1;
// TODO: use just the needed rectangle
_image.create(640, 480, Graphics::PixelFormat::createFormatCLUT8());
diff --git a/engines/lastexpress/data/sequence.h b/engines/lastexpress/data/sequence.h
index dbb08a0c07..fd8b3cd27b 100644
--- a/engines/lastexpress/data/sequence.h
+++ b/engines/lastexpress/data/sequence.h
@@ -147,7 +147,6 @@ private:
uint16 _palSize;
uint16 *_palette;
Common::Rect _rect;
- bool _ignoreSubtype;
};
class Sequence {
diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp
index 3fc4c2a05b..8867e8a626 100644
--- a/engines/lure/menu.cpp
+++ b/engines/lure/menu.cpp
@@ -31,7 +31,7 @@
#include "lure/events.h"
#include "lure/lure.h"
-#if defined(_WIN32_WCE) || defined(__SYMBIAN32__) || defined(WEBOS) || defined(__ANDROID__)
+#if defined(_WIN32_WCE) || defined(__SYMBIAN32__) || defined(WEBOS) || defined(__ANDROID__) || defined(__WII__)
#define LURE_CLICKABLE_MENUS
#endif
diff --git a/engines/neverhood/modules/module1000.cpp b/engines/neverhood/modules/module1000.cpp
index a3b5bc67b5..b19ba05b32 100644
--- a/engines/neverhood/modules/module1000.cpp
+++ b/engines/neverhood/modules/module1000.cpp
@@ -228,7 +228,7 @@ uint32 Scene1001::handleMessage(int messageNum, const MessageParam &param, Entit
}
Scene1002::Scene1002(NeverhoodEngine *vm, Module *parentModule, int which)
- : Scene(vm, parentModule), _isKlaymenFloor(false), _isClimbingLadder(false) {
+ : Scene(vm, parentModule), _isKlaymenFloor(false), _isClimbingLadder(false), _asKlaymenPeekHand(nullptr) {
NRect tempClipRect;
Sprite *tempSprite;
diff --git a/engines/neverhood/modules/module1300.cpp b/engines/neverhood/modules/module1300.cpp
index d806019e6c..60ff0411a6 100644
--- a/engines/neverhood/modules/module1300.cpp
+++ b/engines/neverhood/modules/module1300.cpp
@@ -603,7 +603,7 @@ uint32 Scene1305::handleMessage(int messageNum, const MessageParam &param, Entit
}
Scene1306::Scene1306(NeverhoodEngine *vm, Module *parentModule, int which)
- : Scene(vm, parentModule) {
+ : Scene(vm, parentModule), _asKey(nullptr) {
if (getGlobalVar(V_HAS_FINAL_KEY) && getGlobalVar(V_KEY3_LOCATION) == 0)
setGlobalVar(V_KEY3_LOCATION, 4);
@@ -683,7 +683,6 @@ Scene1306::Scene1306(NeverhoodEngine *vm, Module *parentModule, int which)
clearRectList();
sendMessage(_asElevator, NM_KLAYMEN_OPEN_DOOR, 0);
}
-
}
Scene1306::~Scene1306() {
@@ -942,6 +941,7 @@ Scene1308::Scene1308(NeverhoodEngine *vm, Module *parentModule, int which)
_sprite2 = insertStaticSprite(0x40043120, 995);
_sprite3 = insertStaticSprite(0x43003100, 995);
_sprite4 = NULL;
+ _sprite5 = nullptr;
if (which < 0) {
// Restoring game
diff --git a/engines/neverhood/modules/module2200.cpp b/engines/neverhood/modules/module2200.cpp
index f9033a9dbe..6618cb3ab0 100644
--- a/engines/neverhood/modules/module2200.cpp
+++ b/engines/neverhood/modules/module2200.cpp
@@ -885,7 +885,7 @@ void Scene2205::update() {
} else if (_isLightOn && !getGlobalVar(V_LIGHTS_ON)) {
_palette->addPalette(0xD00A028D, 0, 256, 0);
changeBackground(0xD00A028D);
- _ssLightSwitch->setFileHashes(0x2D339030, 0xDAC86E84);
+ _ssLightSwitch->setFileHashes(0xD6C86E84, 0xDAC86E84);
sendMessage(_ssDoorFrame, 0x2000, 0);
changeMouseCursor(0xA0289D08);
_isKlaymenInLight = true;
diff --git a/engines/neverhood/modules/module2300.cpp b/engines/neverhood/modules/module2300.cpp
index c0edc95873..68ae07f2bb 100644
--- a/engines/neverhood/modules/module2300.cpp
+++ b/engines/neverhood/modules/module2300.cpp
@@ -31,14 +31,14 @@ static const uint32 kModule2300SoundList[] = {
};
Module2300::Module2300(NeverhoodEngine *vm, Module *parentModule, int which)
- : Module(vm, parentModule), _soundVolume(0) {
+ : Module(vm, parentModule), _waterfallSoundVolume(0) {
_vm->_soundMan->addSoundList(0x1A214010, kModule2300SoundList);
_vm->_soundMan->setSoundListParams(kModule2300SoundList, true, 50, 600, 10, 150);
- _isWallBroken = getGlobalVar(V_WALL_BROKEN) != 0;
+ _isWaterfallRunning = getGlobalVar(V_WALL_BROKEN) != 1;
- if (_isWallBroken) {
+ if (_isWaterfallRunning) {
_vm->_soundMan->setSoundVolume(0x90F0D1C3, 0);
_vm->_soundMan->playSoundLooping(0x90F0D1C3);
} else {
@@ -78,8 +78,8 @@ void Module2300::createScene(int sceneNum, int which) {
case 1:
_vm->gameState().sceneNum = 1;
createNavigationScene(0x004B67E8, which);
- if (_isWallBroken) {
- _soundVolume = 15;
+ if (_isWaterfallRunning) {
+ _waterfallSoundVolume = 15;
_vm->_soundMan->setSoundVolume(0x90F0D1C3, 15);
}
break;
@@ -92,10 +92,10 @@ void Module2300::createScene(int sceneNum, int which) {
if (getGlobalVar(V_WALL_BROKEN))
createNavigationScene(0x004B68F0, which);
else {
- _vm->_soundMan->setSoundVolume(0x90F0D1C3, _soundVolume);
+ _vm->_soundMan->setSoundVolume(0x90F0D1C3, _waterfallSoundVolume);
createNavigationScene(0x004B68A8, which);
- if (_isWallBroken) {
- _soundVolume = 87;
+ if (_isWaterfallRunning) {
+ _waterfallSoundVolume = 87;
_vm->_soundMan->setSoundVolume(0x90F0D1C3, 87);
}
}
@@ -161,10 +161,10 @@ void Module2300::updateScene() {
} else {
switch (_sceneNum) {
case 1:
- if (_isWallBroken && navigationScene()->isWalkingForward() && navigationScene()->getNavigationIndex() == 4 &&
+ if (_isWaterfallRunning && navigationScene()->isWalkingForward() && navigationScene()->getNavigationIndex() == 4 &&
navigationScene()->getFrameNumber() % 2) {
- _soundVolume++;
- _vm->_soundMan->setSoundVolume(0x90F0D1C3, _soundVolume);
+ _waterfallSoundVolume++;
+ _vm->_soundMan->setSoundVolume(0x90F0D1C3, _waterfallSoundVolume);
}
if (navigationScene()->isWalkingForward() && navigationScene()->getNavigationIndex() == 0 &&
navigationScene()->getFrameNumber() == 50) {
@@ -174,9 +174,9 @@ void Module2300::updateScene() {
}
break;
case 3:
- if (_isWallBroken && navigationScene()->isWalkingForward() && navigationScene()->getFrameNumber() % 2) {
- _soundVolume--;
- _vm->_soundMan->setSoundVolume(0x90F0D1C3, _soundVolume);
+ if (_isWaterfallRunning && navigationScene()->isWalkingForward() && navigationScene()->getFrameNumber() % 2) {
+ _waterfallSoundVolume--;
+ _vm->_soundMan->setSoundVolume(0x90F0D1C3, _waterfallSoundVolume);
}
break;
}
diff --git a/engines/neverhood/modules/module2300.h b/engines/neverhood/modules/module2300.h
index 57235986d9..58bffb710c 100644
--- a/engines/neverhood/modules/module2300.h
+++ b/engines/neverhood/modules/module2300.h
@@ -37,8 +37,8 @@ public:
virtual ~Module2300();
protected:
int _sceneNum;
- bool _isWallBroken;
- int _soundVolume;
+ int _waterfallSoundVolume;
+ bool _isWaterfallRunning;
void createScene(int sceneNum, int which);
void updateScene();
};
diff --git a/engines/neverhood/modules/module2700.cpp b/engines/neverhood/modules/module2700.cpp
index 9399981cfd..2a112435fc 100644
--- a/engines/neverhood/modules/module2700.cpp
+++ b/engines/neverhood/modules/module2700.cpp
@@ -84,7 +84,7 @@ static const uint32 kScene2725StaticSprites[] = {
};
Module2700::Module2700(NeverhoodEngine *vm, Module *parentModule, int which)
- : Module(vm, parentModule), _soundIndex(0), _radioMusicInitialized(false) {
+ : Module(vm, parentModule), _soundIndex(0), _radioMusicInitialized(false), _musicFileHash(0) {
_vm->_soundMan->addMusic(0x42212411, 0x04020210);
_vm->_soundMan->startMusic(0x04020210, 24, 2);
diff --git a/engines/neverhood/modules/module2900.cpp b/engines/neverhood/modules/module2900.cpp
index 3bf98eca35..69186514a2 100644
--- a/engines/neverhood/modules/module2900.cpp
+++ b/engines/neverhood/modules/module2900.cpp
@@ -34,11 +34,12 @@ namespace Neverhood {
Module2900::Module2900(NeverhoodEngine *vm, Module *parentModule, int which)
: Module(vm, parentModule) {
+ _teleporterModuleResult = -1;
+
if (which >= 0)
setGlobalVar(V_TELEPORTER_WHICH, which);
createScene(0, 0);
-
}
void Module2900::createScene(int sceneNum, int which) {
diff --git a/engines/neverhood/modules/module3000.cpp b/engines/neverhood/modules/module3000.cpp
index 59b2df260e..d4809611ad 100644
--- a/engines/neverhood/modules/module3000.cpp
+++ b/engines/neverhood/modules/module3000.cpp
@@ -39,7 +39,7 @@ static const uint32 kModule3000SoundList[] = {
};
Module3000::Module3000(NeverhoodEngine *vm, Module *parentModule, int which)
- : Module(vm, parentModule), _soundVolume(0) {
+ : Module(vm, parentModule), _waterfallSoundVolume(0) {
_vm->_soundMan->addSoundList(0x81293110, kModule3000SoundList);
_vm->_soundMan->setSoundListParams(kModule3000SoundList, true, 50, 600, 5, 150);
@@ -48,9 +48,9 @@ Module3000::Module3000(NeverhoodEngine *vm, Module *parentModule, int which)
_vm->_soundMan->playTwoSounds(0x81293110, 0x40030A51, 0xC862CA15, 0);
_vm->_soundMan->playTwoSounds(0x81293110, 0x41861371, 0x43A2507F, 0);
- _isWallBroken = getGlobalVar(V_WALL_BROKEN) != 0;
+ _isWaterfallRunning = getGlobalVar(V_WALL_BROKEN) != 1;
- if (!_isWallBroken) {
+ if (_isWaterfallRunning) {
_vm->_soundMan->setSoundVolume(0x90F0D1C3, 0);
_vm->_soundMan->playSoundLooping(0x90F0D1C3);
}
@@ -78,12 +78,11 @@ void Module3000::createScene(int sceneNum, int which) {
static const byte kNavigationTypes06[] = {5};
debug(1, "Module3000::createScene(%d, %d)", sceneNum, which);
_vm->gameState().sceneNum = sceneNum;
- _isWallBroken = getGlobalVar(V_WALL_BROKEN) != 0;
switch (_vm->gameState().sceneNum) {
case 1:
if (!getGlobalVar(V_BOLT_DOOR_OPEN)) {
createNavigationScene(0x004B7C80, which);
- } else if (_isWallBroken) {
+ } else if (getGlobalVar(V_WALL_BROKEN)) {
createNavigationScene(0x004B7CE0, which);
} else {
createNavigationScene(0x004B7CB0, which);
@@ -91,11 +90,11 @@ void Module3000::createScene(int sceneNum, int which) {
break;
case 2:
_vm->_soundMan->playTwoSounds(0x81293110, 0x40030A51, 0xC862CA15, 0);
- if (!_isWallBroken) {
- _soundVolume = 90;
+ if (_isWaterfallRunning) {
+ _waterfallSoundVolume = 90;
_vm->_soundMan->setSoundVolume(0x90F0D1C3, 90);
}
- if (_isWallBroken) {
+ if (getGlobalVar(V_WALL_BROKEN)) {
createNavigationScene(0x004B7D58, which);
} else {
createNavigationScene(0x004B7D10, which);
@@ -104,7 +103,7 @@ void Module3000::createScene(int sceneNum, int which) {
case 3:
if (getGlobalVar(V_STAIRS_DOWN))
createNavigationScene(0x004B7E60, which);
- else if (_isWallBroken)
+ else if (getGlobalVar(V_WALL_BROKEN))
createNavigationScene(0x004B7DA0, which);
else
createNavigationScene(0x004B7E00, which);
@@ -152,12 +151,12 @@ void Module3000::createScene(int sceneNum, int which) {
// NOTE: Newly introduced sceneNums
case 1001:
if (!getGlobalVar(V_BOLT_DOOR_OPEN))
- if (_isWallBroken)
+ if (getGlobalVar(V_WALL_BROKEN))
createSmackerScene(0x00940021, true, true, false);
else
createSmackerScene(0x01140021, true, true, false);
else
- if (_isWallBroken)
+ if (getGlobalVar(V_WALL_BROKEN))
createSmackerScene(0x001011B1, true, true, false);
else
createSmackerScene(0x001021B1, true, true, false);
@@ -195,8 +194,8 @@ void Module3000::updateScene() {
break;
case 2:
_vm->_soundMan->playTwoSounds(0x81293110, 0x41861371, 0x43A2507F, 0);
- if (_isWallBroken) {
- _soundVolume = 0;
+ if (_isWaterfallRunning) {
+ _waterfallSoundVolume = 0;
_vm->_soundMan->setSoundVolume(0x90F0D1C3, 0);
}
if (_moduleResult == 0) {
@@ -240,7 +239,7 @@ void Module3000::updateScene() {
createScene(8, -1);
break;
case 8:
- _isWallBroken = getGlobalVar(V_WALL_BROKEN) != 0;
+ _isWaterfallRunning = getGlobalVar(V_WALL_BROKEN) != 1;
if (_moduleResult != 1) {
_vm->_soundMan->setSoundListParams(kModule3000SoundList, true, 0, 0, 0, 0);
createScene(4, 1);
@@ -301,12 +300,12 @@ void Module3000::updateScene() {
} else if (frameNumber == 10) {
_vm->_soundMan->playTwoSounds(0x81293110, 0x40030A51, 0xC862CA15, 0);
}
- if (!_isWallBroken && _soundVolume < 90 && frameNumber % 2) {
+ if (_isWaterfallRunning && _waterfallSoundVolume < 90 && frameNumber % 2) {
if (frameNumber == 0)
- _soundVolume = 40;
+ _waterfallSoundVolume = 40;
else
- _soundVolume++;
- _vm->_soundMan->setSoundVolume(0x90F0D1C3, _soundVolume);
+ _waterfallSoundVolume++;
+ _vm->_soundMan->setSoundVolume(0x90F0D1C3, _waterfallSoundVolume);
}
}
}
@@ -315,9 +314,9 @@ void Module3000::updateScene() {
if (navigationScene()->isWalkingForward()) {
uint32 frameNumber = navigationScene()->getFrameNumber();
int navigationIndex = navigationScene()->getNavigationIndex();
- if (!_isWallBroken && _soundVolume > 1 && frameNumber % 2) {
- _soundVolume--;
- _vm->_soundMan->setSoundVolume(0x90F0D1C3, _soundVolume);
+ if (_isWaterfallRunning && _waterfallSoundVolume > 1 && frameNumber % 2) {
+ _waterfallSoundVolume--;
+ _vm->_soundMan->setSoundVolume(0x90F0D1C3, _waterfallSoundVolume);
}
if (navigationIndex == 0) {
if (frameNumber == 35) {
@@ -340,12 +339,12 @@ void Module3000::updateScene() {
if (frameNumber == 40) {
_vm->_soundMan->playTwoSounds(0x81293110, 0x40030A51, 0xC862CA15, 0);
}
- if (!_isWallBroken && _soundVolume < 90 && frameNumber % 2) {
+ if (_isWaterfallRunning && _waterfallSoundVolume < 90 && frameNumber % 2) {
if (frameNumber == 0)
- _soundVolume = 40;
+ _waterfallSoundVolume = 40;
else
- _soundVolume++;
- _vm->_soundMan->setSoundVolume(0x90F0D1C3, _soundVolume);
+ _waterfallSoundVolume++;
+ _vm->_soundMan->setSoundVolume(0x90F0D1C3, _waterfallSoundVolume);
}
}
}
diff --git a/engines/neverhood/modules/module3000.h b/engines/neverhood/modules/module3000.h
index e5c251f828..3d895b8d8a 100644
--- a/engines/neverhood/modules/module3000.h
+++ b/engines/neverhood/modules/module3000.h
@@ -34,8 +34,8 @@ public:
Module3000(NeverhoodEngine *vm, Module *parentModule, int which);
virtual ~Module3000();
protected:
- int _soundVolume;
- bool _isWallBroken;
+ int _waterfallSoundVolume;
+ bool _isWaterfallRunning;
void createScene(int sceneNum, int which);
void updateScene();
};
diff --git a/engines/parallaction/saveload.h b/engines/parallaction/saveload.h
index dbbbb42066..c9b724e69d 100644
--- a/engines/parallaction/saveload.h
+++ b/engines/parallaction/saveload.h
@@ -71,12 +71,12 @@ public:
};
class SaveLoad_br : public SaveLoad {
- Parallaction_br *_vm;
+// Parallaction_br *_vm;
virtual void doLoadGame(uint16 slot);
virtual void doSaveGame(uint16 slot, const char* name);
public:
- SaveLoad_br(Parallaction_br *vm, Common::SaveFileManager *saveFileMan) : SaveLoad(saveFileMan, "bra"), _vm(vm) { }
+ SaveLoad_br(Parallaction_br *vm, Common::SaveFileManager *saveFileMan) : SaveLoad(saveFileMan, "bra") { }
virtual void getGamePartProgress(bool *complete, int size);
virtual void setPartComplete(const char *part);
diff --git a/engines/pegasus/ai/ai_area.cpp b/engines/pegasus/ai/ai_area.cpp
index 5ac8af8812..9cab568d66 100644
--- a/engines/pegasus/ai/ai_area.cpp
+++ b/engines/pegasus/ai/ai_area.cpp
@@ -234,6 +234,7 @@ void AIArea::playAIAreaSequence(const LowerClientSignature, const LowerAreaSigna
vm->_cursor->hide();
while (_middleAreaMovie.isRunning()) {
+ InputDevice.pumpEvents();
vm->checkCallBacks();
vm->refreshDisplay();
g_system->delayMillis(10);
@@ -258,6 +259,7 @@ void AIArea::playAIAreaSequence(const LowerClientSignature, const LowerAreaSigna
vm->_cursor->hide();
while (_rightAreaMovie.isRunning()) {
+ InputDevice.pumpEvents();
vm->checkCallBacks();
vm->refreshDisplay();
g_system->delayMillis(10);
diff --git a/engines/pegasus/energymonitor.cpp b/engines/pegasus/energymonitor.cpp
index be9d205360..40e54afb89 100644
--- a/engines/pegasus/energymonitor.cpp
+++ b/engines/pegasus/energymonitor.cpp
@@ -269,6 +269,7 @@ void EnergyMonitor::calibrateEnergyBar() {
// Make sure warning light is hidden...
_energyLight.hide();
while (getCurrentEnergy() != (int32)kMaxJMPEnergy) {
+ InputDevice.pumpEvents();
vm->checkCallBacks();
vm->refreshDisplay();
g_system->delayMillis(10);
diff --git a/engines/pegasus/fader.cpp b/engines/pegasus/fader.cpp
index a2bbf22944..80ce8ef5dc 100644
--- a/engines/pegasus/fader.cpp
+++ b/engines/pegasus/fader.cpp
@@ -94,6 +94,7 @@ void Fader::startFaderSync(const FaderMoveSpec &spec) {
start();
while (isFading()) {
+ InputDevice.pumpEvents();
((PegasusEngine *)g_engine)->checkCallBacks();
useIdleTime();
}
diff --git a/engines/pegasus/input.cpp b/engines/pegasus/input.cpp
index b74e4a4c45..283d55421f 100644
--- a/engines/pegasus/input.cpp
+++ b/engines/pegasus/input.cpp
@@ -81,9 +81,7 @@ void InputDeviceManager::getInput(Input &input, const InputBits filter) {
// (ie. if one uses enter to access the restore menu, we never receive
// the key up event, which leads to bad things)
// This is to closely emulate what the GetKeys() function did on Mac OS
- Common::Event event;
- while (g_system->getEventManager()->pollEvent(event))
- ;
+ pumpEvents();
// Now create the bitfield
InputBits currentBits = 0;
@@ -206,6 +204,13 @@ bool InputDeviceManager::notifyEvent(const Common::Event &event) {
return false;
}
+void InputDeviceManager::pumpEvents() {
+ // Just poll for events. notifyEvent() will pick up on them.
+ Common::Event event;
+ while (g_system->getEventManager()->pollEvent(event))
+ ;
+}
+
int operator==(const Input &arg1, const Input &arg2) {
return arg1._inputState == arg2._inputState;
}
diff --git a/engines/pegasus/input.h b/engines/pegasus/input.h
index 3e938fa42a..ba6f11dba0 100644
--- a/engines/pegasus/input.h
+++ b/engines/pegasus/input.h
@@ -50,6 +50,8 @@ public:
void waitInput(const InputBits);
+ void pumpEvents();
+
protected:
friend class Common::Singleton<SingletonBaseType>;
diff --git a/engines/pegasus/interface.cpp b/engines/pegasus/interface.cpp
index f2429bf36a..f8ae6a0752 100644
--- a/engines/pegasus/interface.cpp
+++ b/engines/pegasus/interface.cpp
@@ -604,6 +604,7 @@ void Interface::raiseInventoryDrawerSync() {
raiseInventoryDrawer(false);
while (_inventoryLid.isRunning()) {
+ InputDevice.pumpEvents();
vm->checkCallBacks();
vm->refreshDisplay();
g_system->delayMillis(10);
@@ -613,6 +614,7 @@ void Interface::raiseInventoryDrawerSync() {
inventoryLidOpen(false);
while (_inventoryPush.isFading()) {
+ InputDevice.pumpEvents();
vm->checkCallBacks();
vm->refreshDisplay();
g_system->delayMillis(10);
@@ -628,6 +630,7 @@ void Interface::lowerInventoryDrawerSync() {
lowerInventoryDrawer(false);
while (_inventoryPush.isFading()) {
+ InputDevice.pumpEvents();
vm->checkCallBacks();
vm->refreshDisplay();
g_system->delayMillis(10);
@@ -637,6 +640,7 @@ void Interface::lowerInventoryDrawerSync() {
inventoryDrawerDown(false);
while (_inventoryLid.isRunning()) {
+ InputDevice.pumpEvents();
vm->checkCallBacks();
vm->refreshDisplay();
g_system->delayMillis(10);
@@ -652,6 +656,7 @@ void Interface::raiseBiochipDrawerSync() {
raiseBiochipDrawer(false);
while (_biochipLid.isRunning()) {
+ InputDevice.pumpEvents();
vm->checkCallBacks();
vm->refreshDisplay();
g_system->delayMillis(10);
@@ -661,6 +666,7 @@ void Interface::raiseBiochipDrawerSync() {
biochipLidOpen(false);
while (_biochipPush.isFading()) {
+ InputDevice.pumpEvents();
vm->checkCallBacks();
vm->refreshDisplay();
g_system->delayMillis(10);
@@ -676,6 +682,7 @@ void Interface::lowerBiochipDrawerSync() {
lowerBiochipDrawer(false);
while (_biochipPush.isFading()) {
+ InputDevice.pumpEvents();
vm->checkCallBacks();
vm->refreshDisplay();
g_system->delayMillis(10);
@@ -685,6 +692,7 @@ void Interface::lowerBiochipDrawerSync() {
biochipDrawerDown(false);
while (_biochipLid.isRunning()) {
+ InputDevice.pumpEvents();
vm->checkCallBacks();
vm->refreshDisplay();
g_system->delayMillis(10);
diff --git a/engines/pegasus/items/inventorypicture.cpp b/engines/pegasus/items/inventorypicture.cpp
index fc812faae2..bfdc382f5d 100644
--- a/engines/pegasus/items/inventorypicture.cpp
+++ b/engines/pegasus/items/inventorypicture.cpp
@@ -331,6 +331,7 @@ void InventoryItemsPicture::playEndMessage(DisplayElement *pushElement) {
endMessage.start();
while (endMessage.isRunning()) {
+ InputDevice.pumpEvents();
vm->checkCallBacks();
vm->refreshDisplay();
g_system->delayMillis(10);
diff --git a/engines/pegasus/items/item.cpp b/engines/pegasus/items/item.cpp
index 8089f2b93d..830d3f2f34 100644
--- a/engines/pegasus/items/item.cpp
+++ b/engines/pegasus/items/item.cpp
@@ -39,9 +39,9 @@
namespace Pegasus {
Item::Item(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) : IDObject(id) {
- _itemNeighborhood = neighborhood;
- _itemRoom = room;
- _itemDirection = direction;
+ _originalNeighborhood = _itemNeighborhood = neighborhood;
+ _originalRoom = _itemRoom = room;
+ _originalDirection = _itemDirection = direction;
_itemWeight = 1;
_itemOwnerID = kNoActorID;
_itemState = 0;
@@ -131,6 +131,14 @@ Item::~Item() {
delete[] _itemExtras.entries;
}
+void Item::reset() {
+ _itemNeighborhood = _originalNeighborhood;
+ _itemRoom = _originalRoom;
+ _itemDirection = _originalDirection;
+ _itemOwnerID = kNoActorID;
+ _itemState = 0;
+}
+
void Item::writeToStream(Common::WriteStream *stream) {
stream->writeUint16BE(_itemNeighborhood);
stream->writeUint16BE(_itemRoom);
diff --git a/engines/pegasus/items/item.h b/engines/pegasus/items/item.h
index a1451b2a58..26cccf043c 100644
--- a/engines/pegasus/items/item.h
+++ b/engines/pegasus/items/item.h
@@ -339,6 +339,9 @@ public:
void findItemExtra(const uint32 extraID, ItemExtraEntry &entry);
+ // Reset to its original state at the beginning of the game
+ void reset();
+
protected:
NeighborhoodID _itemNeighborhood;
RoomID _itemRoom;
@@ -347,6 +350,10 @@ protected:
WeightType _itemWeight;
ItemState _itemState;
+ NeighborhoodID _originalNeighborhood;
+ RoomID _originalRoom;
+ DirectionConstant _originalDirection;
+
JMPItemInfo _itemInfo;
ItemStateInfo _sharedAreaInfo;
ItemExtraInfo _itemExtras;
diff --git a/engines/pegasus/items/itemlist.cpp b/engines/pegasus/items/itemlist.cpp
index ff8cae546b..4b58d9ad78 100644
--- a/engines/pegasus/items/itemlist.cpp
+++ b/engines/pegasus/items/itemlist.cpp
@@ -64,4 +64,9 @@ Item *ItemList::findItemByID(const ItemID id) {
return 0;
}
+void ItemList::resetAllItems() {
+ for (ItemIterator it = begin(); it != end(); it++)
+ (*it)->reset();
+}
+
} // End of namespace Pegasus
diff --git a/engines/pegasus/items/itemlist.h b/engines/pegasus/items/itemlist.h
index 9b59206ab3..22bef2c96e 100644
--- a/engines/pegasus/items/itemlist.h
+++ b/engines/pegasus/items/itemlist.h
@@ -48,6 +48,7 @@ public:
virtual void readFromStream(Common::ReadStream *stream);
Item *findItemByID(const ItemID id);
+ void resetAllItems();
};
typedef ItemList::iterator ItemIterator;
diff --git a/engines/pegasus/menu.cpp b/engines/pegasus/menu.cpp
index e55c006f86..4bbda8fd93 100644
--- a/engines/pegasus/menu.cpp
+++ b/engines/pegasus/menu.cpp
@@ -227,6 +227,7 @@ MainMenu::MainMenu() : GameMenu(kMainMenuID), _menuBackground(0), _overviewButto
_menuLoop.attachFader(&_menuFader);
_menuLoop.initFromAIFFFile("Sounds/Main Menu.aiff");
+ _menuFader.setMasterVolume(((PegasusEngine *)g_engine)->getAmbienceLevel());
updateDisplay();
}
@@ -736,6 +737,7 @@ DeathMenu::DeathMenu(const DeathReason deathReason) : GameMenu(kDeathMenuID), _d
_largeSelect.startDisplaying();
} else {
_triumphSound.initFromQuickTime("Sounds/Caldoria/Galactic Triumph");
+ _triumphSound.setVolume(((PegasusEngine *)g_engine)->getAmbienceLevel());
_triumphSound.playSound();
}
diff --git a/engines/pegasus/neighborhood/caldoria/caldoria.cpp b/engines/pegasus/neighborhood/caldoria/caldoria.cpp
index 0707a83e87..9d2d6723a9 100644
--- a/engines/pegasus/neighborhood/caldoria/caldoria.cpp
+++ b/engines/pegasus/neighborhood/caldoria/caldoria.cpp
@@ -196,6 +196,8 @@ void Caldoria::start() {
if (!pullbackMovie->loadFile("Images/Caldoria/Pullback.movie"))
error("Could not load pullback movie");
+ pullbackMovie->setVolume(MIN<uint>(_vm->getSoundFXLevel(), 0xFF));
+
// Draw the first frame so we can fade to it
const Graphics::Surface *frame = pullbackMovie->decodeNextFrame();
assert(frame);
@@ -907,7 +909,7 @@ void Caldoria::arriveAtCaldoria49() {
setCurrentAlternate(kAltCaldoriaNormal);
// Need to force the loop to play.
- if (GameState.getCurrentDirection() == kNorth) {
+ if (GameState.getCurrentDirection() == kNorth && !GameState.getCaldoriaSinclairShot()) {
GameState.setCaldoriaFuseTimeLimit(kSinclairShootsTimeLimit);
startExtraSequence(kCa49NorthVoiceAnalysis, kExtraCompletedFlag, kFilterNoInput);
}
@@ -1916,10 +1918,13 @@ uint Caldoria::getNumHints() {
numHints = 1;
}
break;
+#if 0
+ // The hint file is missing
case MakeRoomView(kCaldoria49, kEast):
case MakeRoomView(kCaldoria54, kEast):
numHints = 1;
break;
+#endif
case MakeRoomView(kCaldoria49, kNorth):
numHints = 1;
break;
@@ -1950,9 +1955,12 @@ Common::String Caldoria::getHintMovie(uint hintNum) {
}
return "Images/AI/Globals/XGLOB1A";
+#if 0
+ // The hint file is missing
case MakeRoomView(kCaldoria49, kEast):
case MakeRoomView(kCaldoria54, kEast):
return "Images/AI/Caldoria/X49E";
+#endif
case MakeRoomView(kCaldoria49, kNorth):
return "Images/AI/Caldoria/X49NB2";
}
diff --git a/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp b/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp
index abf34d3863..c964e3458b 100644
--- a/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp
+++ b/engines/pegasus/neighborhood/caldoria/caldoriabomb.cpp
@@ -1167,6 +1167,18 @@ CaldoriaBomb::~CaldoriaBomb() {
delete[] _bombLevel[i];
}
+void CaldoriaBomb::setSoundFXLevel(const uint16) {
+ // The transition sounds between levels are ambience, so overwrite what
+ // Neighborhood::setSoundFXLevel does and keep using the ambience volume level
+ if (_timer.isRunning())
+ _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getAmbienceLevel());
+}
+
+void CaldoriaBomb::setAmbienceLevel(const uint16 level) {
+ if (_timer.isRunning())
+ _owner->_navMovie.setVolume(level);
+}
+
void CaldoriaBomb::openInteraction() {
_grid.moveElementTo(kCaldoriaBombGridLeft, kCaldoriaBombGridTop);
_grid.setDisplayOrder(kCaldoriaBombGridOrder);
@@ -1234,6 +1246,7 @@ void CaldoriaBomb::receiveNotification(Notification *notification, const Notific
_timer.start();
_currentLevel = 0;
_lastVertex = -1;
+ _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getAmbienceLevel());
startBombAmbient("Sounds/Caldoria/BmbLoop1.22K.AIFF");
break;
case kCaldoria56BombStage2:
@@ -1258,6 +1271,7 @@ void CaldoriaBomb::receiveNotification(Notification *notification, const Notific
_grid.hide();
_timer.stop();
_timer.hide();
+ _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
_owner->loadLoopSound1("");
_owner->playDeathExtra(kCaldoria56BombExplodes, kDeathNuclearExplosion);
}
@@ -1411,6 +1425,7 @@ void CaldoriaBomb::handleInput(const Input &input, const Hotspot *hotspot) {
_timer.stop();
_grid.hide();
_timer.hide();
+ _owner->_navMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
_owner->startExtraSequence(kCaldoria56BombStage7, kExtraCompletedFlag, kFilterNoInput);
break;
}
diff --git a/engines/pegasus/neighborhood/caldoria/caldoriabomb.h b/engines/pegasus/neighborhood/caldoria/caldoriabomb.h
index 5bb39b4122..ba6d1e8998 100644
--- a/engines/pegasus/neighborhood/caldoria/caldoriabomb.h
+++ b/engines/pegasus/neighborhood/caldoria/caldoriabomb.h
@@ -122,6 +122,9 @@ public:
CaldoriaBomb(Neighborhood *, NotificationManager *);
virtual ~CaldoriaBomb();
+ void setSoundFXLevel(const uint16);
+ void setAmbienceLevel(const uint16);
+
long getNumHints();
Common::String getHintMovie(uint);
void doSolve();
diff --git a/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp b/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp
index a3ce97d438..2ae990d775 100644
--- a/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp
+++ b/engines/pegasus/neighborhood/caldoria/caldoriamessages.cpp
@@ -24,6 +24,7 @@
*/
#include "pegasus/gamestate.h"
+#include "pegasus/pegasus.h"
#include "pegasus/neighborhood/neighborhood.h"
#include "pegasus/neighborhood/caldoria/caldoria.h"
#include "pegasus/neighborhood/caldoria/caldoriamessages.h"
@@ -45,6 +46,10 @@ void CaldoriaMessages::openInteraction() {
_messageNumber = 1;
}
+void CaldoriaMessages::setSoundFXLevel(const uint16 fxLevel) {
+ _messageMovie.setVolume(fxLevel);
+}
+
void CaldoriaMessages::initInteraction() {
GameInteraction::_owner->startExtraSequence(kCaBedroomVidPhone, kExtraCompletedFlag, kFilterNoInput);
}
@@ -101,6 +106,7 @@ void CaldoriaMessages::play1Message(uint messageNumber) {
GameState.setCaldoriaSeenMessages(true);
}
+ _messageMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
_messageMovie.moveElementTo(kCaldoriaMessageLeft, kCaldoriaMessageTop);
_messageMovie.setDisplayOrder(kCaldoriaMessagesOrder);
_messageMovie.startDisplaying();
diff --git a/engines/pegasus/neighborhood/caldoria/caldoriamessages.h b/engines/pegasus/neighborhood/caldoria/caldoriamessages.h
index 955fe10ce9..b2fc7c3bf9 100644
--- a/engines/pegasus/neighborhood/caldoria/caldoriamessages.h
+++ b/engines/pegasus/neighborhood/caldoria/caldoriamessages.h
@@ -41,6 +41,8 @@ public:
CaldoriaMessages(Neighborhood *, const NotificationID, NotificationManager *);
virtual ~CaldoriaMessages() {}
+ void setSoundFXLevel(const uint16);
+
protected:
void openInteraction();
void initInteraction();
diff --git a/engines/pegasus/neighborhood/mars/mars.cpp b/engines/pegasus/neighborhood/mars/mars.cpp
index 435bcd4c9e..df5a75541c 100644
--- a/engines/pegasus/neighborhood/mars/mars.cpp
+++ b/engines/pegasus/neighborhood/mars/mars.cpp
@@ -535,6 +535,10 @@ void Mars::doorOpened() {
}
void Mars::setUpReactorEnergyDrain() {
+ // If there's no energy monitor, there's nothing to do
+ if (!g_energyMonitor)
+ return;
+
switch (GameState.getCurrentRoomAndView()) {
case MakeRoomView(kMars51, kEast):
if (GameState.isCurrentDoorOpen()) {
@@ -2398,6 +2402,8 @@ void Mars::doCanyonChase() {
if (!video->loadFile("Images/Mars/M44ESA.movie"))
error("Could not load interface->shuttle transition video");
+ video->setVolume(MIN<uint>(_vm->getSoundFXLevel(), 0xFF));
+
video->start();
while (!_vm->shouldQuit() && !video->endOfVideo()) {
@@ -2476,6 +2482,7 @@ void Mars::doCanyonChase() {
_shuttleEnergyMeter.initShuttleEnergyMeter();
_shuttleEnergyMeter.powerUpMeter();
while (_shuttleEnergyMeter.isFading()) {
+ InputDevice.pumpEvents();
_vm->checkCallBacks();
_vm->refreshDisplay();
g_system->updateScreen();
@@ -2607,6 +2614,7 @@ void Mars::startUpFromFinishedSpaceChase() {
kShuttleJunkTop, false);
initOneMovie(&_explosions, "Images/Mars/Explosions.movie", kShuttleWeaponFrontOrder, 0, 0, false);
+ _explosions.setVolume(_vm->getSoundFXLevel());
_explosionCallBack.initCallBack(&_explosions, kCallBackAtExtremes);
_energyBeam.initShuttleWeapon();
@@ -2645,6 +2653,7 @@ void Mars::startUpFromFinishedSpaceChase() {
initOneMovie(&_canyonChaseMovie, "Images/Mars/M98EAS.movie", kShuttleTractorBeamMovieOrder,
kShuttleWindowLeft, kShuttleWindowTop, true);
+ _canyonChaseMovie.setVolume(_vm->getSoundFXLevel());
_canyonChaseMovie.setTime(_canyonChaseMovie.getDuration());
_canyonChaseMovie.redrawMovieWorld();
}
@@ -2720,6 +2729,7 @@ void Mars::startUpFromSpaceChase() {
kShuttleJunkTop, false);
initOneMovie(&_explosions, "Images/Mars/Explosions.movie", kShuttleWeaponFrontOrder, 0, 0, false);
+ _explosions.setVolume(_vm->getSoundFXLevel());
_explosionCallBack.initCallBack(&_explosions, kCallBackAtExtremes);
_energyBeam.initShuttleWeapon();
@@ -2783,6 +2793,10 @@ void Mars::startUpFromSpaceChase() {
void Mars::setSoundFXLevel(const uint16 level) {
Neighborhood::setSoundFXLevel(level);
+ if (GameState.getCurrentRoomAndView() == MakeRoomView(kMars48, kEast) &&
+ !GameState.getMarsAvoidedReactorRobot())
+ _loop2Fader.setMasterVolume(level);
+
if (_canyonChaseMovie.isMovieValid())
_canyonChaseMovie.setVolume(level);
@@ -2812,6 +2826,7 @@ void Mars::marsTimerExpired(MarsTimerEvent &event) {
GameState.setScoringEnteredLaunchTube();
while (_canyonChaseMovie.isRunning()) {
+ InputDevice.pumpEvents();
_vm->checkCallBacks();
_vm->refreshDisplay();
_vm->_system->delayMillis(10);
@@ -2836,6 +2851,7 @@ void Mars::marsTimerExpired(MarsTimerEvent &event) {
initOneMovie(&_junk, "Images/Mars/Junk.movie", kShuttleJunkOrder, kShuttleJunkLeft, kShuttleJunkTop, false);
initOneMovie(&_explosions, "Images/Mars/Explosions.movie", kShuttleWeaponFrontOrder, 0, 0, false);
+ _explosions.setVolume(_vm->getSoundFXLevel());
_explosionCallBack.initCallBack(&_explosions, kCallBackAtExtremes);
_energyBeam.initShuttleWeapon();
@@ -2945,6 +2961,7 @@ void Mars::marsTimerExpired(MarsTimerEvent &event) {
showBigExplosion(r, kShuttleAlienShipOrder);
while (_explosions.isRunning()) {
+ InputDevice.pumpEvents();
_vm->checkCallBacks();
_vm->refreshDisplay();
g_system->delayMillis(10);
@@ -3138,6 +3155,7 @@ void Mars::spaceChaseClick(const Input &input, const HotSpotID id) {
_shuttleEnergyMeter.drainForTractorBeam();
while (_shuttleEnergyMeter.isFading()) {
+ InputDevice.pumpEvents();
_vm->checkCallBacks();
_vm->refreshDisplay();
_vm->_system->delayMillis(10);
@@ -3167,11 +3185,13 @@ void Mars::spaceChaseClick(const Input &input, const HotSpotID id) {
// Shameless reuse of a variable :P
initOneMovie(&_canyonChaseMovie, "Images/Mars/M98EAS.movie", kShuttleTractorBeamMovieOrder,
kShuttleWindowLeft, kShuttleWindowTop, true);
+ _canyonChaseMovie.setVolume(_vm->getSoundFXLevel());
_canyonChaseMovie.redrawMovieWorld();
playMovieSegment(&_canyonChaseMovie, 0, _canyonChaseMovie.getDuration());
// wait here until any junk clears...
while (_junk.junkFlying()) {
+ InputDevice.pumpEvents();
_vm->checkCallBacks();
_vm->refreshDisplay();
_vm->_system->delayMillis(10);
diff --git a/engines/pegasus/neighborhood/neighborhood.cpp b/engines/pegasus/neighborhood/neighborhood.cpp
index 3116bd7978..c9be349694 100644
--- a/engines/pegasus/neighborhood/neighborhood.cpp
+++ b/engines/pegasus/neighborhood/neighborhood.cpp
@@ -470,6 +470,7 @@ void Neighborhood::requestSpotSound(const TimeValue in, const TimeValue out, con
void Neighborhood::playSpotSoundSync(const TimeValue in, const TimeValue out) {
// Let the action queue play out first...
while (!actionQueueEmpty()) {
+ InputDevice.pumpEvents();
_vm->checkCallBacks();
_vm->refreshDisplay();
_vm->checkNotifications();
@@ -480,6 +481,7 @@ void Neighborhood::playSpotSoundSync(const TimeValue in, const TimeValue out) {
_spotSounds.playSoundSegment(in, out);
while (_spotSounds.isPlaying()) {
+ InputDevice.pumpEvents();
_vm->checkCallBacks();
_vm->refreshDisplay();
_vm->_system->delayMillis(10);
@@ -1105,6 +1107,7 @@ void Neighborhood::startTurnPush(const TurnDirection turnDirection, const TimeVa
_turnPush.continueFader();
do {
+ InputDevice.pumpEvents();
_vm->checkCallBacks();
_vm->refreshDisplay();
_vm->_system->delayMillis(10);
@@ -1492,7 +1495,15 @@ void Neighborhood::loadLoopSound2(const Common::String &soundName, uint16 volume
if (!_loop2SoundString.empty()) {
_soundLoop2.initFromAIFFFile(_loop2SoundString);
_soundLoop2.loopSound();
- _loop2Fader.setMasterVolume(_vm->getAmbienceLevel());
+ // HACK: Some ambient loops are actually sound effects, like Ares waiting at
+ // the reactor and Poseidon at the launch console. Detect these and use the
+ // SFX volume instead of ambience.
+ if (soundName == "Sounds/Mars/Robot Loop.aiff" ||
+ soundName == "Sounds/Norad/Breathing Typing.22K.AIFF" ||
+ soundName == "Sounds/Norad/N54NAS.32K.AIFF")
+ _loop2Fader.setMasterVolume(_vm->getSoundFXLevel());
+ else
+ _loop2Fader.setMasterVolume(_vm->getAmbienceLevel());
_loop2Fader.setFaderValue(0);
faderMove.makeTwoKnotFaderSpec(fadeScale, 0, 0, fadeIn, volume);
_loop2Fader.startFaderSync(faderMove);
@@ -1577,6 +1588,7 @@ void Neighborhood::closeCroppedMovie() {
void Neighborhood::playCroppedMovieOnce(const Common::String &movieName, CoordType left, CoordType top, const InputBits interruptionFilter) {
openCroppedMovie(movieName, left, top);
+ _croppedMovie.setVolume(_vm->getSoundFXLevel());
_croppedMovie.redrawMovieWorld();
_croppedMovie.start();
@@ -1616,6 +1628,7 @@ void Neighborhood::playMovieSegment(Movie *movie, TimeValue startTime, TimeValue
movie->start();
while (movie->isRunning()) {
+ InputDevice.pumpEvents();
_vm->checkCallBacks();
_vm->refreshDisplay();
_vm->_system->delayMillis(10);
diff --git a/engines/pegasus/neighborhood/neighborhood.h b/engines/pegasus/neighborhood/neighborhood.h
index 3c1c5eac92..f7f2b038c6 100644
--- a/engines/pegasus/neighborhood/neighborhood.h
+++ b/engines/pegasus/neighborhood/neighborhood.h
@@ -91,6 +91,7 @@ struct QueueRequest {
bool operator==(const QueueRequest &arg1, const QueueRequest &arg2);
bool operator!=(const QueueRequest &arg1, const QueueRequest &arg2);
+class CaldoriaBomb;
class GameInteraction;
class Item;
class Neighborhood;
@@ -109,6 +110,7 @@ protected:
typedef Common::Queue<QueueRequest> NeighborhoodActionQueue;
class Neighborhood : public IDObject, public NotificationReceiver, public InputHandler, public Idler {
+friend class CaldoriaBomb;
friend class StriderCallBack;
public:
diff --git a/engines/pegasus/neighborhood/norad/delta/globegame.cpp b/engines/pegasus/neighborhood/norad/delta/globegame.cpp
index 0b95e9bc2b..5c321a8e8a 100644
--- a/engines/pegasus/neighborhood/norad/delta/globegame.cpp
+++ b/engines/pegasus/neighborhood/norad/delta/globegame.cpp
@@ -453,8 +453,13 @@ GlobeGame::GlobeGame(Neighborhood *handler) : GameInteraction(kNoradGlobeGameInt
_neighborhoodNotification = handler->getNeighborhoodNotification();
}
+void GlobeGame::setSoundFXLevel(const uint16 fxLevel) {
+ _monitorMovie.setVolume(fxLevel);
+}
+
void GlobeGame::openInteraction() {
_monitorMovie.initFromMovieFile("Images/Norad Delta/N79 Left Monitor");
+ _monitorMovie.setVolume(((PegasusEngine *)g_engine)->getSoundFXLevel());
_monitorMovie.moveElementTo(kGlobeMonitorLeft, kGlobeMonitorTop);
_monitorMovie.setDisplayOrder(kGlobeMonitorLayer);
_monitorMovie.startDisplaying();
diff --git a/engines/pegasus/neighborhood/norad/delta/globegame.h b/engines/pegasus/neighborhood/norad/delta/globegame.h
index 73ed48866f..93235a1784 100644
--- a/engines/pegasus/neighborhood/norad/delta/globegame.h
+++ b/engines/pegasus/neighborhood/norad/delta/globegame.h
@@ -98,6 +98,8 @@ public:
GlobeGame(Neighborhood *);
virtual ~GlobeGame() {}
+ void setSoundFXLevel(const uint16);
+
void handleInput(const Input &, const Hotspot *);
void clickInHotspot(const Input &, const Hotspot *);
void activateHotspots();
diff --git a/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp b/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp
index 1eea2f0156..ee047d72b2 100644
--- a/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp
+++ b/engines/pegasus/neighborhood/norad/delta/noraddelta.cpp
@@ -514,6 +514,17 @@ void NoradDelta::openDoor() {
}
}
+void NoradDelta::cantMoveThatWay(CanOpenDoorReason reason) {
+ // WORKAROUND: The door outside the launch console room isn't treated as a door,
+ // so play the correct sound.
+ if (reason == kCantMoveBlocked && GameState.getCurrentRoomAndView() == MakeRoomView(kNorad67, kNorth)) {
+ cantOpenDoor(kCantOpenLocked);
+ return;
+ }
+
+ Neighborhood::cantMoveThatWay(reason);
+}
+
void NoradDelta::activateHotspots() {
Norad::activateHotspots();
@@ -863,6 +874,13 @@ void NoradDelta::doSolve() {
}
}
+void NoradDelta::setSoundFXLevel(const uint16 level) {
+ Neighborhood::setSoundFXLevel(level);
+
+ if (GameState.getCurrentRoomAndView() == MakeRoomView(kNorad54North, kNorth))
+ _loop2Fader.setMasterVolume(level);
+}
+
Common::String NoradDelta::getSoundSpotsName() {
return "Sounds/Norad/Norad Delta Spots";
}
diff --git a/engines/pegasus/neighborhood/norad/delta/noraddelta.h b/engines/pegasus/neighborhood/norad/delta/noraddelta.h
index 11065f2c9d..591fd691a2 100644
--- a/engines/pegasus/neighborhood/norad/delta/noraddelta.h
+++ b/engines/pegasus/neighborhood/norad/delta/noraddelta.h
@@ -68,6 +68,8 @@ public:
bool canSolve();
void doSolve();
+ void setSoundFXLevel(const uint16);
+
void doorOpened();
protected:
@@ -90,6 +92,7 @@ protected:
void arriveAtNorad79West();
TimeValue getViewTime(const RoomID, const DirectionConstant);
void openDoor();
+ void cantMoveThatWay(CanMoveForwardReason);
void activateHotspots();
void clickInHotspot(const Input &, const Hotspot *);
void receiveNotification(Notification *, const NotificationFlags);
diff --git a/engines/pegasus/neighborhood/tsa/fulltsa.cpp b/engines/pegasus/neighborhood/tsa/fulltsa.cpp
index 75f652ad56..92b79c038e 100644
--- a/engines/pegasus/neighborhood/tsa/fulltsa.cpp
+++ b/engines/pegasus/neighborhood/tsa/fulltsa.cpp
@@ -1692,7 +1692,9 @@ void FullTSA::initializeTBPMonitor(const int newMode, const ExtraID highlightExt
releaseSprites();
}
- _interruptionFilter = kFilterAllInput;
+ // Only allow input if we're not in the middle of series of queue requests.
+ if (actionQueueEmpty())
+ _interruptionFilter = kFilterAllInput;
}
void FullTSA::startUpComparisonMonitor() {
@@ -2643,6 +2645,7 @@ void FullTSA::receiveNotification(Notification *notification, const Notification
GameState.setMarsReadyForShuttleTransport(false);
GameState.setMarsFinishedCanyonChase(false);
GameState.setMarsThreadedMaze(false);
+ GameState.setMarsSawRobotLeave(false);
break;
case kPlayerOnWayToWSC:
_vm->jumpToNewEnvironment(kWSCID, kWSC01, kWest);
diff --git a/engines/pegasus/neighborhood/tsa/tinytsa.cpp b/engines/pegasus/neighborhood/tsa/tinytsa.cpp
index 0326c7f2ee..c808325b0f 100644
--- a/engines/pegasus/neighborhood/tsa/tinytsa.cpp
+++ b/engines/pegasus/neighborhood/tsa/tinytsa.cpp
@@ -327,6 +327,7 @@ void TinyTSA::receiveNotification(Notification *notification, const Notification
GameState.setMarsReadyForShuttleTransport(false);
GameState.setMarsFinishedCanyonChase(false);
GameState.setMarsThreadedMaze(false);
+ GameState.setMarsSawRobotLeave(false);
break;
case kPlayerOnWayToWSC:
_vm->jumpToNewEnvironment(kWSCID, kWSC01, kWest);
diff --git a/engines/pegasus/neighborhood/wsc/wsc.cpp b/engines/pegasus/neighborhood/wsc/wsc.cpp
index 09e2a48a52..f009b35cdc 100644
--- a/engines/pegasus/neighborhood/wsc/wsc.cpp
+++ b/engines/pegasus/neighborhood/wsc/wsc.cpp
@@ -2029,6 +2029,7 @@ void WSC::moleculeGameClick(const HotSpotID id) {
_moleculesMovie.start();
while (_moleculesMovie.isRunning()) {
+ InputDevice.pumpEvents();
_vm->checkCallBacks();
_vm->refreshDisplay();
_vm->_system->delayMillis(10);
@@ -2063,6 +2064,7 @@ void WSC::moleculeGameClick(const HotSpotID id) {
_moleculesMovie.start();
while (_moleculesMovie.isRunning()) {
+ InputDevice.pumpEvents();
_vm->checkCallBacks();
_vm->refreshDisplay();
_vm->_system->delayMillis(10);
@@ -2076,6 +2078,7 @@ void WSC::moleculeGameClick(const HotSpotID id) {
while (_moleculesMovie.isRunning()) {
+ InputDevice.pumpEvents();
_vm->checkCallBacks();
_vm->refreshDisplay();
_vm->_system->delayMillis(10);
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index c5edd34a01..0010180d8d 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -36,6 +36,7 @@
#include "backends/keymapper/keymapper.h"
#include "base/plugins.h"
#include "base/version.h"
+#include "gui/message.h"
#include "gui/saveload.h"
#include "video/theora_decoder.h"
#include "video/qt_decoder.h"
@@ -306,6 +307,7 @@ void PegasusEngine::runIntro() {
Video::VideoDecoder *video = new Video::QuickTimeDecoder();
if (video->loadFile(_introDirectory + "/BandaiLogo.movie")) {
+ video->setVolume(MIN<uint>(getAmbienceLevel(), 0xFF));
video->start();
while (!shouldQuit() && !video->endOfVideo() && !skipped) {
@@ -337,6 +339,8 @@ void PegasusEngine::runIntro() {
if (!video->loadFile(_introDirectory + "/Big Movie.movie"))
error("Could not load intro movie");
+ video->setVolume(MIN<uint>(getAmbienceLevel(), 0xFF));
+
video->seek(Audio::Timestamp(0, 10 * 600, 600));
video->start();
@@ -379,20 +383,21 @@ Common::Error PegasusEngine::showSaveDialog() {
int slot = slc.runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
- Common::Error result;
+ if (slot >= 0)
+ return saveGameState(slot, slc.getResultString());
- if (slot >= 0) {
- if (saveGameState(slot, slc.getResultString()).getCode() == Common::kNoError)
- result = Common::kNoError;
- else
- result = Common::kUnknownError;
- } else {
- result = Common::kUserCanceled;
- }
+ return Common::kUserCanceled;
+}
- return result;
+void PegasusEngine::showSaveFailedDialog(const Common::Error &status) {
+ Common::String failMessage = Common::String::format(_("Gamestate save failed (%s)! "
+ "Please consult the README for basic information, and for "
+ "instructions on how to obtain further assistance."), status.getDesc().c_str());
+ GUI::MessageDialog dialog(failMessage);
+ dialog.runModal();
}
+
GUI::Debugger *PegasusEngine::getDebugger() {
return _console;
}
@@ -792,6 +797,8 @@ void PegasusEngine::introTimerExpired() {
if (!video->loadFile(_introDirectory + "/LilMovie.movie"))
error("Failed to load little movie");
+ video->setVolume(MIN<uint>(getAmbienceLevel(), 0xFF));
+
bool saveAllowed = swapSaveAllowed(false);
bool openAllowed = swapLoadAllowed(false);
@@ -834,6 +841,7 @@ void PegasusEngine::delayShell(TimeValue time, TimeScale scale) {
uint32 timeInMillis = time * 1000 / scale;
while (g_system->getMillis() < startTime + timeInMillis) {
+ InputDevice.pumpEvents();
checkCallBacks();
_gfx->updateDisplay();
}
@@ -938,6 +946,8 @@ void PegasusEngine::doGameMenuCommand(const GameMenuCommand command) {
if (!video->loadFile(_introDirectory + "/Closing.movie"))
error("Could not load closing movie");
+ video->setVolume(MIN<uint>(getSoundFXLevel(), 0xFF));
+
uint16 x = (640 - video->getWidth() * 2) / 2;
uint16 y = (480 - video->getHeight() * 2) / 2;
@@ -969,8 +979,14 @@ void PegasusEngine::doGameMenuCommand(const GameMenuCommand command) {
resetIntroTimer();
break;
case kMenuCmdPauseSave:
- if (showSaveDialog().getCode() != Common::kUserCanceled)
+ result = showSaveDialog();
+
+ if (result.getCode() != Common::kUserCanceled) {
+ if (result.getCode() != Common::kNoError)
+ showSaveFailedDialog(result);
+
pauseMenu(false);
+ }
break;
case kMenuCmdPauseContinue:
pauseMenu(false);
@@ -1021,7 +1037,12 @@ void PegasusEngine::handleInput(const Input &input, const Hotspot *cursorSpot) {
// Can only save during a game and not in the demo
if (g_neighborhood && !isDemo()) {
pauseEngine(true);
- showSaveDialog();
+
+ Common::Error result = showSaveDialog();
+
+ if (result.getCode() != Common::kNoError && result.getCode() != Common::kUserCanceled)
+ showSaveFailedDialog(result);
+
pauseEngine(false);
}
}
@@ -1669,6 +1690,9 @@ void PegasusEngine::startNewGame() {
removeAllItemsFromInventory();
removeAllItemsFromBiochips();
+ // Properly reset all items to their original state
+ g_allItems.resetAllItems();
+
BiochipItem *biochip = (BiochipItem *)_allItems.findItemByID(kAIBiochip);
addItemToBiochips(biochip);
@@ -2159,6 +2183,7 @@ void PegasusEngine::autoDragItemIntoRoom(Item *item, Sprite *draggingSprite) {
_autoDragger.autoDrag(draggingSprite, start, stop, time, kDefaultTimeScale);
while (_autoDragger.isDragging()) {
+ InputDevice.pumpEvents();
checkCallBacks();
refreshDisplay();
_system->delayMillis(10);
@@ -2192,6 +2217,7 @@ void PegasusEngine::autoDragItemIntoInventory(Item *, Sprite *draggingSprite) {
_autoDragger.autoDrag(draggingSprite, start, stop, time, kDefaultTimeScale);
while (_autoDragger.isDragging()) {
+ InputDevice.pumpEvents();
checkCallBacks();
refreshDisplay();
_system->delayMillis(10);
@@ -2268,10 +2294,7 @@ void PegasusEngine::doSubChase() {
drawScaledFrame(frame, 0, 0);
}
- Common::Event event;
- while (_eventMan->pollEvent(event))
- ;
-
+ InputDevice.pumpEvents();
_system->delayMillis(10);
}
diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h
index fb66eb7586..d88545a4d1 100644
--- a/engines/pegasus/pegasus.h
+++ b/engines/pegasus/pegasus.h
@@ -257,6 +257,7 @@ private:
bool _saveAllowed, _loadAllowed; // It's so nice that this was in the original code already :P
Common::Error showLoadDialog();
Common::Error showSaveDialog();
+ void showSaveFailedDialog(const Common::Error &status);
bool _saveRequested, _loadRequested;
// Misc.
diff --git a/engines/queen/debug.cpp b/engines/queen/debug.cpp
index 96fa81488f..3706806ac2 100644
--- a/engines/queen/debug.cpp
+++ b/engines/queen/debug.cpp
@@ -21,6 +21,7 @@
*/
#include "common/scummsys.h"
+#include "common/util.h"
#include "queen/debug.h"
@@ -57,8 +58,17 @@ void Debugger::postEnter() {
_vm->graphics()->setupMouseCursor();
}
+static bool isNumeric(const char *arg) {
+ const char *str = arg;
+ bool retVal = true;
+ while (retVal && (*str != '\0')) {
+ retVal = Common::isDigit(*str++);
+ }
+ return retVal;
+}
+
bool Debugger::Cmd_Asm(int argc, const char **argv) {
- if (argc == 2) {
+ if (argc == 2 && isNumeric(argv[1])) {
uint16 sm = atoi(argv[1]);
_vm->logic()->executeSpecialMove(sm);
return false;
@@ -75,12 +85,17 @@ bool Debugger::Cmd_Areas(int argc, const char **argv) {
}
bool Debugger::Cmd_Bob(int argc, const char **argv) {
- if (argc >= 3) {
+ if (argc >= 3 && isNumeric(argv[1])) {
int bobNum = atoi(argv[1]);
if (bobNum >= Graphics::MAX_BOBS_NUMBER) {
DebugPrintf("Bob %d is out of range (range: 0 - %d)\n", bobNum, Graphics::MAX_BOBS_NUMBER);
} else {
- int param = (argc > 3) ? atoi(argv[3]) : 0;
+ int param = 0;
+ if (argc > 3 && isNumeric(argv[3])) {
+ param = atoi(argv[3]);
+ } else {
+ DebugPrintf("Invalid parameter for bob command '%s'\n", argv[2]);
+ }
BobSlot *bob = _vm->graphics()->bob(bobNum);
if (!strcmp(argv[2], "toggle")) {
bob->active = !bob->active;
@@ -109,22 +124,21 @@ bool Debugger::Cmd_Bob(int argc, const char **argv) {
bool Debugger::Cmd_GameState(int argc, const char **argv) {
uint16 slot;
- switch (argc) {
- case 2:
- slot = atoi(argv[1]);
- DebugPrintf("GAMESTATE[%d] ", slot);
- DebugPrintf("is %d\n", _vm->logic()->gameState(slot));
- break;
- case 3:
+ if ((argc == 2 || argc == 3) && isNumeric(argv[1])) {
slot = atoi(argv[1]);
DebugPrintf("GAMESTATE[%d] ", slot);
- DebugPrintf("was %d ", _vm->logic()->gameState(slot));
- _vm->logic()->gameState(slot, atoi(argv[2]));
- DebugPrintf("now %d\n", _vm->logic()->gameState(slot));
- break;
- default:
- DebugPrintf("Usage: %s slotnum value\n", argv[0]);
- break;
+ DebugPrintf("%s %d\n", (argc == 2) ? "is" : "was", _vm->logic()->gameState(slot));
+
+ if (argc == 3) {
+ if (isNumeric(argv[1])) {
+ _vm->logic()->gameState(slot, atoi(argv[2]));
+ DebugPrintf("now %d\n", _vm->logic()->gameState(slot));
+ } else {
+ DebugPrintf("Usage: %s slotnum <value>\n", argv[0]);
+ }
+ }
+ } else {
+ DebugPrintf("Usage: %s slotnum <value>\n", argv[0]);
}
return true;
}
@@ -164,7 +178,7 @@ bool Debugger::Cmd_PrintBobs(int argc, const char**argv) {
}
bool Debugger::Cmd_Room(int argc, const char **argv) {
- if (argc == 2) {
+ if (argc == 2 && isNumeric(argv[1])) {
uint16 roomNum = atoi(argv[1]);
_vm->logic()->joePos(0, 0);
_vm->logic()->newRoom(roomNum);
@@ -180,7 +194,7 @@ bool Debugger::Cmd_Room(int argc, const char **argv) {
}
bool Debugger::Cmd_Song(int argc, const char **argv) {
- if (argc == 2) {
+ if (argc == 2 && isNumeric(argv[1])) {
int16 songNum = atoi(argv[1]);
_vm->sound()->playSong(songNum);
DebugPrintf("Playing song %d\n", songNum);
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 29e29722d2..65acdbcdf5 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -37,6 +37,7 @@
#include "sci/engine/state.h"
#include "sci/engine/kernel.h"
#include "sci/engine/savegame.h"
+#include "sci/sound/audio.h"
#include "sci/console.h"
namespace Sci {
@@ -494,6 +495,21 @@ reg_t kFileIOWriteString(EngineState *s, int argc, reg_t *argv) {
Common::String str = s->_segMan->getString(argv[1]);
debugC(kDebugLevelFile, "kFileIO(writeString): %d", handle);
+ // Handle sciAudio calls in fanmade games here. sciAudio is an
+ // external .NET library for playing MP3 files in fanmade games.
+ // It runs in the background, and obtains sound commands from the
+ // currently running game via text files (called "conductor files").
+ // We skip creating these files, and instead handle the calls
+ // directly. Since the sciAudio calls are only creating text files,
+ // this is probably the most straightforward place to handle them.
+ if (handle == 0xFFFF && str.hasPrefix("(sciAudio")) {
+ Common::List<ExecStack>::const_iterator iter = s->_executionStack.reverse_begin();
+ iter--; // sciAudio
+ iter--; // sciAudio child
+ g_sci->_audio->handleFanmadeSciAudio(iter->sendp, s->_segMan);
+ return NULL_REG;
+ }
+
#ifdef ENABLE_SCI32
if (handle == VIRTUALFILE_HANDLE) {
s->_virtualIndexFile->write(str.c_str(), str.size());
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index a405ee5c7c..b4d245197b 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -2668,8 +2668,8 @@ void ScriptPatcher::initSignature(const SciScriptPatcherEntry *patchTable, bool
uint16 curWord;
uint16 curCommand;
uint32 curValue;
- byte byte1;
- byte byte2;
+ byte byte1 = 0;
+ byte byte2 = 0;
int patchEntryCount = 0;
// Count entries and allocate runtime data
diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp
index 3147fbda09..8e35d6b055 100644
--- a/engines/sci/sound/audio.cpp
+++ b/engines/sci/sound/audio.cpp
@@ -61,6 +61,62 @@ void AudioPlayer::stopAllAudio() {
audioCdStop();
}
+/**
+ * Handles the sciAudio calls in fanmade games.
+ * sciAudio is an external .NET library for playing MP3 files in fanmade games.
+ * It runs in the background, and obtains sound commands from the
+ * currently running game via text files (called "conductor files").
+ * For further info, check: http://sciprogramming.com/community/index.php?topic=634.0
+ */
+void AudioPlayer::handleFanmadeSciAudio(reg_t sciAudioObject, SegManager *segMan) {
+ // TODO: This is a bare bones implementation. Only the play/playx and stop commands
+ // are handled for now - the other commands haven't been observed in any fanmade game
+ // yet. All the volume related and fading functionality is currently missing.
+
+ Kernel *kernel = g_sci->getKernel();
+
+ reg_t commandReg = readSelector(segMan, sciAudioObject, kernel->findSelector("command"));
+ Common::String command = segMan->getString(commandReg);
+
+ if (command == "play" || command == "playx") {
+#ifdef USE_MAD
+ reg_t fileNameReg = readSelector(segMan, sciAudioObject, kernel->findSelector("fileName"));
+ Common::String fileName = segMan->getString(fileNameReg);
+
+ int16 loopCount = (int16)readSelectorValue(segMan, sciAudioObject, kernel->findSelector("loopCount"));
+ // When loopCount is -1, we treat it as infinite looping, else no looping is done.
+ // This is observed by game scripts, which can set loopCount to all sorts of random values.
+ // Adjust loopCount for ScummVM's LoopingAudioStream semantics
+ loopCount = (loopCount == -1) ? 0 : 1;
+
+ // Determine sound type
+ Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType;
+ if (fileName.hasPrefix("music"))
+ soundType = Audio::Mixer::kMusicSoundType;
+ else if (fileName.hasPrefix("speech"))
+ soundType = Audio::Mixer::kSpeechSoundType;
+
+ Common::File *sciAudio = new Common::File();
+ // Replace backwards slashes
+ for (uint i = 0; i < fileName.size(); i++) {
+ if (fileName[i] == '\\')
+ fileName.setChar('/', i);
+ }
+ sciAudio->open("sciAudio/" + fileName);
+
+ Audio::SeekableAudioStream *audioStream = Audio::makeMP3Stream(sciAudio, DisposeAfterUse::YES);
+
+ // We only support one audio handle
+ _mixer->playStream(soundType, &_audioHandle,
+ Audio::makeLoopingAudioStream((Audio::RewindableAudioStream *)audioStream, loopCount));
+#endif
+ } else if (command == "stop") {
+ _mixer->stopHandle(_audioHandle);
+ } else {
+ warning("Unhandled sciAudio command: %s", command.c_str());
+ }
+}
+
int AudioPlayer::startAudio(uint16 module, uint32 number) {
int sampleLen;
Audio::AudioStream *audioStream = getAudioStream(number, module, &sampleLen);
diff --git a/engines/sci/sound/audio.h b/engines/sci/sound/audio.h
index 545d35b2ee..9e65d6e0c8 100644
--- a/engines/sci/sound/audio.h
+++ b/engines/sci/sound/audio.h
@@ -75,6 +75,8 @@ public:
void pauseAudio();
void resumeAudio();
+ void handleFanmadeSciAudio(reg_t sciAudioObject, SegManager *segMan);
+
void setSoundSync(ResourceId id, reg_t syncObjAddr, SegManager *segMan);
void doSoundSync(reg_t syncObjAddr, SegManager *segMan);
void stopSoundSync();
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index bb1a7ffaf1..1d1b6b4f13 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -380,7 +380,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int
int size;
assert(height >= 0);
- assert(slot >= 0 && slot < 4);
+ assert((int)slot >= 0 && (int)slot < 4);
if (_game.version >= 7) {
if (slot == kMainVirtScreen && (_roomHeight != 0))
diff --git a/engines/scumm/gfxARM.s b/engines/scumm/gfxARM.s
index 9238888831..5cfe8ba0a4 100644
--- a/engines/scumm/gfxARM.s
+++ b/engines/scumm/gfxARM.s
@@ -41,6 +41,7 @@
@ In addition, we assume that text, src and dst are all word (4 byte)
@ aligned. This is the same assumption that the old 'inline' version
@ made.
+ .align 2
_asmDrawStripToScreen:
@ r0 = height
@ r1 = width
@@ -118,6 +119,7 @@ end:
@ In addition, we assume that src and dst are both word (4 byte)
@ aligned. This is the same assumption that the old 'inline' version
@ made.
+ .align 2
_asmCopy8Col:
@ r0 = dst
@ r1 = dstPitch
diff --git a/engines/scumm/proc3ARM.s b/engines/scumm/proc3ARM.s
index 75dd4b4a7f..70892faef2 100644
--- a/engines/scumm/proc3ARM.s
+++ b/engines/scumm/proc3ARM.s
@@ -28,14 +28,6 @@
.set space, 48
-.set _scaleIndexY, store_r14 + 28
-.set _numStrips, store_r14 + 24
-.set _palette, store_r14 + 20
-.set _shadow_table, store_r14 + 16
-.set _scaleIndexX, store_r14 + 12
-.set _scaleX, store_r14 + 8
-.set _height, store_r14 + 4
-
.set store_r14, space + 36
.set store_r11, space + 32
.set store_r10, space + 28
@@ -46,6 +38,14 @@
.set store_r5, space + 8
.set store_r4, space + 4
+.set _scaleIndexY, store_r14 + 28
+.set _numStrips, store_r14 + 24
+.set _palette, store_r14 + 20
+.set _shadow_table, store_r14 + 16
+.set _scaleIndexX, store_r14 + 12
+.set _scaleX, store_r14 + 8
+.set _height, store_r14 + 4
+
.set src, 48
.set height, 44
.set len, 40
@@ -71,6 +71,7 @@
@ <> = _palette
@ <> = _numstrips
@ <> = _scaleIndexY
+ .align 2
_ClassicProc3RendererShadowARM:
@ shadow20 = false
@ shadowed = true
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index 67bd6f617d..0aaff4c094 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -188,32 +188,31 @@ bool ScummEngine::saveState(Common::WriteStream *out, bool writeHeader) {
}
bool ScummEngine::saveState(int slot, bool compat, Common::String &filename) {
- bool saveFailed;
+ bool saveFailed = false;
pauseEngine(true);
Common::WriteStream *out = openSaveFileForWriting(slot, compat, filename);
- if (!out)
- return false;
-
- saveFailed = false;
- if (!saveState(out))
+ if (!out) {
saveFailed = true;
+ } else {
+ if (!saveState(out))
+ saveFailed = true;
- out->finalize();
- if (out->err())
- saveFailed = true;
- delete out;
+ out->finalize();
+ if (out->err())
+ saveFailed = true;
+ delete out;
+ }
- if (saveFailed) {
+ if (saveFailed)
debug(1, "State save as '%s' FAILED", filename.c_str());
- return false;
- }
- debug(1, "State saved as '%s'", filename.c_str());
+ else
+ debug(1, "State saved as '%s'", filename.c_str());
pauseEngine(false);
- return true;
+ return !saveFailed;
}
@@ -1243,7 +1242,9 @@ void ScummEngine::saveOrLoad(Serializer *s) {
}
s->saveUint16(0xFFFF); // End marker
} else {
- while ((type = (ResType)s->loadUint16()) != 0xFFFF) {
+ uint16 tmp;
+ while ((tmp = s->loadUint16()) != 0xFFFF) {
+ type = (ResType)tmp;
while ((idx = s->loadUint16()) != 0xFFFF) {
assert(idx < _res->_types[type].size());
loadResource(s, type, idx);
@@ -1431,7 +1432,9 @@ void ScummEngine::saveOrLoad(Serializer *s) {
}
s->saveByte(0xFF);
} else {
- while ((type = (ResType)s->loadByte()) != 0xFF) {
+ uint8 tmp;
+ while ((tmp = s->loadByte()) != 0xFF) {
+ type = (ResType)tmp;
idx = s->loadUint16();
_res->lock(type, idx);
}
diff --git a/engines/scumm/smush/codec47ARM.s b/engines/scumm/smush/codec47ARM.s
index a91f932558..53e9143f39 100644
--- a/engines/scumm/smush/codec47ARM.s
+++ b/engines/scumm/smush/codec47ARM.s
@@ -28,6 +28,7 @@
.global _ARM_Smush_decode2
+ .align 2
_ARM_Smush_decode2:
@ r0 = dst
@ r1 = src
diff --git a/engines/sky/debug.cpp b/engines/sky/debug.cpp
index a417bc2ece..63da42eec2 100644
--- a/engines/sky/debug.cpp
+++ b/engines/sky/debug.cpp
@@ -1108,6 +1108,15 @@ void Debugger::postEnter() {
_mouse->resetCursor();
}
+static bool isNumeric(const char *arg) {
+ const char *str = arg;
+ bool retVal = true;
+ while (retVal && (*str != '\0')) {
+ retVal = Common::isDigit(*str++);
+ }
+ return retVal;
+}
+
bool Debugger::Cmd_ShowGrid(int argc, const char **argv) {
_showGrid = !_showGrid;
DebugPrintf("Show grid: %s\n", _showGrid ? "On" : "Off");
@@ -1299,22 +1308,20 @@ bool Debugger::Cmd_ScriptVar(int argc, const char **argv) {
}
bool Debugger::Cmd_Section(int argc, const char **argv) {
- if (argc < 2) {
- DebugPrintf("Example: %s 4\n", argv[0]);
- return true;
- }
-
- const int baseId[] = { START_ONE, START_S6, START_29, START_SC31, START_SC66, START_SC90, START_SC81 };
- int section = atoi(argv[1]);
+ if (argc == 2 && isNumeric(argv[1])) {
+ const int baseId[] = { START_ONE, START_S6, START_29, START_SC31, START_SC66, START_SC90, START_SC81 };
+ int section = atoi(argv[1]);
- if (section >= 0 && section <= 6) {
- _logic->fnEnterSection(section == 6 ? 4 : section, 0, 0);
- _logic->fnAssignBase(ID_FOSTER, baseId[section], 0);
- _skyCompact->fetchCpt(ID_FOSTER)->megaSet = 0;
+ if (section >= 0 && section <= 6) {
+ _logic->fnEnterSection(section == 6 ? 4 : section, 0, 0);
+ _logic->fnAssignBase(ID_FOSTER, baseId[section], 0);
+ _skyCompact->fetchCpt(ID_FOSTER)->megaSet = 0;
+ } else {
+ DebugPrintf("Section %d is out of range (range: %d - %d)\n", section, 0, 6);
+ }
} else {
- DebugPrintf("Unknown section '%s'\n", argv[1]);
+ DebugPrintf("Example: %s 4\n", argv[0]);
}
-
return true;
}
diff --git a/engines/tony/font.h b/engines/tony/font.h
index 6e76c42750..d52547a58d 100644
--- a/engines/tony/font.h
+++ b/engines/tony/font.h
@@ -347,6 +347,7 @@ public:
virtual ~RMDialogChoice();
// Initialization and closure
+ using RMGfxWoodyBuffer::init;
void init();
void close();
diff --git a/engines/tony/game.h b/engines/tony/game.h
index d03a975b6f..cda07de889 100644
--- a/engines/tony/game.h
+++ b/engines/tony/game.h
@@ -300,6 +300,7 @@ public:
RMOptionScreen();
virtual ~RMOptionScreen();
+ using RMGfxWoodyBuffer::init;
void init(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool &result);
void initLoadMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool bAlternateGfx, bool &result);
void initSaveMenuOnly(CORO_PARAM, RMGfxTargetBuffer &bigBuf, bool bAlternateGfx, bool &result);
diff --git a/engines/tony/gfxcore.h b/engines/tony/gfxcore.h
index ff6c6b3dca..c9081506d7 100644
--- a/engines/tony/gfxcore.h
+++ b/engines/tony/gfxcore.h
@@ -71,7 +71,7 @@ public:
int getDimy();
// Creation
- virtual void create(int dimx, int dimy, int nBpp);
+ void create(int dimx, int dimy, int nBpp);
virtual void destroy();
// These are valid only if the buffer is locked
diff --git a/engines/tony/inventory.h b/engines/tony/inventory.h
index 9b460f390d..5528e6589c 100644
--- a/engines/tony/inventory.h
+++ b/engines/tony/inventory.h
@@ -101,6 +101,7 @@ public:
/**
* Initialization and closing
*/
+ using RMGfxWoodyBuffer::init;
void init();
void close();
void reset();
@@ -209,6 +210,7 @@ public:
/**
* Initialization
*/
+ using RMGfxSourceBuffer8RLEByte::init;
void init();
void close();
diff --git a/engines/tsage/debugger.cpp b/engines/tsage/debugger.cpp
index 140e1afea5..5a520b0e89 100644
--- a/engines/tsage/debugger.cpp
+++ b/engines/tsage/debugger.cpp
@@ -640,58 +640,58 @@ bool Ringworld2Debugger::Cmd_ListObjects(int argc, const char **argv) {
}
DebugPrintf("Available objects for this game are:\n");
- DebugPrintf("1 - R2_OPTO_DISK\n");
- DebugPrintf("2 - R2_READER\n");
- DebugPrintf("3 - R2_NEGATOR_GUN\n");
- DebugPrintf("4 - R2_STEPPING_DISKS\n");
- DebugPrintf("5 - R2_ATTRACTOR_UNIT\n");
- DebugPrintf("6 - R2_SENSOR_PROBE\n");
- DebugPrintf("7 - R2_SONIC_STUNNER\n");
- DebugPrintf("8 - R2_CABLE_HARNESS\n");
- DebugPrintf("9 - R2_COM_SCANNER\n");
- DebugPrintf("10 - R2_SPENT_POWER_CAPSULE\n");
- DebugPrintf("11 - R2_CHARGED_POWER_CAPSULE\n");
- DebugPrintf("12 - R2_AEROSOL\n");
- DebugPrintf("13 - R2_REMOTE_CONTROL\n");
- DebugPrintf("14 - R2_OPTICAL_FIBER\n");
- DebugPrintf("15 - R2_CLAMP\n");
- DebugPrintf("16 - R2_ATTRACTOR_CABLE_HARNESS\n");
- DebugPrintf("17 - R2_FUEL_CELL\n");
- DebugPrintf("18 - R2_GYROSCOPE\n");
- DebugPrintf("19 - R2_AIRBAG\n");
- DebugPrintf("20 - R2_REBREATHER_TANK\n");
- DebugPrintf("21 - R2_RESERVE_REBREATHER_TANK\n");
- DebugPrintf("22 - R2_GUIDANCE_MODULE\n");
- DebugPrintf("23 - R2_THRUSTER_VALVE\n");
- DebugPrintf("24 - R2_BALLOON_BACKPACK\n");
- DebugPrintf("25 - R2_RADAR_MECHANISM\n");
- DebugPrintf("26 - R2_JOYSTICK\n");
- DebugPrintf("27 - R2_IGNITOR\n");
- DebugPrintf("28 - R2_DIAGNOSTICS_DISPLAY\n");
- DebugPrintf("29 - R2_GLASS_DOME\n");
- DebugPrintf("30 - R2_WICK_LAMP\n");
- DebugPrintf("31 - R2_SCRITH_KEY\n");
- DebugPrintf("32 - R2_TANNER_MASK\n");
- DebugPrintf("33 - R2_PURE_GRAIN_ALCOHOL\n");
- DebugPrintf("34 - R2_SAPPHIRE_BLUE\n");
- DebugPrintf("35 - R2_ANCIENT_SCROLLS\n");
- DebugPrintf("36 - R2_FLUTE\n");
- DebugPrintf("37 - R2_GUNPOWDER\n");
- DebugPrintf("38 - R2_NONAME\n");
- DebugPrintf("39 - R2_COM_SCANNER_2\n");
- DebugPrintf("40 - R2_SUPERCONDUCTOR_WIRE\n");
- DebugPrintf("41 - R2_PILLOW\n");
- DebugPrintf("42 - R2_FOOD_TRAY\n");
- DebugPrintf("43 - R2_LASER_HACKSAW\n");
- DebugPrintf("44 - R2_PHOTON_STUNNER\n");
- DebugPrintf("45 - R2_BATTERY\n");
- DebugPrintf("46 - R2_SOAKED_FACEMASK\n");
- DebugPrintf("47 - R2_LIGHT_BULB\n");
- DebugPrintf("48 - R2_ALCOHOL_LAMP\n");
- DebugPrintf("49 - R2_ALCOHOL_LAMP_2\n");
- DebugPrintf("50 - R2_ALCOHOL_LAMP_3\n");
- DebugPrintf("51 - R2_BROKEN_DISPLAY\n");
- DebugPrintf("52 - R2_TOOLBOX\n");
+ DebugPrintf("1 - Scene %d - R2_OPTO_DISK\n", BF_INVENTORY.getObjectScene(1));
+ DebugPrintf("2 - Scene %d - R2_READER\n", BF_INVENTORY.getObjectScene(2));
+ DebugPrintf("3 - Scene %d - R2_NEGATOR_GUN\n", BF_INVENTORY.getObjectScene(3));
+ DebugPrintf("4 - Scene %d - R2_STEPPING_DISKS\n", BF_INVENTORY.getObjectScene(4));
+ DebugPrintf("5 - Scene %d - R2_ATTRACTOR_UNIT\n", BF_INVENTORY.getObjectScene(5));
+ DebugPrintf("6 - Scene %d - R2_SENSOR_PROBE\n", BF_INVENTORY.getObjectScene(6));
+ DebugPrintf("7 - Scene %d - R2_SONIC_STUNNER\n", BF_INVENTORY.getObjectScene(7));
+ DebugPrintf("8 - Scene %d - R2_CABLE_HARNESS\n", BF_INVENTORY.getObjectScene(8));
+ DebugPrintf("9 - Scene %d - R2_COM_SCANNER\n", BF_INVENTORY.getObjectScene(9));
+ DebugPrintf("10 - Scene %d - R2_SPENT_POWER_CAPSULE\n", BF_INVENTORY.getObjectScene(10));
+ DebugPrintf("11 - Scene %d - R2_CHARGED_POWER_CAPSULE\n", BF_INVENTORY.getObjectScene(11));
+ DebugPrintf("12 - Scene %d - R2_AEROSOL\n", BF_INVENTORY.getObjectScene(12));
+ DebugPrintf("13 - Scene %d - R2_REMOTE_CONTROL\n", BF_INVENTORY.getObjectScene(13));
+ DebugPrintf("14 - Scene %d - R2_OPTICAL_FIBER\n", BF_INVENTORY.getObjectScene(14));
+ DebugPrintf("15 - Scene %d - R2_CLAMP\n", BF_INVENTORY.getObjectScene(15));
+ DebugPrintf("16 - Scene %d - R2_ATTRACTOR_CABLE_HARNESS\n", BF_INVENTORY.getObjectScene(16));
+ DebugPrintf("17 - Scene %d - R2_FUEL_CELL\n", BF_INVENTORY.getObjectScene(17));
+ DebugPrintf("18 - Scene %d - R2_GYROSCOPE\n", BF_INVENTORY.getObjectScene(18));
+ DebugPrintf("19 - Scene %d - R2_AIRBAG\n", BF_INVENTORY.getObjectScene(19));
+ DebugPrintf("20 - Scene %d - R2_REBREATHER_TANK\n", BF_INVENTORY.getObjectScene(20));
+ DebugPrintf("21 - Scene %d - R2_RESERVE_REBREATHER_TANK\n", BF_INVENTORY.getObjectScene(21));
+ DebugPrintf("22 - Scene %d - R2_GUIDANCE_MODULE\n", BF_INVENTORY.getObjectScene(22));
+ DebugPrintf("23 - Scene %d - R2_THRUSTER_VALVE\n", BF_INVENTORY.getObjectScene(23));
+ DebugPrintf("24 - Scene %d - R2_BALLOON_BACKPACK\n", BF_INVENTORY.getObjectScene(24));
+ DebugPrintf("25 - Scene %d - R2_RADAR_MECHANISM\n", BF_INVENTORY.getObjectScene(25));
+ DebugPrintf("26 - Scene %d - R2_JOYSTICK\n", BF_INVENTORY.getObjectScene(26));
+ DebugPrintf("27 - Scene %d - R2_IGNITOR\n", BF_INVENTORY.getObjectScene(27));
+ DebugPrintf("28 - Scene %d - R2_DIAGNOSTICS_DISPLAY\n", BF_INVENTORY.getObjectScene(28));
+ DebugPrintf("29 - Scene %d - R2_GLASS_DOME\n", BF_INVENTORY.getObjectScene(29));
+ DebugPrintf("30 - Scene %d - R2_WICK_LAMP\n", BF_INVENTORY.getObjectScene(30));
+ DebugPrintf("31 - Scene %d - R2_SCRITH_KEY\n", BF_INVENTORY.getObjectScene(31));
+ DebugPrintf("32 - Scene %d - R2_TANNER_MASK\n", BF_INVENTORY.getObjectScene(32));
+ DebugPrintf("33 - Scene %d - R2_PURE_GRAIN_ALCOHOL\n", BF_INVENTORY.getObjectScene(33));
+ DebugPrintf("34 - Scene %d - R2_SAPPHIRE_BLUE\n", BF_INVENTORY.getObjectScene(34));
+ DebugPrintf("35 - Scene %d - R2_ANCIENT_SCROLLS\n", BF_INVENTORY.getObjectScene(35));
+ DebugPrintf("36 - Scene %d - R2_FLUTE\n", BF_INVENTORY.getObjectScene(36));
+ DebugPrintf("37 - Scene %d - R2_GUNPOWDER\n", BF_INVENTORY.getObjectScene(37));
+ DebugPrintf("38 - Scene %d - R2_NONAME\n", BF_INVENTORY.getObjectScene(38));
+ DebugPrintf("39 - Scene %d - R2_COM_SCANNER_2\n", BF_INVENTORY.getObjectScene(39));
+ DebugPrintf("40 - Scene %d - R2_SUPERCONDUCTOR_WIRE\n", BF_INVENTORY.getObjectScene(40));
+ DebugPrintf("41 - Scene %d - R2_PILLOW\n", BF_INVENTORY.getObjectScene(41));
+ DebugPrintf("42 - Scene %d - R2_FOOD_TRAY\n", BF_INVENTORY.getObjectScene(42));
+ DebugPrintf("43 - Scene %d - R2_LASER_HACKSAW\n", BF_INVENTORY.getObjectScene(43));
+ DebugPrintf("44 - Scene %d - R2_PHOTON_STUNNER\n", BF_INVENTORY.getObjectScene(44));
+ DebugPrintf("45 - Scene %d - R2_BATTERY\n", BF_INVENTORY.getObjectScene(45));
+ DebugPrintf("46 - Scene %d - R2_SOAKED_FACEMASK\n", BF_INVENTORY.getObjectScene(46));
+ DebugPrintf("47 - Scene %d - R2_LIGHT_BULB\n", BF_INVENTORY.getObjectScene(47));
+ DebugPrintf("48 - Scene %d - R2_ALCOHOL_LAMP\n", BF_INVENTORY.getObjectScene(48));
+ DebugPrintf("49 - Scene %d - R2_ALCOHOL_LAMP_2\n", BF_INVENTORY.getObjectScene(49));
+ DebugPrintf("50 - Scene %d - R2_ALCOHOL_LAMP_3\n", BF_INVENTORY.getObjectScene(50));
+ DebugPrintf("51 - Scene %d - R2_BROKEN_DISPLAY\n", BF_INVENTORY.getObjectScene(51));
+ DebugPrintf("52 - Scene %d - R2_TOOLBOX\n", BF_INVENTORY.getObjectScene(52));
return true;
}
diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp
index 02a21e36f8..9d61b4d182 100644
--- a/engines/tsage/detection.cpp
+++ b/engines/tsage/detection.cpp
@@ -129,10 +129,10 @@ public:
if (in) {
if (TsAGE::Saver::readSavegameHeader(in, header)) {
- saveList.push_back(SaveStateDescriptor(slot, header.saveName));
+ saveList.push_back(SaveStateDescriptor(slot, header._saveName));
- header.thumbnail->free();
- delete header.thumbnail;
+ header._thumbnail->free();
+ delete header._thumbnail;
}
delete in;
@@ -162,11 +162,11 @@ public:
delete f;
// Create the return descriptor
- SaveStateDescriptor desc(slot, header.saveName);
- desc.setThumbnail(header.thumbnail);
- desc.setSaveDate(header.saveYear, header.saveMonth, header.saveDay);
- desc.setSaveTime(header.saveHour, header.saveMinutes);
- desc.setPlayTime(header.totalFrames * GAME_FRAME_TIME);
+ SaveStateDescriptor desc(slot, header._saveName);
+ desc.setThumbnail(header._thumbnail);
+ desc.setSaveDate(header._saveYear, header._saveMonth, header._saveDay);
+ desc.setSaveTime(header._saveHour, header._saveMinutes);
+ desc.setPlayTime(header._totalFrames * GAME_FRAME_TIME);
return desc;
}
diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp
index 95f8c85efe..3f32503fdf 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp
@@ -5048,6 +5048,7 @@ void Scene3700::signal() {
Scene3800::Scene3800() {
_desertDirection = 0;
+ _skylineRect.set(0, 0, 320, 87);
}
void Scene3800::synchronize(Serializer &s) {
@@ -5220,7 +5221,8 @@ void Scene3800::initExits() {
}
void Scene3800::enterArea() {
- R2_GLOBALS._player.disableControl();
+ R2_GLOBALS._player.disableControl(CURSOR_WALK);
+
switch (_desertDirection) {
case 0:
R2_GLOBALS._player.postInit();
@@ -5346,7 +5348,6 @@ void Scene3800::postInit(SceneObjectList *OwnerList) {
_westExit.setDetails(Rect(0, 87, 14, 168), EXITCURSOR_W, 3800);
_westExit.setDest(Common::Point(7, 145));
- _skylineRect.set(0, 0, 320, 87);
_background.setDetails(Rect(0, 0, 320, 200), 3800, 0, 1, 2, 1, (SceneItem *) NULL);
enterArea();
diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp
index fe71c03973..9954b929b2 100644
--- a/engines/tsage/saveload.cpp
+++ b/engines/tsage/saveload.cpp
@@ -141,8 +141,8 @@ Common::Error Saver::save(int slot, const Common::String &saveName) {
// Write out the savegame header
tSageSavegameHeader header;
- header.saveName = saveName;
- header.version = TSAGE_SAVEGAME_VERSION;
+ header._saveName = saveName;
+ header._version = TSAGE_SAVEGAME_VERSION;
writeSavegameHeader(saveFile, header);
// Save out objects that need to come at the start of the savegame
@@ -190,11 +190,11 @@ Common::Error Saver::restore(int slot) {
// Read in the savegame header
tSageSavegameHeader header;
readSavegameHeader(saveFile, header);
- if (header.thumbnail)
- header.thumbnail->free();
- delete header.thumbnail;
+ if (header._thumbnail)
+ header._thumbnail->free();
+ delete header._thumbnail;
- serializer.setSaveVersion(header.version);
+ serializer.setSaveVersion(header._version);
// Load in data for objects that need to come at the start of the savegame
for (Common::List<SaveListener *>::iterator i = _listeners.begin(); i != _listeners.end(); ++i) {
@@ -242,34 +242,34 @@ const char *SAVEGAME_STR = "SCUMMVM_TSAGE";
bool Saver::readSavegameHeader(Common::InSaveFile *in, tSageSavegameHeader &header) {
char saveIdentBuffer[SAVEGAME_STR_SIZE + 1];
- header.thumbnail = NULL;
+ header._thumbnail = NULL;
// Validate the header Id
in->read(saveIdentBuffer, SAVEGAME_STR_SIZE + 1);
if (strncmp(saveIdentBuffer, SAVEGAME_STR, SAVEGAME_STR_SIZE))
return false;
- header.version = in->readByte();
- if (header.version > TSAGE_SAVEGAME_VERSION)
+ header._version = in->readByte();
+ if (header._version > TSAGE_SAVEGAME_VERSION)
return false;
// Read in the string
- header.saveName.clear();
+ header._saveName.clear();
char ch;
- while ((ch = (char)in->readByte()) != '\0') header.saveName += ch;
+ while ((ch = (char)in->readByte()) != '\0') header._saveName += ch;
// Get the thumbnail
- header.thumbnail = Graphics::loadThumbnail(*in);
- if (!header.thumbnail)
+ header._thumbnail = Graphics::loadThumbnail(*in);
+ if (!header._thumbnail)
return false;
// Read in save date/time
- header.saveYear = in->readSint16LE();
- header.saveMonth = in->readSint16LE();
- header.saveDay = in->readSint16LE();
- header.saveHour = in->readSint16LE();
- header.saveMinutes = in->readSint16LE();
- header.totalFrames = in->readUint32LE();
+ header._saveYear = in->readSint16LE();
+ header._saveMonth = in->readSint16LE();
+ header._saveDay = in->readSint16LE();
+ header._saveHour = in->readSint16LE();
+ header._saveMinutes = in->readSint16LE();
+ header._totalFrames = in->readUint32LE();
return true;
}
@@ -281,7 +281,7 @@ void Saver::writeSavegameHeader(Common::OutSaveFile *out, tSageSavegameHeader &h
out->writeByte(TSAGE_SAVEGAME_VERSION);
// Write savegame name
- out->write(header.saveName.c_str(), header.saveName.size() + 1);
+ out->write(header._saveName.c_str(), header._saveName.size() + 1);
// Get the active palette
uint8 thumbPalette[256 * 3];
diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h
index a6ad71699e..be5ff51ffb 100644
--- a/engines/tsage/saveload.h
+++ b/engines/tsage/saveload.h
@@ -38,12 +38,12 @@ typedef void (*SaveNotifierFn)(bool postFlag);
class SavedObject;
struct tSageSavegameHeader {
- uint8 version;
- Common::String saveName;
- Graphics::Surface *thumbnail;
- int saveYear, saveMonth, saveDay;
- int saveHour, saveMinutes;
- int totalFrames;
+ uint8 _version;
+ Common::String _saveName;
+ Graphics::Surface *_thumbnail;
+ int _saveYear, _saveMonth, _saveDay;
+ int _saveHour, _saveMinutes;
+ int _totalFrames;
};
/*--------------------------------------------------------------------------*/
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index b6434b3523..c5c38505a7 100644
--- a/engines/tsage/sound.cpp
+++ b/engines/tsage/sound.cpp
@@ -468,8 +468,9 @@ void SoundManager::sfProcessFading() {
if (vtStruct->_voiceType == VOICETYPE_1) {
for (uint idx = 0; idx < vtStruct->_entries.size(); ++idx) {
- if (vtStruct->_entries[idx]._type1._field6 >= -1)
- ++vtStruct->_entries[idx]._type1._field6;
+ VoiceStructEntryType1 &vte = vtStruct->_entries[idx]._type1;
+ if (vte._field6 >= -1)
+ ++vte._field6;
}
}
}
@@ -499,22 +500,22 @@ void SoundManager::sfUpdateVoiceStructs() {
if (vs->_voiceType == VOICETYPE_0) {
for (uint idx = 0; idx < vs->_entries.size(); ++idx) {
- VoiceStructEntry &vse = vs->_entries[idx];
+ VoiceStructEntryType0 &vte = vs->_entries[idx]._type0;
- vse._type0._sound = vse._type0._sound2;
- vse._type0._channelNum = vse._type0._channelNum2;
- vse._type0._priority = vse._type0._priority2;
- vse._type0._fieldA = vse._type0._field12;
+ vte._sound = vte._sound2;
+ vte._channelNum = vte._channelNum2;
+ vte._priority = vte._priority2;
+ vte._fieldA = vte._field12;
}
} else {
vs->_field3 = vs->_numVoices;
for (uint idx = 0; idx < vs->_entries.size(); ++idx) {
- VoiceStructEntry &vse = vs->_entries[idx];
+ VoiceStructEntryType1 &vte = vs->_entries[idx]._type1;
- vse._type1._sound = vse._type1._sound2;
- vse._type1._channelNum = vse._type1._channelNum2;
- vse._type1._priority = vse._type1._priority2;
+ vte._sound = vte._sound2;
+ vte._channelNum = vte._channelNum2;
+ vte._priority = vte._priority2;
}
}
}
@@ -529,16 +530,16 @@ void SoundManager::sfUpdateVoiceStructs2() {
for (uint idx = 0; idx < vtStruct->_entries.size(); ++idx) {
if (vtStruct->_voiceType == VOICETYPE_0) {
- VoiceStructEntryType0 &vse = vtStruct->_entries[idx]._type0;
- vse._sound2 = vse._sound;
- vse._channelNum2 = vse._channelNum;
- vse._priority2 = vse._priority;
- vse._field12 = vse._fieldA;
+ VoiceStructEntryType0 &vte = vtStruct->_entries[idx]._type0;
+ vte._sound2 = vte._sound;
+ vte._channelNum2 = vte._channelNum;
+ vte._priority2 = vte._priority;
+ vte._field12 = vte._fieldA;
} else {
- VoiceStructEntryType1 &vse = vtStruct->_entries[idx]._type1;
- vse._sound2 = vse._sound;
- vse._channelNum2 = vse._channelNum;
- vse._priority2 = vse._priority;
+ VoiceStructEntryType1 &vte = vtStruct->_entries[idx]._type1;
+ vte._sound2 = vte._sound;
+ vte._channelNum2 = vte._channelNum;
+ vte._priority2 = vte._priority;
}
}
}
@@ -724,7 +725,7 @@ void SoundManager::sfRethinkSoundDrivers() {
ve._type0._sound = NULL;
ve._type0._channelNum = 0;
ve._type0._priority = 0;
- ve._type0._fieldA = 0;
+ ve._type0._fieldA = false;
vs->_entries.push_back(ve);
}
@@ -773,32 +774,31 @@ void SoundManager::sfRethinkVoiceTypes() {
if (vs->_voiceType == VOICETYPE_0) {
for (uint idx = 0; idx < vs->_entries.size(); ++idx) {
- VoiceStructEntry &vse = vs->_entries[idx];
- vse._type0._sound3 = vse._type0._sound;
- vse._type0._channelNum3 = vse._type0._channelNum;
- vse._type0._priority3 = vse._type0._priority;
- vse._type0._field1A = vse._type0._fieldA;
- vse._type0._sound = NULL;
- vse._type0._channelNum = 0;
- vse._type0._priority = 0;
- vse._type0._fieldA = 0;
- vse._type0._sound2 = NULL;
- vse._type0._channelNum2 = 0;
- vse._type0._priority2 = 0;
- vse._type0._field12 = 0;
+ VoiceStructEntryType0 &vte = vs->_entries[idx]._type0;
+ vte._sound3 = vte._sound;
+ vte._channelNum3 = vte._channelNum;
+ vte._priority3 = vte._priority;
+ vte._sound = NULL;
+ vte._channelNum = 0;
+ vte._priority = 0;
+ vte._fieldA = false;
+ vte._sound2 = NULL;
+ vte._channelNum2 = 0;
+ vte._priority2 = 0;
+ vte._field12 = false;
}
} else {
for (uint idx = 0; idx < vs->_entries.size(); ++idx) {
- VoiceStructEntry &vse = vs->_entries[idx];
- vse._type1._sound3 = vse._type1._sound;
- vse._type1._channelNum3 = vse._type1._channelNum;
- vse._type1._priority3 = vse._type1._priority;
- vse._type1._sound = NULL;
- vse._type1._channelNum = 0;
- vse._type1._priority = 0;
- vse._type1._sound2 = NULL;
- vse._type1._channelNum2 = 0;
- vse._type1._priority2 = 0;
+ VoiceStructEntryType1 &vte = vs->_entries[idx]._type1;
+ vte._sound3 = vte._sound;
+ vte._channelNum3 = vte._channelNum;
+ vte._priority3 = vte._priority;
+ vte._sound = NULL;
+ vte._channelNum = 0;
+ vte._priority = 0;
+ vte._sound2 = NULL;
+ vte._channelNum2 = 0;
+ vte._priority2 = 0;
}
// Reset the number of voices available
@@ -858,10 +858,11 @@ void SoundManager::sfRethinkVoiceTypes() {
if (numVoices >= chNumVoices) {
int channelCount = chNumVoices, idx = 0;
while (channelCount > 0) {
- if (!vtStruct->_entries[idx]._type1._sound2) {
- vtStruct->_entries[idx]._type1._sound2 = sound;
- vtStruct->_entries[idx]._type1._channelNum2 = foundIndex;
- vtStruct->_entries[idx]._type1._priority2 = foundPriority;
+ VoiceStructEntryType1 &vte = vtStruct->_entries[idx]._type1;
+ if (!vte._sound2) {
+ vte._sound2 = sound;
+ vte._channelNum2 = foundIndex;
+ vte._priority2 = foundPriority;
--channelCount;
}
++idx;
@@ -881,10 +882,11 @@ void SoundManager::sfRethinkVoiceTypes() {
}
for (uint idx = 0; idx < vtStruct->_entries.size(); ++idx) {
- if (vtStruct->_entries[idx]._type1._priority2 == maxPriority) {
- vtStruct->_entries[idx]._type1._sound2 = NULL;
- vtStruct->_entries[idx]._type1._channelNum2 = 0;
- vtStruct->_entries[idx]._type1._priority2 = 0;
+ VoiceStructEntryType1 &vte = vtStruct->_entries[idx]._type1;
+ if (vte._priority2 == maxPriority) {
+ vte._sound2 = NULL;
+ vte._channelNum2 = 0;
+ vte._priority2 = 0;
++numVoices;
}
}
@@ -892,10 +894,11 @@ void SoundManager::sfRethinkVoiceTypes() {
int voicesCtr = chNumVoices;
for (uint idx = 0; (idx < vtStruct->_entries.size()) && (voicesCtr > 0); ++idx) {
- if (!vtStruct->_entries[idx]._type1._sound2) {
- vtStruct->_entries[idx]._type1._sound2 = sound;
- vtStruct->_entries[idx]._type1._channelNum2 = foundIndex;
- vtStruct->_entries[idx]._type1._priority2 = foundPriority;
+ VoiceStructEntryType1 &vte = vtStruct->_entries[idx]._type1;
+ if (!vte._sound2) {
+ vte._sound2 = sound;
+ vte._channelNum2 = foundIndex;
+ vte._priority2 = foundPriority;
--voicesCtr;
}
}
@@ -932,10 +935,11 @@ void SoundManager::sfRethinkVoiceTypes() {
}
if (entryIndex != -1) {
- vtStruct->_entries[entryIndex]._type0._sound2 = sound;
- vtStruct->_entries[entryIndex]._type0._channelNum2 = foundIndex;
- vtStruct->_entries[entryIndex]._type0._priority2 = foundPriority;
- vtStruct->_entries[entryIndex]._type0._field12 = 0;
+ VoiceStructEntryType0 &vte = vtStruct->_entries[entryIndex]._type0;
+ vte._sound2 = sound;
+ vte._channelNum2 = foundIndex;
+ vte._priority2 = foundPriority;
+ vte._field12 = false;
continue;
}
@@ -953,10 +957,11 @@ void SoundManager::sfRethinkVoiceTypes() {
}
if (entryIndex != -1) {
- vtStruct->_entries[entryIndex]._type0._sound2 = sound;
- vtStruct->_entries[entryIndex]._type0._channelNum2 = foundIndex;
- vtStruct->_entries[entryIndex]._type0._priority2 = foundPriority;
- vtStruct->_entries[entryIndex]._type0._field12 = 0;
+ VoiceStructEntryType0 &vte = vtStruct->_entries[entryIndex]._type0;
+ vte._sound2 = sound;
+ vte._channelNum2 = foundIndex;
+ vte._priority2 = foundPriority;
+ vte._field12 = false;
continue;
}
@@ -978,10 +983,11 @@ void SoundManager::sfRethinkVoiceTypes() {
}
if (entryIndex != -1) {
- vtStruct->_entries[entryIndex]._type0._sound2 = sound;
- vtStruct->_entries[entryIndex]._type0._channelNum2 = foundIndex;
- vtStruct->_entries[entryIndex]._type0._priority2 = foundPriority;
- vtStruct->_entries[entryIndex]._type0._field12 = 0;
+ VoiceStructEntryType0 &vte = vtStruct->_entries[entryIndex]._type0;
+ vte._sound2 = sound;
+ vte._channelNum2 = foundIndex;
+ vte._priority2 = foundPriority;
+ vte._field12 = false;
continue;
}
@@ -1017,10 +1023,11 @@ void SoundManager::sfRethinkVoiceTypes() {
continue;
if (entryIndex != -1) {
- vtStruct->_entries[entryIndex]._type0._sound2 = sound;
- vtStruct->_entries[entryIndex]._type0._channelNum2 = foundIndex;
- vtStruct->_entries[entryIndex]._type0._priority2 = foundPriority;
- vtStruct->_entries[entryIndex]._type0._field12 = 1;
+ VoiceStructEntryType0 &vte = vtStruct->_entries[entryIndex]._type0;
+ vte._sound2 = sound;
+ vte._channelNum2 = foundIndex;
+ vte._priority2 = foundPriority;
+ vte._field12 = true;
continue;
}
@@ -1035,14 +1042,15 @@ void SoundManager::sfRethinkVoiceTypes() {
for (uint idx = 0; idx < vtStruct->_entries.size(); ++idx) {
if (vtStruct->_entries[idx]._field1) {
- if (!vtStruct->_entries[idx]._type0._sound2) {
+ VoiceStructEntryType0 &vte = vtStruct->_entries[idx]._type0;
+ if (!vte._sound2) {
if (vtStruct->_entries[idx]._voiceNum > maxVoiceNum) {
maxVoiceNum = vtStruct->_entries[idx]._voiceNum;
voiceIndex = idx;
}
} else {
- if (vtStruct->_entries[idx]._type0._priority2 > maxPriority) {
- maxPriority = vtStruct->_entries[idx]._type0._priority2;
+ if (vte._priority2 > maxPriority) {
+ maxPriority = vte._priority2;
priorityIndex = idx;
}
}
@@ -1060,7 +1068,7 @@ void SoundManager::sfRethinkVoiceTypes() {
vteSrc._sound2 = sound;
vteSrc._channelNum2 = foundIndex;
vteSrc._priority2 = foundPriority;
- vteSrc._field12 = 1;
+ vteSrc._field12 = true;
continue;
}
@@ -1084,7 +1092,7 @@ void SoundManager::sfRethinkVoiceTypes() {
vteSrc._sound2 = sound;
vteSrc._channelNum2 = foundIndex;
vteSrc._priority2 = foundPriority;
- vteSrc._field12 = 1;
+ vteSrc._field12 = true;
continue;
}
}
@@ -1115,10 +1123,10 @@ void SoundManager::sfRethinkVoiceTypes() {
++total;
vse._priority = vse._priority2;
- vse._fieldA = 1;
+ vse._fieldA = true;
vse._sound2 = NULL;
- if (total) {
+ if ((total) && vse._sound) {
driver->proc24(vse._channelNum, idx, vse._sound, 123, 0);
driver->proc24(vse._channelNum, idx, vse._sound, 1, vse._sound->_chModulation[vse._channelNum]);
driver->proc24(vse._channelNum, idx, vse._sound, 7,
@@ -1135,7 +1143,7 @@ void SoundManager::sfRethinkVoiceTypes() {
vse._sound = NULL;
vse._channelNum = 0;
vse._priority = 0;
- vse._fieldA = 0;
+ vse._fieldA = false;
}
}
@@ -1148,13 +1156,13 @@ void SoundManager::sfRethinkVoiceTypes() {
continue;
for (uint entryIndex = 0; entryIndex < vs->_entries.size(); ++entryIndex) {
- if ((vs->_entries[entryIndex]._type0._sound3 != sound) ||
- (vs->_entries[entryIndex]._type0._channelNum3 != channelNum)) {
+ VoiceStructEntryType0 &vteCur = vs->_entries[entryIndex]._type0;
+ if ((vteCur._sound3 != sound) || (vteCur._channelNum3 != channelNum)) {
// Found match
- vs->_entries[entryIndex]._type0._sound = sound;
- vs->_entries[entryIndex]._type0._channelNum = channelNum;
- vs->_entries[entryIndex]._type0._priority = vse._priority2;
- vs->_entries[entryIndex]._type0._fieldA = 0;
+ vteCur._sound = sound;
+ vteCur._channelNum = channelNum;
+ vteCur._priority = vse._priority2;
+ vteCur._fieldA = false;
vse._sound2 = NULL;
break;
}
@@ -1185,7 +1193,7 @@ void SoundManager::sfRethinkVoiceTypes() {
vseFound._sound = vse._sound2;
vseFound._channelNum = vse._channelNum2;
vseFound._priority = vse._priority2;
- vseFound._fieldA = 0;
+ vseFound._fieldA = false;
SoundDriver *driver = vs->_entries[foundIndex]._driver;
assert(driver);
@@ -1215,10 +1223,10 @@ void SoundManager::sfRethinkVoiceTypes() {
} else {
// Type 1
for (uint idx = 0; idx < vs->_entries.size(); ++idx) {
- VoiceStructEntry &vse = vs->_entries[idx];
- vse._type1._sound = NULL;
- vse._type1._channelNum = 0;
- vse._type1._priority = 0;
+ VoiceStructEntryType1 &vte = vs->_entries[idx]._type1;
+ vte._sound = NULL;
+ vte._channelNum = 0;
+ vte._priority = 0;
}
for (uint idx = 0; idx < vs->_entries.size(); ++idx) {
@@ -2188,9 +2196,10 @@ void Sound::soPlaySound(VoiceTypeStruct *vtStruct, const byte *channelData, int
SoundDriver *driver = vtStruct->_entries[entryIndex]._driver;
assert(driver);
- vtStruct->_entries[entryIndex]._type1._field6 = 0;
- vtStruct->_entries[entryIndex]._type1._field4 = v0;
- vtStruct->_entries[entryIndex]._type1._field5 = 0;
+ VoiceStructEntryType1 &vte = vtStruct->_entries[entryIndex]._type1;
+ vte._field6 = 0;
+ vte._field4 = v0;
+ vte._field5 = 0;
driver->playSound(channelData, 0, _chProgram[channelNum], vtStruct->_entries[entryIndex]._voiceNum, v0, v1);
}
@@ -2207,9 +2216,10 @@ void Sound::soPlaySound2(VoiceTypeStruct *vtStruct, const byte *channelData, int
assert(driver);
byte *trackData = _channelData[trackCtr];
- vtStruct->_entries[entryIndex]._type1._field6 = 0;
- vtStruct->_entries[entryIndex]._type1._field4 = v0;
- vtStruct->_entries[entryIndex]._type1._field5 = 0;
+ VoiceStructEntryType1 &vte = vtStruct->_entries[entryIndex]._type1;
+ vte._field6 = 0;
+ vte._field4 = v0;
+ vte._field5 = 0;
int v1, v2;
driver->playSound(trackData, 14, -1, vtStruct->_entries[entryIndex]._voiceNum, v0, 0x7F);
@@ -2336,9 +2346,10 @@ void Sound::soServiceTrackType1(int trackIndex, const byte *channelData) {
SoundDriver *driver = vtStruct->_entries[entryIndex]._driver;
assert(driver);
- vtStruct->_entries[entryIndex]._type1._field6 = 0;
- vtStruct->_entries[entryIndex]._type1._field4 = *(channelData + 1);
- vtStruct->_entries[entryIndex]._type1._field5 = 0;
+ VoiceStructEntryType1 &vte = vtStruct->_entries[entryIndex]._type1;
+ vte._field6 = 0;
+ vte._field4 = *(channelData + 1);
+ vte._field5 = 0;
int v1, v2;
driver->playSound(channelData, 14, -1, vtStruct->_entries[entryIndex]._voiceNum, *(channelData + 1), 0x7f);
diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h
index ff9379c254..49558b4bca 100644
--- a/engines/tsage/sound.h
+++ b/engines/tsage/sound.h
@@ -118,15 +118,14 @@ struct VoiceStructEntryType0 {
Sound *_sound;
int _channelNum;
int _priority;
- int _fieldA;
+ bool _fieldA;
Sound *_sound2;
int _channelNum2;
int _priority2;
- int _field12;
+ bool _field12;
Sound *_sound3;
int _channelNum3;
int _priority3;
- int _field1A;
};
struct VoiceStructEntryType1 {
diff --git a/engines/tucker/graphics.cpp b/engines/tucker/graphics.cpp
index 5e3d989110..b9c184e2bb 100644
--- a/engines/tucker/graphics.cpp
+++ b/engines/tucker/graphics.cpp
@@ -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 3e2745186c..3e48179a30 100644
--- a/engines/tucker/graphics.h
+++ b/engines/tucker/graphics.h
@@ -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 13d5f06894..b5fb10c59e 100644
--- a/engines/tucker/locations.cpp
+++ b/engines/tucker/locations.cpp
@@ -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 48ddefe455..5f06334720 100644
--- a/engines/tucker/resource.cpp
+++ b/engines/tucker/resource.cpp
@@ -127,7 +127,7 @@ public:
}
bool findNextToken(DataToken t) {
- const char *token = 0;
+ const char *token = nullptr;
switch (t) {
case kDataTokenDw:
token = "dw";
@@ -279,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)) {
@@ -351,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);
}
}
@@ -408,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;
}
}
@@ -431,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;
}
}
}
@@ -455,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
@@ -571,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;
@@ -592,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;
}
}
@@ -626,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;
@@ -636,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;
}
}
}
@@ -673,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();
}
}
}
@@ -726,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();
}
}
}
@@ -756,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;
@@ -819,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() {
@@ -835,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() {
@@ -857,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);
@@ -896,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();
@@ -924,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";
@@ -1005,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;
}
}
@@ -1031,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 5f40cbf904..92da2d4d9b 100644
--- a/engines/tucker/saveload.cpp
+++ b/engines/tucker/saveload.cpp
@@ -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 4b36a13f76..2fb881f77e 100644
--- a/engines/tucker/sequences.cpp
+++ b/engines/tucker/sequences.cpp
@@ -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/tucker.cpp b/engines/tucker/tucker.cpp
index 7eb4856050..adf4be6b65 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -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,7 +3710,7 @@ void TuckerEngine::setActionForInventoryObject() {
_actionCharacterNum = 99;
setCursorType(2);
_charSpeechSoundCounter = kDefaultCharSpeechSoundCounter;
- _actionVerbLocked = 0;
+ _actionVerbLocked = false;
_actionRequiresTwoObjects = false;
return;
}
@@ -3686,7 +3718,7 @@ void TuckerEngine::setActionForInventoryObject() {
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();
@@ -3695,7 +3727,7 @@ void TuckerEngine::setActionForInventoryObject() {
if (!_actionRequiresTwoObjects) {
_actionRequiresTwoObjects = true;
} else {
- _actionVerbLocked = 0;
+ _actionVerbLocked = false;
_actionRequiresTwoObjects = false;
_locationMaskCounter = 1;
setActionState();
@@ -3755,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;
@@ -3789,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;
@@ -3803,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;
}
@@ -3819,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 1a970e3a0c..adcd02b2fe 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -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];
diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp
index be6148c351..c1ded75f02 100644
--- a/engines/voyeur/animation.cpp
+++ b/engines/voyeur/animation.cpp
@@ -50,10 +50,10 @@ RL2Decoder::~RL2Decoder() {
bool RL2Decoder::loadVideo(int videoId) {
Common::String filename = Common::String::format("%s.rl2",
::Voyeur::SZ_FILENAMES[videoId * 2]);
- return loadFile(filename);
+ return loadRL2File(filename, false);
}
-bool RL2Decoder::loadFile(const Common::String &file, bool palFlag) {
+bool RL2Decoder::loadRL2File(const Common::String &file, bool palFlag) {
bool result = VideoDecoder::loadFile(file);
_paletteStart = palFlag ? 0 : 128;
return result;
@@ -100,7 +100,7 @@ const Common::List<Common::Rect> *RL2Decoder::getDirtyRects() const {
if (_videoTrack)
return _videoTrack->getDirtyRects();
- return 0;
+ return nullptr;
}
void RL2Decoder::clearDirtyRects() {
@@ -115,7 +115,7 @@ void RL2Decoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) {
void RL2Decoder::readNextPacket() {
int frameNumber = getCurFrame();
- RL2AudioTrack *audioTrack = getAudioTrack();
+ RL2AudioTrack *audioTrack = getRL2AudioTrack();
// Handle queueing sound data
if (_soundFrameNumber == -1)
@@ -224,8 +224,7 @@ Common::Rational RL2Decoder::RL2FileHeader::getFrameRate() const {
/*------------------------------------------------------------------------*/
RL2Decoder::RL2VideoTrack::RL2VideoTrack(const RL2FileHeader &header, RL2AudioTrack *audioTrack,
- Common::SeekableReadStream *stream):
- _header(header), _audioTrack(audioTrack), _fileStream(stream) {
+ Common::SeekableReadStream *stream): _header(header), _fileStream(stream) {
_frameOffsets = nullptr;
@@ -465,7 +464,7 @@ void RL2Decoder::play(VoyeurEngine *vm, int resourceOffset,
int paletteStart = getPaletteStart();
int paletteCount = getPaletteCount();
- PictureResource videoFrame(getVideoTrack()->getBackSurface());
+ PictureResource videoFrame(getRL2VideoTrack()->getBackSurface());
int picCtr = 0;
while (!vm->shouldQuit() && !endOfVideo() && !vm->_eventsManager->_mouseClicked) {
if (hasDirtyPalette()) {
diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h
index dcdbf36260..b17e998214 100644
--- a/engines/voyeur/animation.h
+++ b/engines/voyeur/animation.h
@@ -130,7 +130,6 @@ private:
private:
Common::SeekableReadStream *_fileStream;
const RL2FileHeader &_header;
- RL2AudioTrack *_audioTrack;
Graphics::Surface *_surface;
Graphics::Surface *_backSurface;
bool _hasBackFrame;
@@ -175,7 +174,7 @@ public:
virtual void close();
bool loadStream(Common::SeekableReadStream *stream);
- bool loadFile(const Common::String &file, bool palFlag = false);
+ bool loadRL2File(const Common::String &file, bool palFlag);
bool loadVideo(int videoId);
int getPaletteCount() const { return _header._colorCount; }
@@ -187,8 +186,8 @@ public:
* @param imgPos Position to draw image data
*/
void play(VoyeurEngine *vm, int resourceOffset = 0, byte *frames = NULL, byte *imgPos = NULL);
- RL2VideoTrack *getVideoTrack() { return _videoTrack; }
- RL2AudioTrack *getAudioTrack() { return _audioTrack; }
+ RL2VideoTrack *getRL2VideoTrack() { return _videoTrack; }
+ RL2AudioTrack *getRL2AudioTrack() { return _audioTrack; }
};
} // End of namespace Voyeur
diff --git a/engines/voyeur/data.cpp b/engines/voyeur/data.cpp
index 9e29ae4618..cc0b81a313 100644
--- a/engines/voyeur/data.cpp
+++ b/engines/voyeur/data.cpp
@@ -49,7 +49,7 @@ SVoy::SVoy(VoyeurEngine *vm):_vm(vm) {
_audioVisualStartTime = 0;
_audioVisualDuration = 0;
_boltGroupId2 = 0;
- _computerTextId = 0;
+ _computerTextId = -1;
_computerTimeMin = _computerTimeMax = 0;
_eventCount = 0;
_fadingStep1 = 0;
@@ -90,6 +90,8 @@ SVoy::SVoy(VoyeurEngine *vm):_vm(vm) {
_events[i]._computerOff = 0;
_events[i]._dead = 0;
}
+ for (int i = 0; i < 6; i++)
+ _evCmPtrs[i] = nullptr;
}
void SVoy::addEvent(int hour, int minute, VoyeurEventType type, int audioVideoId,
@@ -240,7 +242,7 @@ void SVoy::reviewAnEvidEvent(int eventIndex) {
if (_vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)) {
_vm->_graphicsManager->_backColors = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._cMapResource;
_vm->_graphicsManager->_backgroundPage = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._picResource;
- (*_vm->_graphicsManager->_vPort)->setupViewPort(_vm->_graphicsManager->_backgroundPage);
+ _vm->_graphicsManager->_vPort->setupViewPort(_vm->_graphicsManager->_backgroundPage);
_vm->_graphicsManager->_backColors->startFade();
_vm->doEvidDisplay(frameOff, e._dead);
@@ -262,7 +264,7 @@ void SVoy::reviewComputerEvent(int eventIndex) {
if (_vm->_bVoy->getBoltGroup(_vm->_playStampGroupId)) {
_vm->_graphicsManager->_backColors = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1)._cMapResource;
_vm->_graphicsManager->_backgroundPage = _vm->_bVoy->boltEntry(_vm->_playStampGroupId)._picResource;
- (*_vm->_graphicsManager->_vPort)->setupViewPort(_vm->_graphicsManager->_backgroundPage);
+ _vm->_graphicsManager->_vPort->setupViewPort(_vm->_graphicsManager->_backgroundPage);
_vm->_graphicsManager->_backColors->startFade();
_vm->flipPageAndWaitForFade();
@@ -277,7 +279,8 @@ void SVoy::reviewComputerEvent(int eventIndex) {
}
bool SVoy::checkForKey() {
- _vm->_controlPtr->_state->_victimEvidenceIndex = 0;
+ StateResource *state = _vm->_controlPtr->_state;
+ state->_victimEvidenceIndex = 0;
if (_vm->_voy->_victimMurdered)
return false;
@@ -286,25 +289,25 @@ bool SVoy::checkForKey() {
switch (e._type) {
case EVTYPE_VIDEO:
- switch (_vm->_controlPtr->_state->_victimIndex) {
+ switch (state->_victimIndex) {
case 1:
if (e._audioVideoId == 33 && e._computerOn < 2 && e._computerOff >= 38)
- _vm->_controlPtr->_state->_victimEvidenceIndex = 1;
+ state->_victimEvidenceIndex = 1;
break;
case 2:
if (e._audioVideoId == 47 && e._computerOn < 2 && e._computerOff >= 9)
- _vm->_controlPtr->_state->_victimEvidenceIndex = 2;
+ state->_victimEvidenceIndex = 2;
break;
case 3:
if (e._audioVideoId == 46 && e._computerOn < 2 && e._computerOff > 2)
- _vm->_controlPtr->_state->_victimEvidenceIndex = 3;
+ state->_victimEvidenceIndex = 3;
break;
case 4:
if (e._audioVideoId == 40 && e._computerOn < 2 && e._computerOff > 6)
- _vm->_controlPtr->_state->_victimEvidenceIndex = 4;
+ state->_victimEvidenceIndex = 4;
break;
default:
@@ -313,17 +316,17 @@ bool SVoy::checkForKey() {
break;
case EVTYPE_AUDIO:
- switch (_vm->_controlPtr->_state->_victimIndex) {
+ switch (state->_victimIndex) {
case 1:
if (e._audioVideoId == 8 && e._computerOn < 2 && e._computerOff > 26)
- _vm->_controlPtr->_state->_victimEvidenceIndex = 1;
+ state->_victimEvidenceIndex = 1;
break;
case 3:
if (e._audioVideoId == 20 && e._computerOn < 2 && e._computerOff > 28)
- _vm->_controlPtr->_state->_victimEvidenceIndex = 3;
+ state->_victimEvidenceIndex = 3;
if (e._audioVideoId == 35 && e._computerOn < 2 && e._computerOff > 18)
- _vm->_controlPtr->_state->_victimEvidenceIndex = 3;
+ state->_victimEvidenceIndex = 3;
break;
default:
@@ -332,10 +335,10 @@ bool SVoy::checkForKey() {
break;
case EVTYPE_EVID:
- switch (_vm->_controlPtr->_state->_victimIndex) {
+ switch (state->_victimIndex) {
case 4:
if (e._audioVideoId == 0x2400 && e._computerOn == 0x4f00 && e._computerOff == 17)
- _vm->_controlPtr->_state->_victimEvidenceIndex = 4;
+ state->_victimEvidenceIndex = 4;
default:
break;
@@ -343,10 +346,10 @@ bool SVoy::checkForKey() {
break;
case EVTYPE_COMPUTER:
- switch (_vm->_controlPtr->_state->_victimIndex) {
+ switch (state->_victimIndex) {
case 2:
if (e._computerOn == 13 && e._computerOff > 76)
- _vm->_controlPtr->_state->_victimEvidenceIndex = 2;
+ state->_victimEvidenceIndex = 2;
break;
default:
@@ -358,7 +361,7 @@ bool SVoy::checkForKey() {
break;
}
- if (_vm->_controlPtr->_state->_victimEvidenceIndex == _vm->_controlPtr->_state->_victimIndex)
+ if (state->_victimEvidenceIndex == state->_victimIndex)
return true;
}
diff --git a/engines/voyeur/debugger.cpp b/engines/voyeur/debugger.cpp
index fdd0825181..234300bce5 100644
--- a/engines/voyeur/debugger.cpp
+++ b/engines/voyeur/debugger.cpp
@@ -92,10 +92,37 @@ bool Debugger::Cmd_Time(int argc, const char **argv) {
}
bool Debugger::Cmd_Hotspots(int argc, const char **argv) {
+ if (_vm->_voy->_computerTextId >= 0) {
+ DebugPrintf("Hotspot Computer Screen %d - %d,%d->%d,%d\n",
+ _vm->_voy->_computerTextId,
+ _vm->_voy->_computerScreenRect.left,
+ _vm->_voy->_computerScreenRect.top,
+ _vm->_voy->_computerScreenRect.right,
+ _vm->_voy->_computerScreenRect.bottom);
+ }
+
+#if 0
+ // Room hotspots
+ BoltEntry &boltEntry = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 4);
+ if (boltEntry._rectResource) {
+ Common::Array<RectEntry> &hotspots = boltEntry._rectResource->_entries;
+ for (uint hotspotIdx = 0; hotspotIdx < hotspots.size(); ++hotspotIdx) {
+ Common::String pos = Common::String::format("(%d,%d->%d,%d)",
+ hotspots[hotspotIdx].left, hotspots[hotspotIdx].top,
+ hotspots[hotspotIdx].right, hotspots[hotspotIdx].bottom);
+ int arrIndex = hotspots[hotspotIdx]._arrIndex;
+ if (_vm->_voy->_roomHotspotsEnabled[arrIndex - 1]) {
+ DebugPrintf("Hotspot Room %d - %s - Enabled\n", arrIndex, pos);
+ } else {
+ DebugPrintf("Hotspot Room - %s - Disabled\n", pos);
+ }
+ }
+ }
+#endif
+
+ // Outside view hotspots
BoltEntry &boltEntry = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 1);
- if (!boltEntry._rectResource) {
- DebugPrintf("No hotspots available\n");
- } else {
+ if (boltEntry._rectResource) {
Common::Array<RectEntry> &hotspots = boltEntry._rectResource->_entries;
for (uint hotspotIdx = 0; hotspotIdx < hotspots.size(); ++hotspotIdx) {
@@ -130,7 +157,7 @@ bool Debugger::Cmd_Hotspots(int argc, const char **argv) {
}
}
- DebugPrintf("\n");
+ DebugPrintf("\nEnd of list\n");
return true;
}
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 4c1ed419a2..9a3c6d00ff 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -82,6 +82,9 @@ EventsManager::EventsManager(VoyeurEngine *vm) : _intPtr(_gameData),
_fadeFirstCol = _fadeLastCol = 0;
_fadeCount = 1;
+
+ for (int i = 0; i < 4; i++)
+ _cycleNext[i] = nullptr;
}
void EventsManager::startMainClockInt() {
@@ -263,18 +266,18 @@ void EventsManager::pollEvents() {
}
return;
case Common::EVENT_LBUTTONDOWN:
- _vm->_eventsManager->_newLeftClick = true;
- _vm->_eventsManager->_newMouseClicked = true;
+ _newLeftClick = true;
+ _newMouseClicked = true;
return;
case Common::EVENT_RBUTTONDOWN:
- _vm->_eventsManager->_newRightClick = true;
- _vm->_eventsManager->_newMouseClicked = true;
+ _newRightClick = true;
+ _newMouseClicked = true;
return;
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONUP:
- _vm->_eventsManager->_newMouseClicked = false;
- _vm->_eventsManager->_newLeftClick = false;
- _vm->_eventsManager->_newRightClick = false;
+ _newMouseClicked = false;
+ _newLeftClick = false;
+ _newRightClick = false;
return;
case Common::EVENT_MOUSEMOVE:
_mousePos = event.mouse;
@@ -571,13 +574,13 @@ void EventsManager::getMouseInfo() {
}
}
- _vm->_eventsManager->_mouseClicked = _vm->_eventsManager->_newMouseClicked;
- _vm->_eventsManager->_leftClick = _vm->_eventsManager->_newLeftClick;
- _vm->_eventsManager->_rightClick = _vm->_eventsManager->_newRightClick;
+ _mouseClicked = _newMouseClicked;
+ _leftClick = _newLeftClick;
+ _rightClick = _newRightClick;
- _vm->_eventsManager->_newMouseClicked = false;
- _vm->_eventsManager->_newLeftClick = false;
- _vm->_eventsManager->_newRightClick = false;
+ _newMouseClicked = false;
+ _newLeftClick = false;
+ _newRightClick = false;
}
void EventsManager::startCursorBlink() {
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 9d1ff58b67..7369d9280e 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -29,7 +29,7 @@ namespace Voyeur {
#define BOLT_GROUP_SIZE 16
-BoltFilesState::BoltFilesState() {
+BoltFilesState::BoltFilesState(VoyeurEngine *vm) : _vm(vm) {
_curLibPtr = NULL;
_curGroupPtr = NULL;
_curMemberPtr = NULL;
@@ -174,20 +174,24 @@ void BoltFilesState::nextBlock() {
FilesManager::FilesManager(VoyeurEngine *vm) {
_curLibPtr = nullptr;
- _boltFilesState._vm = vm;
+ _boltFilesState = new BoltFilesState(vm);
+}
+
+FilesManager::~FilesManager() {
+ delete _boltFilesState;
}
bool FilesManager::openBoltLib(const Common::String &filename, BoltFile *&boltFile) {
if (boltFile != NULL) {
- _boltFilesState._curLibPtr = boltFile;
+ _boltFilesState->_curLibPtr = boltFile;
return true;
}
// Create the bolt file interface object and load the index
if (filename == "bvoy.blt")
- boltFile = _boltFilesState._curLibPtr = new BVoyBoltFile(_boltFilesState);
+ boltFile = _boltFilesState->_curLibPtr = new BVoyBoltFile(*_boltFilesState);
else if (filename == "stampblt.blt")
- boltFile = _boltFilesState._curLibPtr = new StampBoltFile(_boltFilesState);
+ boltFile = _boltFilesState->_curLibPtr = new StampBoltFile(*_boltFilesState);
else
error("Unknown bolt file specified");
@@ -470,7 +474,7 @@ void BVoyBoltFile::initViewPort() {
_state._curMemberPtr->_viewPortResource = viewPort = new ViewPortResource(_state, src);
// This is done post-constructor, since viewports can be self referential, so
- // we ned the _viewPortResource field to have been set before resolving the pointer
+ // we need the _viewPortResource field to have been set before resolving the pointer
viewPort->_parent = getBoltEntryFromLong(READ_LE_UINT32(src + 2))._viewPortResource;
}
@@ -482,7 +486,7 @@ void BVoyBoltFile::initViewPortList() {
_state, _state._curMemberPtr->_data);
_state._vm->_graphicsManager->_viewPortListPtr = res;
- _state._vm->_graphicsManager->_vPort = &res->_entries[0];
+ _state._vm->_graphicsManager->_vPort = res->_entries[0];
}
void BVoyBoltFile::initFontInfo() {
@@ -683,8 +687,7 @@ void BoltEntry::load() {
*/
bool BoltEntry::hasResource() const {
return _rectResource || _picResource || _viewPortResource || _viewPortListResource
- || _fontResource || _fontInfoResource || _cMapResource
- || _vInitCycleResource
+ || _fontResource || _fontInfoResource || _cMapResource || _vInitCycleResource
|| _ptrResource || _controlResource || _stateResource || _threadResource;
}
@@ -739,12 +742,12 @@ RectResource::RectResource(int x1, int y1, int x2, int y2) {
DisplayResource::DisplayResource() {
_vm = NULL;
- _flags = 0;
+ _flags = DISPFLAG_NONE;
}
DisplayResource::DisplayResource(VoyeurEngine *vm) {
_vm = vm;
- _flags = 0;
+ _flags = DISPFLAG_NONE;
}
void DisplayResource::sFillBox(int width, int height) {
@@ -753,7 +756,7 @@ void DisplayResource::sFillBox(int width, int height) {
_vm->_graphicsManager->_saveBack = false;
PictureResource pr;
- pr._flags = 1;
+ pr._flags = DISPFLAG_1;
pr._select = 0xff;
pr._pick = 0;
pr._onOff = _vm->_graphicsManager->_drawPtr->_penColor;
@@ -847,7 +850,7 @@ int DisplayResource::drawText(const Common::String &msg) {
break;
}
- if (!(fontInfo._fontFlags & 3)) {
+ if (!(fontInfo._fontFlags & (DISPFLAG_1 | DISPFLAG_2))) {
viewPort->_fontRect.left = xp;
viewPort->_fontRect.top = yp;
viewPort->_fontRect.setWidth(msgWidth);
@@ -862,7 +865,7 @@ int DisplayResource::drawText(const Common::String &msg) {
pos.x = xp;
pos.y = yp;
- if (fontInfo._fontFlags & 4) {
+ if (fontInfo._fontFlags & DISPFLAG_4) {
if (fontInfo._shadow.x <= 0) {
viewPort->_fontRect.left += fontInfo._shadow.x;
viewPort->_fontRect.right -= fontInfo._shadow.x * 2;
@@ -943,7 +946,7 @@ int DisplayResource::drawText(const Common::String &msg) {
if (i != 0) {
fontChar._pick = 0;
fontChar._onOff = fontInfo._shadowColor;
- } else if (fontData._fontDepth == 1 || (fontInfo._fontFlags & 0x10)) {
+ } else if (fontData._fontDepth == 1 || (fontInfo._fontFlags & DISPFLAG_10)) {
fontChar._pick = 0;
fontChar._onOff = fontInfo._foreColor;
} else {
@@ -1121,12 +1124,13 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src):
}
PictureResource::PictureResource(Graphics::Surface *surface) {
- _flags = 0;
+ _flags = DISPFLAG_NONE;
_select = 0;
_pick = 0;
_onOff = 0;
_maskData = 0;
_planeSize = 0;
+ _keyColor = 0;
_bounds = Common::Rect(0, 0, surface->w, surface->h);
_imgData = (byte *)surface->getPixels();
@@ -1134,12 +1138,13 @@ PictureResource::PictureResource(Graphics::Surface *surface) {
}
PictureResource::PictureResource() {
- _flags = 0;
+ _flags = DISPFLAG_NONE;
_select = 0;
_pick = 0;
_onOff = 0;
_maskData = 0;
_planeSize = 0;
+ _keyColor = 0;
_imgData = NULL;
_freeImgData = DisposeAfterUse::NO;
@@ -1156,6 +1161,7 @@ PictureResource::PictureResource(int flags, int select, int pick, int onOff,
_imgData = imgData;
_planeSize = planeSize;
_freeImgData = DisposeAfterUse::NO;
+ _keyColor = 0;
}
PictureResource::~PictureResource() {
@@ -1349,21 +1355,21 @@ void ViewPortResource::fillPic(byte onOff) {
void ViewPortResource::drawIfaceTime() {
// Hour display
- _state._vm->_graphicsManager->drawANumber(*_state._vm->_graphicsManager->_vPort,
+ _state._vm->_graphicsManager->drawANumber(_state._vm->_graphicsManager->_vPort,
(_state._vm->_gameHour / 10) == 0 ? 10 : _state._vm->_gameHour / 10,
Common::Point(161, 25));
- _state._vm->_graphicsManager->drawANumber(*_state._vm->_graphicsManager->_vPort,
+ _state._vm->_graphicsManager->drawANumber(_state._vm->_graphicsManager->_vPort,
_state._vm->_gameHour % 10, Common::Point(172, 25));
// Minute display
- _state._vm->_graphicsManager->drawANumber(*_state._vm->_graphicsManager->_vPort,
+ _state._vm->_graphicsManager->drawANumber(_state._vm->_graphicsManager->_vPort,
_state._vm->_gameMinute / 10, Common::Point(190, 25));
- _state._vm->_graphicsManager->drawANumber(*_state._vm->_graphicsManager->_vPort,
+ _state._vm->_graphicsManager->drawANumber(_state._vm->_graphicsManager->_vPort,
_state._vm->_gameMinute % 10, Common::Point(201, 25));
// AM/PM indicator
PictureResource *pic = _state._vm->_bVoy->boltEntry(_state._vm->_voy->_isAM ? 272 : 273)._picResource;
- _state._vm->_graphicsManager->sDrawPic(pic, *_state._vm->_graphicsManager->_vPort,
+ _state._vm->_graphicsManager->sDrawPic(pic, _state._vm->_graphicsManager->_vPort,
Common::Point(215, 27));
}
@@ -1467,11 +1473,11 @@ FontInfoResource::FontInfoResource(BoltFilesState &state, const byte *src) {
FontInfoResource::FontInfoResource() {
_curFont = NULL;
- _picFlags = 3;
+ _picFlags = DISPFLAG_1 | DISPFLAG_2;
_picSelect = 0xff;
_picPick = 0xff;
_picOnOff = 0;
- _fontFlags = 0;
+ _fontFlags = DISPFLAG_NONE;
_justify = ALIGN_LEFT;
_fontSaveBack = 0;
_justifyWidth = 1;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 16d27fb3f6..49c0b2c8a4 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -82,7 +82,7 @@ public:
byte *_boltPageFrame;
public:
- BoltFilesState();
+ BoltFilesState(VoyeurEngine *vm);
byte *decompress(byte *buf, int size, int mode);
void nextBlock();
@@ -204,10 +204,11 @@ public:
class FilesManager {
public:
- BoltFilesState _boltFilesState;
+ BoltFilesState *_boltFilesState;
BoltFile *_curLibPtr;
public:
FilesManager(VoyeurEngine *vm);
+ ~FilesManager();
bool openBoltLib(const Common::String &filename, BoltFile *&boltFile);
byte *fload(const Common::String &filename, int *size);
@@ -230,11 +231,21 @@ public:
virtual ~RectResource() {}
};
-enum DisplayFlag { DISPFLAG_1 = 1, DISPFLAG_2 = 2, DISPFLAG_4 = 4, DISPFLAG_8 = 8,
+/* bvoy.blt resource types */
+
+enum PictureFlag {
+ PICFLAG_2 = 2, PICFLAG_PIC_OFFSET = 8, PICFLAG_CLEAR_SCREEN = 0x10,
+ PICFLAG_20 = 0x20, PICFLAG_HFLIP = 0x40, PICFLAG_VFLIP = 0x80, PICFLAG_100 = 0x100,
+ PICFLAG_CLEAR_SCREEN00 = 0x1000
+};
+
+enum DisplayFlag {
+ DISPFLAG_1 = 1, DISPFLAG_2 = 2, DISPFLAG_4 = 4, DISPFLAG_8 = 8,
DISPFLAG_10 = 0x10, DISPFLAG_20 = 0x20, DISPFLAG_40 = 0x40, DISPFLAG_80 = 0x80,
DISPFLAG_100 = 0x100, DISPFLAG_200 = 0x200, DISPFLAG_400 = 0x400,
DISPFLAG_800 = 0x800, DISPFLAG_1000 = 0x1000, DISPFLAG_2000 = 0x2000,
- DISPFLAG_4000 = 0x4000, DISPFLAG_VIEWPORT = 0x8000, DISPFLAG_CURSOR = 0x10000 };
+ DISPFLAG_4000 = 0x4000, DISPFLAG_VIEWPORT = 0x8000, DISPFLAG_CURSOR = 0x10000,
+ DISPFLAG_NONE = 0};
class DisplayResource {
private:
@@ -266,13 +277,6 @@ public:
bool clipRect(Common::Rect &rect);
};
-/* bvoy.blt resource types */
-
-enum PictureFlag { PICFLAG_2 = 2, PICFLAG_PIC_OFFSET = 8, PICFLAG_CLEAR_SCREEN = 0x10,
- PICFLAG_20 = 0x20, PICFLAG_HFLIP = 0x40, PICFLAG_VFLIP = 0x80, PICFLAG_100 = 0x100,
- PICFLAG_CLEAR_SCREEN00 = 0x1000
-};
-
class PictureResource: public DisplayResource {
private:
/**
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index d2ac182030..700944f7ef 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -86,6 +86,9 @@ bool ThreadResource::loadAStack(int stackId) {
}
void ThreadResource::unloadAStack(int stackId) {
+ if (stackId < 0)
+ return;
+
if ((_vm->_stampFlags & 1) && _useCount[stackId]) {
if (--_useCount[stackId] == 0) {
_vm->_stampLibPtr->freeBoltMember(_vm->_controlPtr->_memberIds[stackId]);
@@ -458,7 +461,7 @@ void ThreadResource::parsePlayCommands() {
pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + i * 2)._picResource;
pal = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + i * 2 + 1)._cMapResource;
- (*_vm->_graphicsManager->_vPort)->setupViewPort(pic);
+ _vm->_graphicsManager->_vPort->setupViewPort(pic);
pal->startFade();
_vm->flipPageAndWaitForFade();
@@ -1038,7 +1041,7 @@ int ThreadResource::doApt() {
// Draw the text description for the highlighted hotspot
pic = _vm->_bVoy->boltEntry(_vm->_playStampGroupId +
hotspotId + 6)._picResource;
- _vm->_graphicsManager->sDrawPic(pic, *_vm->_graphicsManager->_vPort,
+ _vm->_graphicsManager->sDrawPic(pic, _vm->_graphicsManager->_vPort,
Common::Point(106, 200));
}
@@ -1107,7 +1110,7 @@ void ThreadResource::doRoom() {
vm._graphicsManager->_backColors = vm._bVoy->boltEntry(vm._playStampGroupId + 1)._cMapResource;
vm._graphicsManager->_backgroundPage = vm._bVoy->boltEntry(vm._playStampGroupId)._picResource;
- (*vm._graphicsManager->_vPort)->setupViewPort(vm._graphicsManager->_backgroundPage);
+ vm._graphicsManager->_vPort->setupViewPort(vm._graphicsManager->_backgroundPage);
vm._graphicsManager->_backColors->startFade();
voy._fadingStep1 = 2;
@@ -1232,7 +1235,7 @@ void ThreadResource::doRoom() {
vm._graphicsManager->_backgroundPage = vm._bVoy->boltEntry(
vm._playStampGroupId)._picResource;
- (*vm._graphicsManager->_vPort)->setupViewPort();
+ vm._graphicsManager->_vPort->setupViewPort();
vm._graphicsManager->_backColors->startFade();
_vm->flipPageAndWait();
@@ -1307,12 +1310,13 @@ int ThreadResource::doInterface() {
if (_vm->_voy->_RTVNum >= _vm->_voy->_RTVLimit || _vm->_voy->_RTVNum < 0)
_vm->_voy->_RTVNum = _vm->_voy->_RTVLimit - 1;
- if (_vm->_voy->_transitionId < 15 && _vm->_debugger->_isTimeActive &&
- (_vm->_voy->_RTVLimit - 3) < _vm->_voy->_RTVNum) {
+ if (_vm->_voy->_transitionId < 15 && _vm->_debugger->_isTimeActive
+ && (_vm->_voy->_RTVLimit - 3) < _vm->_voy->_RTVNum) {
_vm->_voy->_RTVNum = _vm->_voy->_RTVLimit;
_vm->makeViewFinder();
_vm->initIFace();
+ _vm->_eventsManager->hideCursor();
_vm->_voy->_RTVNum = _vm->_voy->_RTVLimit - 4;
_vm->_voy->_eventFlags &= ~EVTFLAG_TIME_DISABLED;
@@ -1324,6 +1328,8 @@ int ThreadResource::doInterface() {
_vm->_voy->_eventFlags |= EVTFLAG_TIME_DISABLED;
chooseSTAMPButton(20);
parsePlayCommands();
+
+ _vm->_eventsManager->showCursor();
}
_vm->checkTransition();
@@ -1414,20 +1420,20 @@ int ThreadResource::doInterface() {
// Regularly update the time display
if (_vm->_voy->_RTANum & 2) {
- _vm->_graphicsManager->drawANumber(*_vm->_graphicsManager->_vPort,
+ _vm->_graphicsManager->drawANumber(_vm->_graphicsManager->_vPort,
_vm->_gameMinute / 10, Common::Point(190, 25));
- _vm->_graphicsManager->drawANumber(*_vm->_graphicsManager->_vPort,
+ _vm->_graphicsManager->drawANumber(_vm->_graphicsManager->_vPort,
_vm->_gameMinute % 10, Common::Point(201, 25));
if (_vm->_voy->_RTANum & 4) {
int v = _vm->_gameHour / 10;
- _vm->_graphicsManager->drawANumber(*_vm->_graphicsManager->_vPort,
+ _vm->_graphicsManager->drawANumber(_vm->_graphicsManager->_vPort,
v == 0 ? 10 : v, Common::Point(161, 25));
- _vm->_graphicsManager->drawANumber(*_vm->_graphicsManager->_vPort,
+ _vm->_graphicsManager->drawANumber(_vm->_graphicsManager->_vPort,
_vm->_gameHour % 10, Common::Point(172, 25));
pic = _vm->_bVoy->boltEntry(_vm->_voy->_isAM ? 272 : 273)._picResource;
- _vm->_graphicsManager->sDrawPic(pic, *_vm->_graphicsManager->_vPort,
+ _vm->_graphicsManager->sDrawPic(pic, _vm->_graphicsManager->_vPort,
Common::Point(215, 27));
}
}
@@ -1595,13 +1601,13 @@ void ThreadResource::loadTheApt() {
_vm->_voy->_aptLoadMode = -1;
_vm->_graphicsManager->_backgroundPage = _vm->_bVoy->boltEntry(
_vm->_playStampGroupId + 5)._picResource;
- (*_vm->_graphicsManager->_vPort)->setupViewPort(
+ _vm->_graphicsManager->_vPort->setupViewPort(
_vm->_graphicsManager->_backgroundPage);
} else {
_vm->_bVoy->getBoltGroup(_vm->_playStampGroupId);
_vm->_graphicsManager->_backgroundPage = _vm->_bVoy->boltEntry(
_vm->_playStampGroupId + 5)._picResource;
- (*_vm->_graphicsManager->_vPort)->setupViewPort(
+ _vm->_graphicsManager->_vPort->setupViewPort(
_vm->_graphicsManager->_backgroundPage);
}
@@ -1633,7 +1639,7 @@ void ThreadResource::freeTheApt() {
_vm->_graphicsManager->resetPalette();
}
- (*_vm->_graphicsManager->_vPort)->setupViewPort(nullptr);
+ _vm->_graphicsManager->_vPort->setupViewPort(nullptr);
_vm->_bVoy->freeBoltGroup(_vm->_playStampGroupId);
_vm->_playStampGroupId = -1;
_vm->_voy->_viewBounds = nullptr;
@@ -1693,7 +1699,7 @@ void ThreadResource::doAptAnim(int mode) {
for (int idx = 0; (idx < 6) && !_vm->shouldQuit(); ++idx) {
PictureResource *pic = _vm->_bVoy->boltEntry(id + idx + 1)._picResource;
- (*_vm->_graphicsManager->_vPort)->setupViewPort(pic);
+ _vm->_graphicsManager->_vPort->setupViewPort(pic);
pal->startFade();
_vm->flipPageAndWait();
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index ea34148007..f756b9cc85 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -48,7 +48,7 @@ GraphicsManager::GraphicsManager(VoyeurEngine *vm) : _defaultDrawInfo(1, Common:
_vPort = NULL;
_fontPtr = NULL;
Common::fill(&_VGAColors[0], &_VGAColors[PALETTE_SIZE], 0);
- _fontChar = new PictureResource(0, 0xff, 0xff, 0, Common::Rect(), 0, NULL, 0);
+ _fontChar = new PictureResource(DISPFLAG_NONE, 0xff, 0xff, 0, Common::Rect(), 0, NULL, 0);
_backColors = nullptr;
}
@@ -65,7 +65,7 @@ GraphicsManager::~GraphicsManager() {
void GraphicsManager::setupMCGASaveRect(ViewPortResource *viewPort) {
if (viewPort->_activePage) {
- viewPort->_activePage->_flags |= 1;
+ viewPort->_activePage->_flags |= DISPFLAG_1;
Common::Rect *clipRect = _clipPtr;
_clipPtr = &viewPort->_clipRect;
@@ -219,7 +219,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
widthDiff2 = destPic->_bounds.width() - width2;
if (destViewPort) {
- if (!_saveBack || ((srcPic->_flags & DISPFLAG_800) != 0)) {
+ if (!_saveBack || (srcPic->_flags & DISPFLAG_800)) {
backBounds.left = destPic->_bounds.left + offset.x;
backBounds.top = destPic->_bounds.top + offset.y;
backBounds.setWidth(width2);
@@ -864,7 +864,7 @@ void GraphicsManager::fillPic(DisplayResource *display, byte onOff) {
}
PictureResource picResource;
- picResource._flags = 0;
+ picResource._flags = DISPFLAG_NONE;
picResource._select = 0xff;
picResource._pick = 0;
picResource._onOff = onOff;
@@ -991,8 +991,8 @@ void GraphicsManager::screenReset() {
resetPalette();
_backgroundPage = NULL;
- (*_vPort)->setupViewPort(NULL);
- fillPic(*_vPort, 0);
+ _vPort->setupViewPort(NULL);
+ fillPic(_vPort, 0);
_vm->flipPageAndWait();
}
diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h
index e7421915c8..221d31061d 100644
--- a/engines/voyeur/graphics.h
+++ b/engines/voyeur/graphics.h
@@ -66,7 +66,7 @@ public:
PictureResource *_backgroundPage;
int _SVGAMode;
ViewPortListResource *_viewPortListPtr;
- ViewPortResource **_vPort;
+ ViewPortResource *_vPort;
bool _saveBack;
Common::Rect *_clipPtr;
uint _planeSelect;
diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp
index ae10b2d4d9..26145bd743 100644
--- a/engines/voyeur/sound.cpp
+++ b/engines/voyeur/sound.cpp
@@ -28,7 +28,7 @@
namespace Voyeur {
- SoundManager::SoundManager(VoyeurEngine *vm, Audio::Mixer *mixer) : _vm(vm) {
+ SoundManager::SoundManager(Audio::Mixer *mixer) {
_mixer = mixer;
_vocOffset = 0;
}
diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h
index fc2d3047eb..af1d0b1b46 100644
--- a/engines/voyeur/sound.h
+++ b/engines/voyeur/sound.h
@@ -33,12 +33,11 @@ namespace Voyeur {
class SoundManager {
private:
- VoyeurEngine *_vm;
Audio::Mixer *_mixer;
Audio::SoundHandle _soundHandle;
int _vocOffset;
public:
- SoundManager(VoyeurEngine *vm, Audio::Mixer *mixer);
+ SoundManager(Audio::Mixer *mixer);
void playVOCMap(byte *voc, int vocSize);
void stopVOCPlay();
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index 0406ba089a..9843930bd3 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -71,8 +71,17 @@ VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc)
_eventsManager = new EventsManager(this);
_filesManager = new FilesManager(this);
_graphicsManager = new GraphicsManager(this);
- _soundManager = new SoundManager(this, _mixer);
+ _soundManager = new SoundManager(_mixer);
_voy = new SVoy(this);
+
+ _stampLibPtr = nullptr;
+ _controlGroupPtr = nullptr;
+ _stampData = nullptr;
+ _stackGroupPtr = nullptr;
+ _glGoState = -1;
+ _glGoStack = -1;
+ _resolvePtr = nullptr;
+ _mainThread = nullptr;
}
VoyeurEngine::~VoyeurEngine() {
@@ -205,7 +214,7 @@ bool VoyeurEngine::doHeadTitle() {
void VoyeurEngine::showConversionScreen() {
_graphicsManager->_backgroundPage = _bVoy->boltEntry(0x502)._picResource;
- (*_graphicsManager->_vPort)->setupViewPort();
+ _graphicsManager->_vPort->setupViewPort();
flipPageAndWait();
// Immediate palette load to show the initial screen
@@ -247,10 +256,10 @@ bool VoyeurEngine::doLock() {
Common::Array<RectEntry> &hotspots = _bVoy->boltEntry(0x705)._rectResource->_entries;
assert(cursorPic);
- (*_graphicsManager->_vPort)->setupViewPort();
+ _graphicsManager->_vPort->setupViewPort();
_graphicsManager->_backColors->startFade();
- (*_graphicsManager->_vPort)->_parent->_flags |= DISPFLAG_8;
+ _graphicsManager->_vPort->_parent->_flags |= DISPFLAG_8;
_graphicsManager->flipPage();
_eventsManager->sWaitFlip();
@@ -271,7 +280,7 @@ bool VoyeurEngine::doLock() {
_graphicsManager->_fontPtr->_curFont = _bVoy->boltEntry(0x708)._fontResource;
_graphicsManager->_fontPtr->_fontSaveBack = 0;
- _graphicsManager->_fontPtr->_fontFlags = 0;
+ _graphicsManager->_fontPtr->_fontFlags = DISPFLAG_NONE;
Common::String dateString = "ScummVM";
Common::String displayString = Common::String::format("Last Play %s", dateString.c_str());
@@ -279,7 +288,7 @@ bool VoyeurEngine::doLock() {
bool firstLoop = true;
bool breakFlag = false;
while (!breakFlag && !shouldQuit()) {
- (*_graphicsManager->_vPort)->setupViewPort();
+ _graphicsManager->_vPort->setupViewPort();
flipPageAndWait();
// Display the last play time
@@ -288,7 +297,7 @@ bool VoyeurEngine::doLock() {
_graphicsManager->_fontPtr->_justifyWidth = 384;
_graphicsManager->_fontPtr->_justifyHeight = 97;
- (*_graphicsManager->_vPort)->drawText(displayString);
+ _graphicsManager->_vPort->drawText(displayString);
flipPageAndWait();
if (firstLoop) {
@@ -347,7 +356,7 @@ bool VoyeurEngine::doLock() {
} else if (key == 11) {
// New code
if ((password.empty() && displayString.empty()) || (password != displayString)) {
- (*_graphicsManager->_vPort)->setupViewPort();
+ _graphicsManager->_vPort->setupViewPort();
password = displayString;
displayString = "";
continue;
@@ -364,7 +373,7 @@ bool VoyeurEngine::doLock() {
_soundManager->playVOCMap(wrongVoc, wrongVocSize);
}
- _graphicsManager->fillPic(*_graphicsManager->_vPort, 0);
+ _graphicsManager->fillPic(_graphicsManager->_vPort, 0);
flipPageAndWait();
_graphicsManager->resetPalette();
@@ -386,7 +395,7 @@ void VoyeurEngine::showTitleScreen() {
_graphicsManager->_backgroundPage = _bVoy->getPictureResource(0x500);
- (*_graphicsManager->_vPort)->setupViewPort();
+ _graphicsManager->_vPort->setupViewPort();
flipPageAndWait();
// Immediate palette load to show the initial screen
@@ -453,11 +462,11 @@ void VoyeurEngine::doOpening() {
_graphicsManager->setColor(i, 8, 8, 8);
_eventsManager->_intPtr._hasPalette = true;
- (*_graphicsManager->_vPort)->setupViewPort();
+ _graphicsManager->_vPort->setupViewPort();
flipPageAndWait();
RL2Decoder decoder;
- decoder.loadFile("a2300100.rl2");
+ decoder.loadRL2File("a2300100.rl2", false);
decoder.start();
while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager->_mouseClicked) {
@@ -490,7 +499,7 @@ void VoyeurEngine::doOpening() {
}
if (textPic) {
- _graphicsManager->sDrawPic(textPic, *_graphicsManager->_vPort, textPos);
+ _graphicsManager->sDrawPic(textPic, _graphicsManager->_vPort, textPos);
flipPageAndWait();
}
}
@@ -511,7 +520,7 @@ void VoyeurEngine::doOpening() {
void VoyeurEngine::playRL2Video(const Common::String &filename) {
RL2Decoder decoder;
- decoder.loadFile(filename);
+ decoder.loadRL2File(filename, false);
decoder.start();
while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager->_mouseClicked) {
@@ -585,8 +594,8 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
if (_voy->_eventFlags & EVTFLAG_8) {
assert(pic);
- byte *imgData = (*_graphicsManager->_vPort)->_currentPic->_imgData;
- (*_graphicsManager->_vPort)->_currentPic->_imgData = pic->_imgData;
+ byte *imgData = _graphicsManager->_vPort->_currentPic->_imgData;
+ _graphicsManager->_vPort->_currentPic->_imgData = pic->_imgData;
pic->_imgData = imgData;
_voy->_eventFlags &= ~EVTFLAG_8;
}
@@ -599,7 +608,7 @@ void VoyeurEngine::playAudio(int audioId) {
_graphicsManager->_backColors = _bVoy->boltEntry(0x7F01 +
BLIND_TABLE[audioId] * 2)._cMapResource;
- (*_graphicsManager->_vPort)->setupViewPort();
+ _graphicsManager->_vPort->setupViewPort();
_graphicsManager->_backColors->startFade();
flipPageAndWaitForFade();
@@ -619,7 +628,7 @@ void VoyeurEngine::playAudio(int audioId) {
_soundManager->stopVOCPlay();
_bVoy->freeBoltGroup(0x7F00);
- (*_graphicsManager->_vPort)->setupViewPort(NULL);
+ _graphicsManager->_vPort->setupViewPort(NULL);
_voy->_eventFlags &= ~EVTFLAG_RECORDING;
_voy->_playStampMode = 129;
@@ -630,13 +639,13 @@ void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::St
_graphicsManager->setColor(224, 220, 220, 220);
_eventsManager->_intPtr._hasPalette = true;
- (*_graphicsManager->_vPort)->setupViewPort(NULL);
- (*_graphicsManager->_vPort)->fillPic(0x80);
+ _graphicsManager->_vPort->setupViewPort(NULL);
+ _graphicsManager->_vPort->fillPic(0x80);
_graphicsManager->flipPage();
_eventsManager->sWaitFlip();
flipPageAndWait();
- (*_graphicsManager->_vPort)->fillPic(0x80);
+ _graphicsManager->_vPort->fillPic(0x80);
FontInfoResource &fi = *_graphicsManager->_fontPtr;
fi._curFont = _bVoy->boltEntry(257)._fontResource;
@@ -647,7 +656,7 @@ void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::St
fi._justifyWidth = 384;
fi._justifyHeight = 120;
- (*_graphicsManager->_vPort)->drawText(time);
+ _graphicsManager->_vPort->drawText(time);
if (!location.empty()) {
fi._pos = Common::Point(0, 138);
@@ -655,7 +664,7 @@ void VoyeurEngine::doTransitionCard(const Common::String &time, const Common::St
fi._justifyWidth = 384;
fi._justifyHeight = 140;
- (*_graphicsManager->_vPort)->drawText(location);
+ _graphicsManager->_vPort->drawText(location);
}
flipPageAndWait();
@@ -666,7 +675,7 @@ void VoyeurEngine::saveLastInplay() {
}
void VoyeurEngine::flipPageAndWait() {
- (*_graphicsManager->_vPort)->_flags |= DISPFLAG_8;
+ _graphicsManager->_vPort->_flags |= DISPFLAG_8;
_graphicsManager->flipPage();
_eventsManager->sWaitFlip();
}
@@ -688,7 +697,7 @@ void VoyeurEngine::showEndingNews() {
PictureResource *pic = _bVoy->boltEntry(_playStampGroupId)._picResource;
CMapResource *pal = _bVoy->boltEntry(_playStampGroupId + 1)._cMapResource;
- (*_graphicsManager->_vPort)->setupViewPort(pic);
+ _graphicsManager->_vPort->setupViewPort(pic);
pal->startFade();
flipPageAndWaitForFade();
@@ -703,7 +712,7 @@ void VoyeurEngine::showEndingNews() {
pal = _bVoy->boltEntry(_playStampGroupId + idx * 2 + 1)._cMapResource;
}
- (*_graphicsManager->_vPort)->setupViewPort(pic);
+ _graphicsManager->_vPort->setupViewPort(pic);
pal->startFade();
flipPageAndWaitForFade();
diff --git a/engines/voyeur/voyeur.h b/engines/voyeur/voyeur.h
index 19e047de05..a35473ba93 100644
--- a/engines/voyeur/voyeur.h
+++ b/engines/voyeur/voyeur.h
@@ -42,10 +42,10 @@
/**
* This is the namespace of the Voyeur engine.
*
- * Status of this engine: In Development
+ * Status of this engine: Complete
*
* Games using this engine:
- * - Voyeur
+ * - Voyeur (Dos)
*/
namespace Voyeur {
diff --git a/engines/voyeur/voyeur_game.cpp b/engines/voyeur/voyeur_game.cpp
index 453e72b315..a6564c32ba 100644
--- a/engines/voyeur/voyeur_game.cpp
+++ b/engines/voyeur/voyeur_game.cpp
@@ -232,12 +232,12 @@ void VoyeurEngine::closeStamp() {
}
void VoyeurEngine::doTailTitle() {
- (*_graphicsManager->_vPort)->setupViewPort(NULL);
+ _graphicsManager->_vPort->setupViewPort(NULL);
_graphicsManager->screenReset();
if (_bVoy->getBoltGroup(0x600)) {
RL2Decoder decoder;
- decoder.loadFile("a1100200.rl2");
+ decoder.loadRL2File("a1100200.rl2", false);
decoder.start();
decoder.play(this);
@@ -250,7 +250,7 @@ void VoyeurEngine::doTailTitle() {
PictureResource *pic = _bVoy->boltEntry(0x602)._picResource;
CMapResource *pal = _bVoy->boltEntry(0x603)._cMapResource;
- (*_graphicsManager->_vPort)->setupViewPort(pic);
+ _graphicsManager->_vPort->setupViewPort(pic);
pal->startFade();
flipPageAndWaitForFade();
_eventsManager->delayClick(300);
@@ -258,7 +258,7 @@ void VoyeurEngine::doTailTitle() {
pic = _bVoy->boltEntry(0x604)._picResource;
pal = _bVoy->boltEntry(0x605)._cMapResource;
- (*_graphicsManager->_vPort)->setupViewPort(pic);
+ _graphicsManager->_vPort->setupViewPort(pic);
pal->startFade();
flipPageAndWaitForFade();
_eventsManager->delayClick(120);
@@ -283,7 +283,7 @@ void VoyeurEngine::doClosingCredits() {
const char *msg = (const char *)_bVoy->memberAddr(0x404);
const byte *creditList = (const byte *)_bVoy->memberAddr(0x405);
- (*_graphicsManager->_vPort)->setupViewPort(NULL);
+ _graphicsManager->_vPort->setupViewPort(NULL);
_graphicsManager->setColor(1, 180, 180, 180);
_graphicsManager->setColor(2, 200, 200, 200);
_eventsManager->_intPtr._hasPalette = true;
@@ -292,7 +292,7 @@ void VoyeurEngine::doClosingCredits() {
_graphicsManager->_fontPtr->_foreColor = 2;
_graphicsManager->_fontPtr->_backColor = 2;
_graphicsManager->_fontPtr->_fontSaveBack = false;
- _graphicsManager->_fontPtr->_fontFlags = 0;
+ _graphicsManager->_fontPtr->_fontFlags = DISPFLAG_NONE;
_soundManager->startVOCPlay(152);
FontInfoResource &fi = *_graphicsManager->_fontPtr;
@@ -302,7 +302,7 @@ void VoyeurEngine::doClosingCredits() {
int flags = READ_LE_UINT16(entry + 4);
if (flags & 0x10)
- (*_graphicsManager->_vPort)->fillPic(0);
+ _graphicsManager->_vPort->fillPic(0);
if (flags & 1) {
fi._foreColor = 1;
@@ -312,7 +312,7 @@ void VoyeurEngine::doClosingCredits() {
fi._justifyHeight = 240;
fi._pos = Common::Point(0, READ_LE_UINT16(entry));
- (*_graphicsManager->_vPort)->drawText(msg);
+ _graphicsManager->_vPort->drawText(msg);
msg += strlen(msg) + 1;
}
@@ -324,7 +324,7 @@ void VoyeurEngine::doClosingCredits() {
fi._justifyHeight = 240;
fi._pos = Common::Point(0, READ_LE_UINT16(entry));
- (*_graphicsManager->_vPort)->drawText(msg);
+ _graphicsManager->_vPort->drawText(msg);
msg += strlen(msg) + 1;
}
@@ -336,7 +336,7 @@ void VoyeurEngine::doClosingCredits() {
fi._justifyHeight = 240;
fi._pos = Common::Point(38, READ_LE_UINT16(entry));
- (*_graphicsManager->_vPort)->drawText(msg);
+ _graphicsManager->_vPort->drawText(msg);
msg += strlen(msg) + 1;
fi._foreColor = 2;
@@ -345,7 +345,7 @@ void VoyeurEngine::doClosingCredits() {
fi._justifyHeight = 240;
fi._pos = Common::Point(198, READ_LE_UINT16(entry));
- (*_graphicsManager->_vPort)->drawText(msg);
+ _graphicsManager->_vPort->drawText(msg);
msg += strlen(msg) + 1;
}
@@ -357,7 +357,7 @@ void VoyeurEngine::doClosingCredits() {
fi._justifyHeight = 240;
fi._pos = Common::Point(0, READ_LE_UINT16(entry));
- (*_graphicsManager->_vPort)->drawText(msg);
+ _graphicsManager->_vPort->drawText(msg);
msg += strlen(msg) + 1;
fi._foreColor = 2;
@@ -367,7 +367,7 @@ void VoyeurEngine::doClosingCredits() {
fi._justifyHeight = 240;
fi._pos = Common::Point(0, READ_LE_UINT16(entry) + 13);
- (*_graphicsManager->_vPort)->drawText(msg);
+ _graphicsManager->_vPort->drawText(msg);
msg += strlen(msg) + 1;
}
@@ -390,15 +390,15 @@ void VoyeurEngine::doPiracy() {
_graphicsManager->setColor(1, 0, 0, 0);
_graphicsManager->setColor(2, 255, 255, 255);
_eventsManager->_intPtr._hasPalette = true;
- (*_graphicsManager->_vPort)->setupViewPort(NULL);
- (*_graphicsManager->_vPort)->fillPic(1);
+ _graphicsManager->_vPort->setupViewPort(NULL);
+ _graphicsManager->_vPort->fillPic(1);
FontInfoResource &fi = *_graphicsManager->_fontPtr;
fi._curFont = _bVoy->boltEntry(0x101)._fontResource;
fi._foreColor = 2;
fi._backColor = 2;
fi._fontSaveBack = false;
- fi._fontFlags = 0;
+ fi._fontFlags = DISPFLAG_NONE;
fi._justify = ALIGN_CENTER;
fi._justifyWidth = 384;
fi._justifyHeight = 230;
@@ -407,7 +407,7 @@ void VoyeurEngine::doPiracy() {
int yp, idx;
for (idx = 0, yp = 33; idx < 10; ++idx) {
fi._pos = Common::Point(0, yp);
- (*_graphicsManager->_vPort)->drawText(PIRACY_MESSAGE[idx]);
+ _graphicsManager->_vPort->drawText(PIRACY_MESSAGE[idx]);
yp += fi._curFont->_fontHeight + 4;
}
@@ -442,7 +442,7 @@ void VoyeurEngine::reviewTape() {
_graphicsManager->_backColors = _bVoy->boltEntry(0x902)._cMapResource;
_graphicsManager->_backgroundPage = _bVoy->boltEntry(0x901)._picResource;
- (*_graphicsManager->_vPort)->setupViewPort(_graphicsManager->_backgroundPage);
+ _graphicsManager->_vPort->setupViewPort(_graphicsManager->_backgroundPage);
_graphicsManager->_backColors->startFade();
flipPageAndWaitForFade();
@@ -460,7 +460,7 @@ void VoyeurEngine::reviewTape() {
_eventsManager->_intPtr._hasPalette = true;
_graphicsManager->_fontPtr->_curFont = _bVoy->boltEntry(0x909)._fontResource;
_graphicsManager->_fontPtr->_fontSaveBack = false;
- _graphicsManager->_fontPtr->_fontFlags = 0;
+ _graphicsManager->_fontPtr->_fontFlags = DISPFLAG_NONE;
_eventsManager->getMouseInfo();
if (newX == -1) {
@@ -489,7 +489,7 @@ void VoyeurEngine::reviewTape() {
int yp = 45;
int eventNum = eventStart;
for (int lineNum = 0; lineNum < 8 && eventNum < _voy->_eventCount; ++lineNum, ++eventNum) {
- _graphicsManager->_fontPtr->_picFlags = 0;
+ _graphicsManager->_fontPtr->_picFlags = DISPFLAG_NONE;
_graphicsManager->_fontPtr->_picSelect = 0xff;
_graphicsManager->_fontPtr->_picPick = 7;
_graphicsManager->_fontPtr->_picOnOff = (lineNum == eventLine) ? 8 : 0;
@@ -504,15 +504,15 @@ void VoyeurEngine::reviewTape() {
yp += 15;
}
- (*_graphicsManager->_vPort)->addSaveRect(
- (*_graphicsManager->_vPort)->_lastPage, tempRect);
+ _graphicsManager->_vPort->addSaveRect(
+ _graphicsManager->_vPort->_lastPage, tempRect);
flipPageAndWait();
- (*_graphicsManager->_vPort)->addSaveRect(
- (*_graphicsManager->_vPort)->_lastPage, tempRect);
+ _graphicsManager->_vPort->addSaveRect(
+ _graphicsManager->_vPort->_lastPage, tempRect);
}
- _graphicsManager->sDrawPic(cursor, *_graphicsManager->_vPort,
+ _graphicsManager->sDrawPic(cursor, _graphicsManager->_vPort,
_eventsManager->getMousePos());
flipPageAndWait();
@@ -551,7 +551,7 @@ void VoyeurEngine::reviewTape() {
int yp = 45;
int eventNum = eventStart;
for (int idx = 0; idx < 8 && eventNum < _voy->_eventCount; ++idx, ++eventNum) {
- _graphicsManager->_fontPtr->_picFlags = 0;
+ _graphicsManager->_fontPtr->_picFlags = DISPFLAG_NONE;
_graphicsManager->_fontPtr->_picSelect = 0xff;
_graphicsManager->_fontPtr->_picPick = 7;
_graphicsManager->_fontPtr->_picOnOff = (idx == eventLine) ? 8 : 0;
@@ -566,12 +566,12 @@ void VoyeurEngine::reviewTape() {
yp += 15;
}
- (*_graphicsManager->_vPort)->addSaveRect(
- (*_graphicsManager->_vPort)->_lastPage, tempRect);
+ _graphicsManager->_vPort->addSaveRect(
+ _graphicsManager->_vPort->_lastPage, tempRect);
flipPageAndWait();
- (*_graphicsManager->_vPort)->addSaveRect(
- (*_graphicsManager->_vPort)->_lastPage, tempRect);
+ _graphicsManager->_vPort->addSaveRect(
+ _graphicsManager->_vPort->_lastPage, tempRect);
flipPageAndWait();
_eventsManager->getMouseInfo();
@@ -651,7 +651,7 @@ void VoyeurEngine::reviewTape() {
newY = _eventsManager->getMousePos().y;
_voy->_fadingType = 0;
_voy->_viewBounds = nullptr;
- (*_graphicsManager->_vPort)->setupViewPort(NULL);
+ _graphicsManager->_vPort->setupViewPort(NULL);
if (_currentVocId != -1) {
_voy->_vocSecondsOffset = _voy->_RTVNum - _voy->_musicStartTime;
@@ -679,7 +679,7 @@ void VoyeurEngine::reviewTape() {
_graphicsManager->_backColors = _bVoy->boltEntry(0x7F01 +
BLIND_TABLE[_audioVideoId])._cMapResource;
- (*_graphicsManager->_vPort)->setupViewPort(_graphicsManager->_backgroundPage);
+ _graphicsManager->_vPort->setupViewPort(_graphicsManager->_backgroundPage);
_graphicsManager->_backColors->startFade();
flipPageAndWaitForFade();
@@ -728,7 +728,7 @@ void VoyeurEngine::reviewTape() {
_graphicsManager->_fontPtr->_curFont = _bVoy->boltEntry(0x101)._fontResource;
- (*_graphicsManager->_vPort)->fillPic(0);
+ _graphicsManager->_vPort->fillPic(0);
flipPageAndWait();
_bVoy->freeBoltGroup(0x900);
}
@@ -742,7 +742,7 @@ void VoyeurEngine::doGossip() {
// Load the gossip animation
RL2Decoder decoder;
- decoder.loadFile("a2050100.rl2", false);
+ decoder.loadRL2File("a2050100.rl2", false);
decoder.start();
// Get the resource data for the first gossip video
@@ -751,7 +751,7 @@ void VoyeurEngine::doGossip() {
pal->startFade();
// Transfer initial background to video decoder
- PictureResource videoFrame(decoder.getVideoTrack()->getBackSurface());
+ PictureResource videoFrame(decoder.getRL2VideoTrack()->getBackSurface());
bgPic->_bounds.moveTo(0, 0);
_graphicsManager->sDrawPic(bgPic, &videoFrame, Common::Point(0, 0));
@@ -768,7 +768,7 @@ void VoyeurEngine::doGossip() {
// Play interview video
RL2Decoder decoder2;
- decoder2.loadFile("a2110100.rl2", true);
+ decoder2.loadRL2File("a2110100.rl2", true);
decoder2.start();
_eventsManager->getMouseInfo();
@@ -789,8 +789,8 @@ void VoyeurEngine::doTapePlaying() {
PictureResource *pic = _bVoy->boltEntry(0xA02)._picResource;
VInitCycleResource *cycle = _bVoy->boltEntry(0xA05)._vInitCycleResource;
- (*_graphicsManager->_vPort)->setupViewPort(_graphicsManager->_backgroundPage);
- _graphicsManager->sDrawPic(pic, *_graphicsManager->_vPort, Common::Point(57, 30));
+ _graphicsManager->_vPort->setupViewPort(_graphicsManager->_backgroundPage);
+ _graphicsManager->sDrawPic(pic, _graphicsManager->_vPort, Common::Point(57, 30));
_graphicsManager->_backColors->startFade();
flipPageAndWaitForFade();
@@ -933,7 +933,7 @@ int VoyeurEngine::getChooseButton() {
+ 6)._rectResource->_entries;
int selectedIndex = -1;
- (*_graphicsManager->_vPort)->setupViewPort(_graphicsManager->_backgroundPage);
+ _graphicsManager->_vPort->setupViewPort(_graphicsManager->_backgroundPage);
_graphicsManager->_backColors->_steps = 0;
_graphicsManager->_backColors->startFade();
flipPageAndWait();
@@ -956,7 +956,7 @@ int VoyeurEngine::getChooseButton() {
selectedIndex = idx;
if (selectedIndex != prevIndex) {
PictureResource *btnPic = _bVoy->boltEntry(_playStampGroupId + 8 + idx)._picResource;
- _graphicsManager->sDrawPic(btnPic, *_graphicsManager->_vPort,
+ _graphicsManager->sDrawPic(btnPic, _graphicsManager->_vPort,
Common::Point(106, 200));
cursorPic = _bVoy->boltEntry(_playStampGroupId + 4)._picResource;
@@ -968,11 +968,11 @@ int VoyeurEngine::getChooseButton() {
if (selectedIndex == -1) {
cursorPic = _bVoy->boltEntry(_playStampGroupId + 2)._picResource;
PictureResource *btnPic = _bVoy->boltEntry(_playStampGroupId + 12)._picResource;
- _graphicsManager->sDrawPic(btnPic, *_graphicsManager->_vPort,
+ _graphicsManager->sDrawPic(btnPic, _graphicsManager->_vPort,
Common::Point(106, 200));
}
- _graphicsManager->sDrawPic(cursorPic, *_graphicsManager->_vPort,
+ _graphicsManager->sDrawPic(cursorPic, _graphicsManager->_vPort,
Common::Point(pt.x + 13, pt.y - 12));
flipPageAndWait();
@@ -985,7 +985,7 @@ int VoyeurEngine::getChooseButton() {
void VoyeurEngine::makeViewFinder() {
_graphicsManager->_backgroundPage = _bVoy->boltEntry(0x103)._picResource;
_graphicsManager->sDrawPic(_graphicsManager->_backgroundPage,
- *_graphicsManager->_vPort, Common::Point(0, 0));
+ _graphicsManager->_vPort, Common::Point(0, 0));
CMapResource *pal = _bVoy->boltEntry(0x104)._cMapResource;
int palOffset = 0;
@@ -1017,7 +1017,7 @@ void VoyeurEngine::makeViewFinder() {
break;
}
- (*_graphicsManager->_vPort)->drawIfaceTime();
+ _graphicsManager->_vPort->drawIfaceTime();
doTimeBar();
pal->startFade();
@@ -1080,7 +1080,7 @@ void VoyeurEngine::initIFace() {
void VoyeurEngine::doScroll(const Common::Point &pt) {
Common::Rect clipRect(72, 47, 72 + 240, 47 + 148);
- (*_graphicsManager->_vPort)->setupViewPort(NULL, &clipRect);
+ _graphicsManager->_vPort->setupViewPort(NULL, &clipRect);
int base = 0;
switch (_voy->_transitionId) {
@@ -1104,18 +1104,18 @@ void VoyeurEngine::doScroll(const Common::Point &pt) {
if (base) {
PictureResource *pic = _bVoy->boltEntry(base + 3)._picResource;
- _graphicsManager->sDrawPic(pic, *_graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y - 104));
+ _graphicsManager->sDrawPic(pic, _graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y - 104));
pic = _bVoy->boltEntry(base + 4)._picResource;
- _graphicsManager->sDrawPic(pic, *_graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y - 44));
+ _graphicsManager->sDrawPic(pic, _graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y - 44));
pic = _bVoy->boltEntry(base + 5)._picResource;
- _graphicsManager->sDrawPic(pic, *_graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 16));
+ _graphicsManager->sDrawPic(pic, _graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 16));
pic = _bVoy->boltEntry(base + 6)._picResource;
- _graphicsManager->sDrawPic(pic, *_graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 76));
+ _graphicsManager->sDrawPic(pic, _graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 76));
pic = _bVoy->boltEntry(base + 7)._picResource;
- _graphicsManager->sDrawPic(pic, *_graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 136));
+ _graphicsManager->sDrawPic(pic, _graphicsManager->_vPort, Common::Point(784 - pt.x - 712, 150 - pt.y + 136));
}
- (*_graphicsManager->_vPort)->setupViewPort(NULL);
+ _graphicsManager->_vPort->setupViewPort(NULL);
}
void VoyeurEngine::checkTransition() {
@@ -1171,7 +1171,7 @@ int VoyeurEngine::doComputerText(int maxLen) {
font._curFont = _bVoy->boltEntry(0x4910)._fontResource;
font._foreColor = 129;
font._fontSaveBack = false;
- font._fontFlags = 0;
+ font._fontFlags = DISPFLAG_NONE;
if (_voy->_vocSecondsOffset > 60)
_voy->_vocSecondsOffset = 0;
@@ -1182,7 +1182,7 @@ int VoyeurEngine::doComputerText(int maxLen) {
font._justifyWidth = 384;
font._justifyHeight = 100;
font._pos = Common::Point(128, 100);
- (*_graphicsManager->_vPort)->drawText(END_OF_MESSAGE);
+ _graphicsManager->_vPort->drawText(END_OF_MESSAGE);
} else if (_voy->_RTVNum < _voy->_computerTimeMin && maxLen == 9999) {
if (_currentVocId != -1)
_soundManager->startVOCPlay(_currentVocId);
@@ -1190,7 +1190,7 @@ int VoyeurEngine::doComputerText(int maxLen) {
font._justifyWidth = 384;
font._justifyHeight = 100;
font._pos = Common::Point(120, 100);
- (*_graphicsManager->_vPort)->drawText(START_OF_MESSAGE);
+ _graphicsManager->_vPort->drawText(START_OF_MESSAGE);
} else {
char *msg = (char *)_bVoy->memberAddr(0x4900 + _voy->_computerTextId);
font._pos = Common::Point(96, 60);
@@ -1210,12 +1210,12 @@ int VoyeurEngine::doComputerText(int maxLen) {
_eventsManager->delay(90);
_graphicsManager->_drawPtr->_pos = Common::Point(96, 54);
_graphicsManager->_drawPtr->_penColor = 254;
- (*_graphicsManager->_vPort)->sFillBox(196, 124);
+ _graphicsManager->_vPort->sFillBox(196, 124);
_graphicsManager->_fontPtr->_justify = ALIGN_LEFT;
_graphicsManager->_fontPtr->_justifyWidth = 384;
_graphicsManager->_fontPtr->_justifyHeight = 100;
_graphicsManager->_fontPtr->_pos = Common::Point(128, 100);
- (*_graphicsManager->_vPort)->drawText(END_OF_MESSAGE);
+ _graphicsManager->_vPort->drawText(END_OF_MESSAGE);
}
break;
}
@@ -1227,7 +1227,7 @@ int VoyeurEngine::doComputerText(int maxLen) {
_eventsManager->delay(90);
_graphicsManager->_drawPtr->_pos = Common::Point(96, 54);
_graphicsManager->_drawPtr->_penColor = 255;
- (*_graphicsManager->_vPort)->sFillBox(196, 124);
+ _graphicsManager->_vPort->sFillBox(196, 124);
yp = 60;
}
@@ -1238,7 +1238,7 @@ int VoyeurEngine::doComputerText(int maxLen) {
_graphicsManager->_fontPtr->_justify = ALIGN_LEFT;
_graphicsManager->_fontPtr->_justifyWidth = 0;
_graphicsManager->_fontPtr->_justifyHeight = 0;
- (*_graphicsManager->_vPort)->drawText(Common::String(c));
+ _graphicsManager->_vPort->drawText(Common::String(c));
_eventsManager->delay(4);
}
@@ -1265,7 +1265,7 @@ void VoyeurEngine::getComputerBrush() {
int xp = (384 - pic->_bounds.width()) / 2;
int yp = (240 - pic->_bounds.height()) / 2 - 4;
- (*_graphicsManager->_vPort)->drawPicPerm(pic, Common::Point(xp, yp));
+ _graphicsManager->_vPort->drawPicPerm(pic, Common::Point(xp, yp));
CMapResource *pal = _bVoy->boltEntry(0x490F)._cMapResource;
pal->startFade();
@@ -1285,14 +1285,14 @@ void VoyeurEngine::doTimeBar() {
_graphicsManager->_drawPtr->_penColor = 134;
_graphicsManager->_drawPtr->_pos = Common::Point(39, 92);
- (*_graphicsManager->_vPort)->sFillBox(6, fullHeight - 92);
+ _graphicsManager->_vPort->sFillBox(6, fullHeight - 92);
if (height > 0) {
_graphicsManager->setColor(215, 238, 238, 238);
_eventsManager->_intPtr._hasPalette = true;
_graphicsManager->_drawPtr->_penColor = 215;
_graphicsManager->_drawPtr->_pos = Common::Point(39, fullHeight);
- (*_graphicsManager->_vPort)->sFillBox(6, height);
+ _graphicsManager->_vPort->sFillBox(6, height);
}
}
}
@@ -1345,7 +1345,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
_bVoy->getBoltGroup(_voy->_boltGroupId2);
PictureResource *pic = _bVoy->boltEntry(_voy->_boltGroupId2 + evidId * 2)._picResource;
- _graphicsManager->sDrawPic(pic, *_graphicsManager->_vPort, Common::Point(
+ _graphicsManager->sDrawPic(pic, _graphicsManager->_vPort, Common::Point(
(384 - pic->_bounds.width()) / 2, (240 - pic->_bounds.height()) / 2));
_bVoy->freeBoltMember(_voy->_boltGroupId2 + evidId * 2);
@@ -1396,7 +1396,7 @@ void VoyeurEngine::doEvidDisplay(int evidId, int eventId) {
continue;
pic = _voy->_evPicPtrs[arrIndex];
- _graphicsManager->sDrawPic(pic, *_graphicsManager->_vPort,
+ _graphicsManager->sDrawPic(pic, _graphicsManager->_vPort,
Common::Point((384 - pic->_bounds.width()) / 2,
(240 - pic->_bounds.height()) / 2));
_voy->_evCmPtrs[arrIndex]->startFade();
diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp
index c5a1e91ef5..df9a8648db 100644
--- a/engines/wintermute/base/font/base_font_truetype.cpp
+++ b/engines/wintermute/base/font/base_font_truetype.cpp
@@ -625,6 +625,8 @@ bool BaseFontTT::initFont() {
warning("Looking for %s", fontName.c_str());
_font = FontMan.getFontByName(fontName);
}
+#else
+ warning("BaseFontTT::InitFont - FreeType2-support not compiled in, TTF-fonts will not be loaded");
#endif // USE_FREETYPE2
// Fallback4: Just use the Big GUI-font. (REALLY undesireable)
diff --git a/engines/wintermute/detection.cpp b/engines/wintermute/detection.cpp
index 48c75f634d..a659c434d0 100644
--- a/engines/wintermute/detection.cpp
+++ b/engines/wintermute/detection.cpp
@@ -107,11 +107,11 @@ public:
}
}
// Prefix to avoid collisions with actually known games
- name = "wmefan-" + name;
+ name = "wmeunk-" + name;
Common::strlcpy(s_fallbackGameIdBuf, name.c_str(), sizeof(s_fallbackGameIdBuf) - 1);
s_fallbackDesc.gameid = s_fallbackGameIdBuf;
if (caption != name) {
- caption += " (fangame) ";
+ caption += " (unknown version) ";
char *offset = s_fallbackGameIdBuf + name.size() + 1;
uint32 remainingLength = (sizeof(s_fallbackGameIdBuf) - 1) - (name.size() + 1);
Common::strlcpy(offset, caption.c_str(), remainingLength);
diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h
index e0ceb43c1f..6556d3b34a 100644
--- a/engines/wintermute/detection_tables.h
+++ b/engines/wintermute/detection_tables.h
@@ -38,6 +38,7 @@ static const PlainGameDescriptor wintermuteGames[] = {
{"carolreed8", "Carol Reed 8 - Amber's Blood"},
{"carolreed9", "Carol Reed 9 - Cold Case Summer"},
{"chivalry", "Chivalry is Not Dead"},
+ {"corrosion", "Corrosion: Cold Winter Waiting"},
{"deadcity", "Dead City"},
{"dreaming", "Des Reves Elastiques Avec Mille Insectes Nommes Georges"},
{"dirtysplit", "Dirty Split"},
@@ -58,6 +59,8 @@ static const PlainGameDescriptor wintermuteGames[] = {
{"projectdoom", "Project: Doom"},
{"reversion1", "Reversion: The Escape"},
{"reversion2", "Reversion: The Meeting"},
+ {"rhiannon", "Rhiannon: Curse of the four Branches"},
+ {"ritter", "1 1/2 Ritter: Auf der Suche nach der hinreissenden Herzelinde"},
{"rosemary", "Rosemary"},
{"securanote", "Securanote"},
{"shaban", "Shaban"},
@@ -70,6 +73,7 @@ static const PlainGameDescriptor wintermuteGames[] = {
{"twc", "the white chamber"},
{"wintermute", "Wintermute engine game"},
{"wtetris", "Wilma Tetris"},
+ {"zilm", "Zilm: A Game of Reflex"},
{0, 0}
};
@@ -124,6 +128,16 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE,
GUIO0()
},
+ // Bickadoodle (download from http://aethericgames.com/games/bickadoodle/download-bickadoodle/)
+ {
+ "bickadoodle",
+ "",
+ AD_ENTRY1s("data.dcp", "1584d83577c32add0fce27fae91141a2", 35337728),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
// Book of Gron Part One
{
"bookofgron",
@@ -237,6 +251,16 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_TESTING,
GUIO0()
},
+ // Corrosion: Cold Winter Waiting
+ {
+ "corrosion",
+ "",
+ AD_ENTRY1s("data.dcp", "ae885b1a8faa0b27f43c0e8f0df02fc9", 525931618),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_TESTING,
+ GUIO0()
+ },
// Dead City (Czech)
{
"deadcity",
@@ -428,7 +452,21 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE,
GUIO0()
},
- // Ghosts in the Sheet
+ // Ghost in the Sheet
+ {
+ "ghostsheet",
+ "",
+ {
+ {"english.dcp", 0, "e6d0aad2c89996bcabe416105a3d6d3a", 12221017},
+ {"data.dcp", 0, "b2f8b05328e4881e15e98e845b63f451", 168003},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Ghost in the Sheet (Demo)
{
"ghostsheet",
"Demo",
@@ -530,6 +568,16 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE,
GUIO0()
},
+ // J.U.L.I.A. (English, Bundle in a box-version)
+ {
+ "julia",
+ "Version 1.2",
+ AD_ENTRY1s("data.dcp", "fe90023ccc22f35185b40b910e0d03a2", 10101373),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
// J.U.L.I.A. (English) (Demo)
{
"julia",
@@ -996,6 +1044,56 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE,
GUIO0()
},
+ // Reversion: The Meeting Version 2.0.2412 (Chinese)
+ {
+ "reversion2",
+ "Version 2.0.2412",
+ {
+ {"data.dcp", 0, "f4ffc4df24b7bebad56a24930f33a2bc", 255766600},
+ {"xlanguage_nz.dcp", 0, "17c79af4928e24484bee77a7e807cc2a", 10737127},
+ {"Linux.dcp", 0, "21858bd77dc86b03f701fd47900e2f51", 984535},
+ AD_LISTEND
+ },
+ Common::ZH_CNA,
+ Common::kPlatformLinux,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Reversion: The Meeting Version 2.0.2412 (English)
+ {
+ "reversion2",
+ "Version 2.0.2412",
+ {
+ {"data.dcp", 0, "f4ffc4df24b7bebad56a24930f33a2bc", 255766600},
+ {"xlanguage_en.dcp", 0, "0598bf752ce93b42bcaf1094df537c7b", 8533057},
+ {"Linux.dcp", 0, "21858bd77dc86b03f701fd47900e2f51", 984535},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformLinux,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // Rhiannon: Curse of the four Branches
+ {
+ "rhiannon",
+ "",
+ AD_ENTRY1s("data.dcp", "870f348900b735f1cc79c0608ce32b0e", 1046169851),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
+ // 1 1/2 Ritter: Auf der Suche nach der hinreissenden Herzelinde
+ {
+ "ritter",
+ "",
+ AD_ENTRY1s("data.dcp", "5ac416cee605d3a30f4d59687b1cdab2", 364260278),
+ Common::DE_DEU,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
// Rosemary
{
"rosemary",
@@ -1108,6 +1206,16 @@ static const ADGameDescription gameDescriptions[] = {
ADGF_UNSTABLE,
GUIO0()
},
+ // Zilm: A Game of Reflex 1.0
+ {
+ "Zilm",
+ "1.0",
+ AD_ENTRY1s("data.dcp", "098dffaf03d8adbb4cb5633e4733e63c", 351726),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO0()
+ },
AD_TABLE_END_MARKER
};
diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp
index e8628ef6a6..5fe0d13766 100644
--- a/engines/wintermute/graphics/transparent_surface.cpp
+++ b/engines/wintermute/graphics/transparent_surface.cpp
@@ -84,20 +84,23 @@ void BlenderAdditive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *o
if (ina == 0) {
return;
} else {
- if (*cb != 255)
+ if (*cb != 255) {
*outb = MIN(*outb + ((inb * (*cb) * ina) >> 16), 255);
- else
+ } else {
*outb = MIN(*outb + (inb * ina >> 8), 255);
+ }
- if (*cg != 255)
+ if (*cg != 255) {
*outg = MIN(*outg + ((ing * (*cg) * ina) >> 16), 255);
- else
+ } else {
*outg = MIN(*outg + (ing * ina >> 8), 255);
+ }
- if (*cr != 255)
+ if (*cr != 255) {
*outr = MIN(*outr + ((inr * (*cr) * ina) >> 16), 255);
- else
+ } else {
*outr = MIN(*outr + (inr * ina >> 8), 255);
+ }
}
}
@@ -120,20 +123,23 @@ void BlenderSubtractive::blendPixel(byte ina, byte inr, byte ing, byte inb, byte
if (ina == 0) {
return;
} else {
- if (*cb != 255)
+ if (*cb != 255) {
*outb = MAX(*outb - ((inb * (*cb) * (*outb) * ina) >> 24), 0);
- else
+ } else {
*outb = MAX(*outb - (inb * (*outb) * ina >> 16), 0);
+ }
- if (*cg != 255)
+ if (*cg != 255) {
*outg = MAX(*outg - ((ing * (*cg) * (*outg) * ina) >> 24), 0);
- else
+ } else {
*outg = MAX(*outg - (ing * (*outg) * ina >> 16), 0);
+ }
- if (*cr != 255)
- *outr = MAX(*outr - ((inr * (*cr) * (*outr) * ina) >> 24), 0);
- else
+ if (*cr != 255) {
+ *outr = MAX(*outr - ((inr * (*cr) * (*outr) * ina) >> 24), 0);
+ } else {
*outr = MAX(*outr - (inr * (*outr) * ina >> 16), 0);
+ }
}
}
@@ -152,20 +158,23 @@ void BlenderNormal::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *out
if (ina == 0) {
return;
} else if (ina == 255) {
- if (*cb != 255)
+ if (*cb != 255) {
*outb = (inb * (*cb)) >> 8;
- else
+ } else {
*outb = inb;
+ }
- if (*cr != 255)
+ if (*cr != 255) {
*outr = (inr * (*cr)) >> 8;
- else
+ } else {
*outr = inr;
+ }
- if (*cg != 255)
+ if (*cg != 255) {
*outg = (ing * (*cg)) >> 8;
- else
+ } else {
*outg = ing;
+ }
*outa = ina;
@@ -178,26 +187,29 @@ void BlenderNormal::blendPixel(byte ina, byte inr, byte ing, byte inb, byte *out
*outr = (*outr * (255 - ina) >> 8);
*outg = (*outg * (255 - ina) >> 8);
- if (*cb == 0)
+ if (*cb == 0) {
*outb = *outb;
- else if (*cb != 255)
+ } else if (*cb != 255) {
*outb = *outb + (inb * ina * (*cb) >> 16);
- else
+ } else {
*outb = *outb + (inb * ina >> 8);
+ }
- if (*cr == 0)
+ if (*cr == 0) {
*outr = *outr;
- else if (*cr != 255)
+ } else if (*cr != 255) {
*outr = *outr + (inr * ina * (*cr) >> 16);
- else
+ } else {
*outr = *outr + (inr * ina >> 8);
+ }
- if (*cg == 0)
+ if (*cg == 0) {
*outg = *outg;
- else if (*cg != 255)
+ } else if (*cg != 255) {
*outg = *outg + (ing * ina * (*cg) >> 16);
- else
+ } else {
*outg = *outg + (ing * ina >> 8);
+ }
return;
}
@@ -375,10 +387,10 @@ void doBlit(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, in
byte *outb = &out[TransparentSurface::kBIndex];
b.blendPixel(in[TransparentSurface::kAIndex],
- in[TransparentSurface::kRIndex],
- in[TransparentSurface::kGIndex],
- in[TransparentSurface::kBIndex],
- outa, outr, outg, outb);
+ in[TransparentSurface::kRIndex],
+ in[TransparentSurface::kGIndex],
+ in[TransparentSurface::kBIndex],
+ outa, outr, outg, outb);
in += inStep;
out += 4;
@@ -404,10 +416,10 @@ void doBlit(byte *ino, byte *outo, uint32 width, uint32 height, uint32 pitch, in
byte *outb = &out[TransparentSurface::kBIndex];
b.blendPixel(in[TransparentSurface::kAIndex],
- in[TransparentSurface::kRIndex],
- in[TransparentSurface::kGIndex],
- in[TransparentSurface::kBIndex],
- outa, outr, outg, outb, &ca, &cr, &cg, &cb);
+ in[TransparentSurface::kRIndex],
+ in[TransparentSurface::kGIndex],
+ in[TransparentSurface::kBIndex],
+ outa, outr, outg, outb, &ca, &cr, &cg, &cb);
in += inStep;
out += 4;
}
@@ -427,8 +439,9 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p
// Check if we need to draw anything at all
int ca = (color >> 24) & 0xff;
- if (ca == 0)
+ if (ca == 0) {
return retSize;
+ }
// Create an encapsulating surface for the data
TransparentSurface srcImage(*this, false);
@@ -456,17 +469,19 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p
srcImage.h = pPartRect->height();
debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %08x, %d, %d)", posX, posY, flipping,
- pPartRect->left, pPartRect->top, pPartRect->width(), pPartRect->height(), color, width, height);
+ pPartRect->left, pPartRect->top, pPartRect->width(), pPartRect->height(), color, width, height);
} else {
debug(6, "Blit(%d, %d, %d, [%d, %d, %d, %d], %08x, %d, %d)", posX, posY, flipping, 0, 0,
- srcImage.w, srcImage.h, color, width, height);
+ srcImage.w, srcImage.h, color, width, height);
}
- if (width == -1)
+ if (width == -1) {
width = srcImage.w;
- if (height == -1)
+ }
+ if (height == -1) {
height = srcImage.h;
+ }
#ifdef SCALING_TESTING
// Hardcode scaling to 66% to test scaling
@@ -516,7 +531,7 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p
yp = img->h - 1;
}
- byte *ino= (byte *)img->getBasePtr(xp, yp);
+ byte *ino = (byte *)img->getBasePtr(xp, yp);
byte *outo = (byte *)target.getBasePtr(posX, posY);
if (color == 0xFFFFFFFF && blendMode == BLEND_NORMAL && _alphaMode == ALPHA_OPAQUE) {
@@ -649,8 +664,9 @@ TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transfo
target->create((uint16)dstW, (uint16)dstH, this->format);
- if (transform._zoom.x == 0 || transform._zoom.y == 0)
+ if (transform._zoom.x == 0 || transform._zoom.y == 0) {
return target;
+ }
uint32 invAngle = 360 - (transform._angle % 360);
float invCos = cos(invAngle * M_PI / 180.0);
@@ -684,8 +700,12 @@ TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transfo
for (int x = 0; x < dstW; x++) {
int dx = (sdx >> 16);
int dy = (sdy >> 16);
- if (flipx) dx = sw - dx;
- if (flipy) dy = sh - dy;
+ if (flipx) {
+ dx = sw - dx;
+ }
+ if (flipy) {
+ dy = sh - dy;
+ }
#ifdef ENABLE_BILINEAR
if ((dx > -1) && (dy > -1) && (dx < sw) && (dy < sh)) {
@@ -694,7 +714,7 @@ TransparentSurface *TransparentSurface::rotoscale(const TransformStruct &transfo
c00 = *sp;
sp += 1;
c01 = *sp;
- sp += (this->pitch/4);
+ sp += (this->pitch / 4);
c11 = *sp;
sp -= 1;
c10 = *sp;
@@ -764,8 +784,8 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight)
bool flipx = false, flipy = false; // TODO: See mirroring comment in RenderTicket ctor
- int *sax = new int[dstW+1];
- int *say = new int[dstH+1];
+ int *sax = new int[dstW + 1];
+ int *say = new int[dstH + 1];
assert(sax && say);
/*
@@ -808,14 +828,16 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight)
}
}
- const tColorRGBA *sp = (const tColorRGBA *) getBasePtr(0,0);
- tColorRGBA *dp = (tColorRGBA *) target->getBasePtr(0,0);
+ const tColorRGBA *sp = (const tColorRGBA *) getBasePtr(0, 0);
+ tColorRGBA *dp = (tColorRGBA *) target->getBasePtr(0, 0);
int spixelgap = srcW;
- if (flipx)
+ if (flipx) {
sp += spixelw;
- if (flipy)
+ }
+ if (flipy) {
sp += spixelgap * spixelh;
+ }
csay = say;
for (int y = 0; y < dstH; y++) {
@@ -835,10 +857,11 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight)
c01 = sp;
c10 = sp;
if (cy < spixelh) {
- if (flipy)
+ if (flipy) {
c10 -= spixelgap;
- else
+ } else {
c10 += spixelgap;
+ }
}
c11 = c10;
if (cx < spixelw) {
@@ -874,10 +897,11 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight)
int *salastx = csax;
csax++;
int sstepx = (*csax >> 16) - (*salastx >> 16);
- if (flipx)
+ if (flipx) {
sp -= sstepx;
- else
+ } else {
sp += sstepx;
+ }
/*
* Advance destination pointer x
@@ -891,10 +915,11 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight)
csay++;
int sstepy = (*csay >> 16) - (*salasty >> 16);
sstepy *= spixelgap;
- if (flipy)
+ if (flipy) {
sp = csp - sstepy;
- else
+ } else {
sp = csp + sstepy;
+ }
}
delete[] sax;
@@ -903,14 +928,16 @@ TransparentSurface *TransparentSurface::scale(uint16 newWidth, uint16 newHeight)
#else
int *scaleCacheX = new int[dstW];
- for (int x = 0; x < dstW; x++)
+ for (int x = 0; x < dstW; x++) {
scaleCacheX[x] = (x * srcW) / dstW;
+ }
for (int y = 0; y < dstH; y++) {
uint32 *destP = (uint32 *)target->getBasePtr(0, y);
const uint32 *srcP = (const uint32 *)getBasePtr(0, (y * srcH) / dstH);
- for (int x = 0; x < dstW; x++)
+ for (int x = 0; x < dstW; x++) {
*destP++ = srcP[scaleCacheX[x]];
+ }
}
delete[] scaleCacheX;
diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h
index 7f6b1ac865..4ad9bf07eb 100644
--- a/engines/wintermute/graphics/transparent_surface.h
+++ b/engines/wintermute/graphics/transparent_surface.h
@@ -74,17 +74,17 @@ struct TransparentSurface : public Graphics::Surface {
ALPHA_FULL = 2
};
- #ifdef SCUMM_LITTLE_ENDIAN
+#ifdef SCUMM_LITTLE_ENDIAN
static const int kAIndex = 0;
static const int kBIndex = 1;
static const int kGIndex = 2;
static const int kRIndex = 3;
- #else
+#else
static const int kAIndex = 3;
static const int kBIndex = 2;
static const int kGIndex = 1;
static const int kRIndex = 0;
- #endif
+#endif
static const int kBShift = 8;//img->format.bShift;
static const int kGShift = 16;//img->format.gShift;
diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp
index b0c469c440..e1553580ec 100644
--- a/engines/wintermute/video/video_theora_player.cpp
+++ b/engines/wintermute/video/video_theora_player.cpp
@@ -127,6 +127,7 @@ bool VideoTheoraPlayer::initialize(const Common::String &filename, const Common:
#if defined (USE_THEORADEC)
_theoraDecoder = new Video::TheoraDecoder();
#else
+ warning("VideoTheoraPlayer::initialize - Theora support not compiled in, video will be skipped: %s", filename.c_str());
return STATUS_FAILED;
#endif
_theoraDecoder->loadStream(_file);
diff --git a/engines/zvision/fonts/truetype_font.cpp b/engines/zvision/fonts/truetype_font.cpp
index 03520f18b6..ba4d72bde8 100644
--- a/engines/zvision/fonts/truetype_font.cpp
+++ b/engines/zvision/fonts/truetype_font.cpp
@@ -39,12 +39,9 @@
namespace ZVision {
TruetypeFont::TruetypeFont(ZVision *engine, int32 fontHeight)
- : _engine(engine),
- _fontHeight(fontHeight),
+ : _fontHeight(fontHeight),
_font(0),
- _lineHeight(0),
- _maxCharWidth(0),
- _maxCharHeight(0) {
+ _lineHeight(0) {
}
TruetypeFont::~TruetypeFont(void) {
diff --git a/engines/zvision/fonts/truetype_font.h b/engines/zvision/fonts/truetype_font.h
index 3b5805db14..64f53a2c3b 100644
--- a/engines/zvision/fonts/truetype_font.h
+++ b/engines/zvision/fonts/truetype_font.h
@@ -43,12 +43,12 @@ public:
~TruetypeFont();
private:
- ZVision *_engine;
+// ZVision *_engine;
Graphics::Font *_font;
int _lineHeight;
- size_t _maxCharWidth;
- size_t _maxCharHeight;
+// size_t _maxCharWidth;
+// size_t _maxCharHeight;
public:
int32 _fontHeight;