aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/agi.cpp51
-rw-r--r--engines/agi/agi.h16
-rw-r--r--engines/agi/cycle.cpp1
-rw-r--r--engines/agi/detection.cpp9
-rw-r--r--engines/agi/detection_tables.h40
-rw-r--r--engines/agi/graphics.cpp1
-rw-r--r--engines/agi/keyboard.cpp17
-rw-r--r--engines/agi/objects.cpp11
-rw-r--r--engines/agi/op_cmd.cpp75
-rw-r--r--engines/agi/opcodes.cpp16
-rw-r--r--engines/agi/preagi.cpp18
-rw-r--r--engines/agi/preagi.h4
-rw-r--r--engines/agi/preagi_mickey.cpp6
-rw-r--r--engines/agi/preagi_troll.cpp1
-rw-r--r--engines/agi/preagi_winnie.cpp6
-rw-r--r--engines/agi/saveload.cpp65
-rw-r--r--engines/agi/sprite.cpp15
-rw-r--r--engines/agi/text.cpp49
-rw-r--r--engines/agos/agos.cpp61
-rw-r--r--engines/agos/agos.h32
-rw-r--r--engines/agos/animation.cpp12
-rw-r--r--engines/agos/animation.h2
-rw-r--r--engines/agos/debug.cpp26
-rw-r--r--engines/agos/detection.cpp31
-rw-r--r--engines/agos/detection_tables.h126
-rw-r--r--engines/agos/feeble.cpp4
-rw-r--r--engines/agos/installshield_cab.cpp221
-rw-r--r--engines/agos/installshield_cab.h41
-rw-r--r--engines/agos/intern.h6
-rw-r--r--engines/agos/midi.cpp1
-rw-r--r--engines/agos/module.mk1
-rw-r--r--engines/agos/res.cpp143
-rw-r--r--engines/agos/res_snd.cpp26
-rw-r--r--engines/agos/saveload.cpp8
-rw-r--r--engines/agos/string_pn.cpp2
-rw-r--r--engines/agos/subroutine.cpp22
-rw-r--r--engines/agos/verb_pn.cpp2
-rw-r--r--engines/cge/bitmap.cpp392
-rw-r--r--engines/cge/bitmap.h88
-rw-r--r--engines/cge/cge.cpp220
-rw-r--r--engines/cge/cge.h339
-rw-r--r--engines/cge/cge_main.cpp1570
-rw-r--r--engines/cge/cge_main.h114
-rw-r--r--engines/cge/console.cpp34
-rw-r--r--engines/cge/console.h43
-rw-r--r--engines/cge/detection.cpp240
-rw-r--r--engines/cge/events.cpp378
-rw-r--r--engines/cge/events.h154
-rw-r--r--engines/cge/fileio.cpp240
-rw-r--r--engines/cge/fileio.h120
-rw-r--r--engines/cge/game.cpp54
-rw-r--r--engines/cge/game.h53
-rw-r--r--engines/cge/general.h43
-rw-r--r--engines/cge/module.mk30
-rw-r--r--engines/cge/snail.cpp1222
-rw-r--r--engines/cge/snail.h85
-rw-r--r--engines/cge/sound.cpp290
-rw-r--r--engines/cge/sound.h136
-rw-r--r--engines/cge/talk.cpp292
-rw-r--r--engines/cge/talk.h76
-rw-r--r--engines/cge/text.cpp205
-rw-r--r--engines/cge/text.h66
-rw-r--r--engines/cge/vga13h.cpp1009
-rw-r--r--engines/cge/vga13h.h243
-rw-r--r--engines/cge/vmenu.cpp142
-rw-r--r--engines/cge/vmenu.h73
-rw-r--r--engines/cge/walk.cpp267
-rw-r--r--engines/cge/walk.h87
-rw-r--r--engines/cine/texte.cpp40
-rw-r--r--engines/cine/texte.h6
-rw-r--r--engines/composer/graphics.cpp2
-rw-r--r--engines/cruise/detection.cpp27
-rw-r--r--engines/dialogs.cpp8
-rw-r--r--engines/draci/detection.cpp49
-rw-r--r--engines/draci/game.cpp2
-rw-r--r--engines/draci/saveload.cpp2
-rw-r--r--engines/dreamweb/backdrop.cpp46
-rw-r--r--engines/dreamweb/dreamgen.cpp1224
-rw-r--r--engines/dreamweb/dreamgen.h140
-rw-r--r--engines/dreamweb/module.mk1
-rw-r--r--engines/dreamweb/pathfind.cpp226
-rw-r--r--engines/dreamweb/print.cpp8
-rw-r--r--engines/dreamweb/sprite.cpp84
-rw-r--r--engines/dreamweb/structs.h44
-rw-r--r--engines/dreamweb/stubs.cpp350
-rw-r--r--engines/dreamweb/stubs.h69
-rw-r--r--engines/dreamweb/use.cpp178
-rw-r--r--engines/dreamweb/vgagrafx.cpp61
-rw-r--r--engines/engines.mk5
-rw-r--r--engines/gob/anifile.cpp326
-rw-r--r--engines/gob/anifile.h161
-rw-r--r--engines/gob/aniobject.cpp210
-rw-r--r--engines/gob/aniobject.h119
-rw-r--r--engines/gob/decfile.cpp214
-rw-r--r--engines/gob/decfile.h111
-rw-r--r--engines/gob/detection_tables.h14
-rw-r--r--engines/gob/draw.cpp3
-rw-r--r--engines/gob/draw.h3
-rw-r--r--engines/gob/draw_v1.cpp3
-rw-r--r--engines/gob/draw_v2.cpp3
-rw-r--r--engines/gob/game.cpp6
-rw-r--r--engines/gob/gob.cpp1
-rw-r--r--engines/gob/hotspots.cpp37
-rw-r--r--engines/gob/hotspots.h4
-rw-r--r--engines/gob/init.cpp2
-rw-r--r--engines/gob/init.h3
-rw-r--r--engines/gob/init_geisha.cpp7
-rw-r--r--engines/gob/init_v6.cpp3
-rw-r--r--engines/gob/inter.h14
-rw-r--r--engines/gob/inter_bargon.cpp6
-rw-r--r--engines/gob/inter_geisha.cpp184
-rw-r--r--engines/gob/inter_v6.cpp1
-rw-r--r--engines/gob/minigames/geisha/diving.cpp439
-rw-r--r--engines/gob/minigames/geisha/diving.h127
-rw-r--r--engines/gob/minigames/geisha/evilfish.cpp189
-rw-r--r--engines/gob/minigames/geisha/evilfish.h90
-rw-r--r--engines/gob/minigames/geisha/penetration.cpp106
-rw-r--r--engines/gob/minigames/geisha/penetration.h61
-rw-r--r--engines/gob/module.mk8
-rw-r--r--engines/gob/rxyfile.cpp82
-rw-r--r--engines/gob/rxyfile.h76
-rw-r--r--engines/gob/save/saveload.h54
-rw-r--r--engines/gob/save/saveload_geisha.cpp215
-rw-r--r--engines/gob/sound/sound.cpp10
-rw-r--r--engines/gob/util.cpp45
-rw-r--r--engines/gob/util.h9
-rw-r--r--engines/gob/videoplayer.cpp4
-rw-r--r--engines/gob/videoplayer.h2
-rw-r--r--engines/groovie/roq.cpp51
-rw-r--r--engines/groovie/roq.h11
-rw-r--r--engines/hugo/object.cpp2
-rw-r--r--engines/hugo/parser.cpp2
-rw-r--r--engines/hugo/schedule.cpp6
-rw-r--r--engines/hugo/sound.cpp64
-rw-r--r--engines/kyra/animator_mr.cpp2
-rw-r--r--engines/kyra/detection.cpp15
-rw-r--r--engines/kyra/kyra_hof.cpp8
-rw-r--r--engines/kyra/kyra_hof.h4
-rw-r--r--engines/kyra/kyra_mr.h2
-rw-r--r--engines/kyra/module.mk7
-rw-r--r--engines/kyra/sequences_mr.cpp4
-rw-r--r--engines/kyra/sound_adlib.cpp43
-rw-r--r--engines/kyra/sound_adlib.h3
-rw-r--r--engines/kyra/staticres.cpp22
-rw-r--r--engines/kyra/staticres_lol.cpp12
-rw-r--r--engines/kyra/text_hof.cpp2
-rw-r--r--engines/kyra/text_mr.cpp2
-rw-r--r--engines/lastexpress/entities/francois.cpp4
-rw-r--r--engines/lastexpress/game/entities.cpp65
-rw-r--r--engines/lure/hotspots.cpp6
-rw-r--r--engines/made/screenfx.cpp124
-rw-r--r--engines/made/screenfx.h12
-rw-r--r--engines/mohawk/cursors.cpp6
-rw-r--r--engines/mohawk/detection_tables.h52
-rw-r--r--engines/mohawk/graphics.cpp42
-rw-r--r--engines/mohawk/graphics.h1
-rw-r--r--engines/mohawk/myst_stacks/channelwood.cpp10
-rw-r--r--engines/mohawk/myst_stacks/demo.cpp9
-rw-r--r--engines/mohawk/myst_stacks/dni.cpp2
-rw-r--r--engines/mohawk/myst_stacks/myst.cpp4
-rw-r--r--engines/mohawk/myst_stacks/preview.cpp10
-rw-r--r--engines/mohawk/myst_stacks/slides.cpp2
-rw-r--r--engines/parallaction/gfxbase.cpp21
-rw-r--r--engines/parallaction/objects.cpp6
-rw-r--r--engines/parallaction/parallaction.cpp25
-rw-r--r--engines/parallaction/parser_ns.cpp15
-rw-r--r--engines/queen/graphics.cpp2
-rw-r--r--engines/queen/input.cpp2
-rw-r--r--engines/queen/input.h2
-rw-r--r--engines/queen/musicdata.cpp2
-rw-r--r--engines/queen/resource.cpp2
-rw-r--r--engines/queen/resource.h2
-rw-r--r--engines/queen/sound.h2
-rw-r--r--engines/saga/interface.cpp1
-rw-r--r--engines/saga/script.cpp13
-rw-r--r--engines/saga/sthread.cpp17
-rw-r--r--engines/sci/detection.cpp11
-rw-r--r--engines/sci/detection_tables.h12
-rw-r--r--engines/sci/engine/kernel.cpp11
-rw-r--r--engines/sci/engine/kernel.h1
-rw-r--r--engines/sci/engine/kernel_tables.h13
-rw-r--r--engines/sci/engine/kfile.cpp6
-rw-r--r--engines/sci/engine/kgraphics.cpp118
-rw-r--r--engines/sci/engine/kmath.cpp8
-rw-r--r--engines/sci/engine/kmisc.cpp38
-rw-r--r--engines/sci/engine/kstring.cpp34
-rw-r--r--engines/sci/engine/savegame.cpp8
-rw-r--r--engines/sci/engine/scriptdebug.cpp5
-rw-r--r--engines/sci/engine/static_selectors.cpp32
-rw-r--r--engines/sci/engine/vm.cpp1
-rw-r--r--engines/sci/engine/workarounds.cpp9
-rw-r--r--engines/sci/graphics/cursor.cpp2
-rw-r--r--engines/sci/graphics/frameout.cpp102
-rw-r--r--engines/sci/graphics/frameout.h6
-rw-r--r--engines/sci/graphics/palette.cpp17
-rw-r--r--engines/sci/graphics/picture.cpp2
-rw-r--r--engines/sci/graphics/text32.cpp238
-rw-r--r--engines/sci/graphics/text32.h71
-rw-r--r--engines/sci/graphics/view.cpp3
-rw-r--r--engines/sci/module.mk1
-rw-r--r--engines/sci/resource.cpp14
-rw-r--r--engines/sci/sci.cpp4
-rw-r--r--engines/sci/sci.h2
-rw-r--r--engines/sci/sound/drivers/gm_names.h4
-rw-r--r--engines/sci/sound/midiparser_sci.cpp17
-rw-r--r--engines/sci/sound/music.cpp7
-rw-r--r--engines/sci/sound/soundcmd.cpp68
-rw-r--r--engines/sci/sound/soundcmd.h3
-rw-r--r--engines/scumm/actor.cpp4
-rw-r--r--engines/scumm/charset.cpp137
-rw-r--r--engines/scumm/charset.h11
-rw-r--r--engines/scumm/costume.cpp12
-rw-r--r--engines/scumm/cursor.cpp11
-rw-r--r--engines/scumm/detection.cpp48
-rw-r--r--engines/scumm/detection_tables.h2
-rw-r--r--engines/scumm/dialogs.cpp2
-rw-r--r--engines/scumm/gfx.cpp30
-rw-r--r--engines/scumm/he/intern_he.h1
-rw-r--r--engines/scumm/he/logic/basketball.cpp2
-rw-r--r--engines/scumm/he/resource_he.cpp34
-rw-r--r--engines/scumm/he/script_v90he.cpp2
-rw-r--r--engines/scumm/palette.cpp449
-rw-r--r--engines/scumm/player_towns.cpp3
-rw-r--r--engines/scumm/resource.cpp33
-rw-r--r--engines/scumm/resource.h7
-rw-r--r--engines/scumm/room.cpp7
-rw-r--r--engines/scumm/saveload.cpp28
-rw-r--r--engines/scumm/saveload.h2
-rw-r--r--engines/scumm/script_v0.cpp2
-rw-r--r--engines/scumm/script_v5.cpp24
-rw-r--r--engines/scumm/scumm-md5.h4
-rw-r--r--engines/scumm/scumm.cpp6
-rw-r--r--engines/scumm/scumm.h13
-rw-r--r--engines/scumm/sound.cpp19
-rw-r--r--engines/scumm/verbs.cpp1
-rw-r--r--engines/sky/compact.cpp2
-rw-r--r--engines/sky/compact.h2
-rw-r--r--engines/sky/debug.cpp12
-rw-r--r--engines/sky/disk.cpp4
-rw-r--r--engines/sky/logic.cpp11
-rw-r--r--engines/sky/sound.cpp2
-rw-r--r--engines/sword1/animation.cpp2
-rw-r--r--engines/sword1/control.cpp110
-rw-r--r--engines/sword1/control.h4
-rw-r--r--engines/sword1/detection.cpp38
-rw-r--r--engines/sword1/eventman.cpp36
-rw-r--r--engines/sword1/logic.cpp166
-rw-r--r--engines/sword1/logic.h194
-rw-r--r--engines/sword1/memman.cpp2
-rw-r--r--engines/sword1/memman.h6
-rw-r--r--engines/sword1/menu.cpp4
-rw-r--r--engines/sword1/mouse.cpp36
-rw-r--r--engines/sword1/mouse.h22
-rw-r--r--engines/sword1/object.h160
-rw-r--r--engines/sword1/objectman.cpp30
-rw-r--r--engines/sword1/objectman.h8
-rw-r--r--engines/sword1/resman.cpp108
-rw-r--r--engines/sword1/resman.h24
-rw-r--r--engines/sword1/router.cpp338
-rw-r--r--engines/sword1/router.h54
-rw-r--r--engines/sword1/screen.cpp78
-rw-r--r--engines/sword1/screen.h25
-rw-r--r--engines/sword1/sound.cpp94
-rw-r--r--engines/sword1/sound.h16
-rw-r--r--engines/sword1/staticres.cpp4
-rw-r--r--engines/sword1/sword1.cpp78
-rw-r--r--engines/sword1/sword1.h42
-rw-r--r--engines/sword1/sworddefs.h100
-rw-r--r--engines/sword1/text.cpp30
-rw-r--r--engines/sword1/text.h10
-rw-r--r--engines/tinsel/pcode.cpp2
-rw-r--r--engines/tinsel/tinsel.cpp6
-rw-r--r--engines/tinsel/tinsel.h6
-rw-r--r--engines/toon/anim.cpp4
-rw-r--r--engines/toon/audio.cpp6
-rw-r--r--engines/toon/picture.cpp2
-rw-r--r--engines/toon/resource.cpp2
-rw-r--r--engines/toon/script_func.cpp10
-rw-r--r--engines/toon/tools.cpp2
-rw-r--r--engines/toon/toon.cpp14
-rw-r--r--engines/tsage/blue_force/blueforce_dialogs.cpp434
-rw-r--r--engines/tsage/blue_force/blueforce_dialogs.h92
-rw-r--r--engines/tsage/blue_force/blueforce_logic.cpp1064
-rw-r--r--engines/tsage/blue_force/blueforce_logic.h260
-rw-r--r--engines/tsage/blue_force/blueforce_scenes0.cpp705
-rw-r--r--engines/tsage/blue_force/blueforce_scenes0.h89
-rw-r--r--engines/tsage/blue_force/blueforce_scenes1.cpp320
-rw-r--r--engines/tsage/blue_force/blueforce_scenes1.h54
-rw-r--r--engines/tsage/blue_force/blueforce_scenes2.cpp1720
-rw-r--r--engines/tsage/blue_force/blueforce_scenes2.h284
-rw-r--r--engines/tsage/blue_force/blueforce_scenes3.cpp5425
-rw-r--r--engines/tsage/blue_force/blueforce_scenes3.h774
-rw-r--r--engines/tsage/blue_force/blueforce_scenes4.cpp1659
-rw-r--r--engines/tsage/blue_force/blueforce_scenes4.h267
-rw-r--r--engines/tsage/blue_force/blueforce_scenes5.cpp2547
-rw-r--r--engines/tsage/blue_force/blueforce_scenes5.h406
-rw-r--r--engines/tsage/blue_force/blueforce_scenes6.cpp507
-rw-r--r--engines/tsage/blue_force/blueforce_scenes6.h124
-rw-r--r--engines/tsage/blue_force/blueforce_scenes7.cpp277
-rw-r--r--engines/tsage/blue_force/blueforce_scenes7.h103
-rw-r--r--engines/tsage/blue_force/blueforce_scenes8.cpp1397
-rw-r--r--engines/tsage/blue_force/blueforce_scenes8.h230
-rw-r--r--engines/tsage/blue_force/blueforce_scenes9.cpp1677
-rw-r--r--engines/tsage/blue_force/blueforce_scenes9.h318
-rw-r--r--engines/tsage/blue_force/blueforce_speakers.cpp970
-rw-r--r--engines/tsage/blue_force/blueforce_speakers.h344
-rw-r--r--engines/tsage/blue_force/blueforce_ui.cpp273
-rw-r--r--engines/tsage/blue_force/blueforce_ui.h35
-rw-r--r--engines/tsage/converse.cpp111
-rw-r--r--engines/tsage/converse.h7
-rw-r--r--engines/tsage/core.cpp830
-rw-r--r--engines/tsage/core.h59
-rw-r--r--engines/tsage/debugger.cpp119
-rw-r--r--engines/tsage/debugger.h1
-rw-r--r--engines/tsage/detection.cpp37
-rw-r--r--engines/tsage/dialogs.cpp222
-rw-r--r--engines/tsage/dialogs.h36
-rw-r--r--engines/tsage/events.cpp92
-rw-r--r--engines/tsage/events.h23
-rw-r--r--engines/tsage/globals.cpp123
-rw-r--r--engines/tsage/globals.h99
-rw-r--r--engines/tsage/graphics.cpp147
-rw-r--r--engines/tsage/module.mk13
-rw-r--r--engines/tsage/resources.cpp2
-rw-r--r--engines/tsage/ringworld/ringworld_demo.cpp16
-rw-r--r--engines/tsage/ringworld/ringworld_dialogs.cpp222
-rw-r--r--engines/tsage/ringworld/ringworld_dialogs.h70
-rw-r--r--engines/tsage/ringworld/ringworld_logic.cpp999
-rw-r--r--engines/tsage/ringworld/ringworld_logic.h305
-rw-r--r--engines/tsage/ringworld/ringworld_scenes1.cpp886
-rw-r--r--engines/tsage/ringworld/ringworld_scenes1.h1
-rw-r--r--engines/tsage/ringworld/ringworld_scenes10.cpp1026
-rw-r--r--engines/tsage/ringworld/ringworld_scenes10.h1
-rw-r--r--engines/tsage/ringworld/ringworld_scenes2.cpp234
-rw-r--r--engines/tsage/ringworld/ringworld_scenes2.h1
-rw-r--r--engines/tsage/ringworld/ringworld_scenes3.cpp2018
-rw-r--r--engines/tsage/ringworld/ringworld_scenes3.h1
-rw-r--r--engines/tsage/ringworld/ringworld_scenes4.cpp40
-rw-r--r--engines/tsage/ringworld/ringworld_scenes4.h1
-rw-r--r--engines/tsage/ringworld/ringworld_scenes5.cpp1484
-rw-r--r--engines/tsage/ringworld/ringworld_scenes5.h1
-rw-r--r--engines/tsage/ringworld/ringworld_scenes6.cpp884
-rw-r--r--engines/tsage/ringworld/ringworld_scenes6.h1
-rw-r--r--engines/tsage/ringworld/ringworld_scenes8.cpp640
-rw-r--r--engines/tsage/ringworld/ringworld_scenes8.h1
-rw-r--r--engines/tsage/ringworld/ringworld_speakers.cpp905
-rw-r--r--engines/tsage/ringworld/ringworld_speakers.h337
-rw-r--r--engines/tsage/saveload.cpp28
-rw-r--r--engines/tsage/saveload.h4
-rw-r--r--engines/tsage/scenes.cpp208
-rw-r--r--engines/tsage/scenes.h19
-rw-r--r--engines/tsage/sound.cpp46
-rw-r--r--engines/tsage/sound.h2
-rw-r--r--engines/tsage/staticres.cpp28
-rw-r--r--engines/tsage/staticres.h21
-rw-r--r--engines/tsage/tsage.cpp70
-rw-r--r--engines/tsage/tsage.h8
-rw-r--r--engines/tucker/staticres.cpp2
-rw-r--r--engines/tucker/tucker.h2
359 files changed, 44213 insertions, 9963 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 4bebf97e95..4ed606c3ba 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -362,9 +362,15 @@ int AgiEngine::agiInit() {
initPriTable();
- // clear string buffer
- for (i = 0; i < MAX_STRINGS; i++)
- _game.strings[i][0] = 0;
+ // Clear the string buffer on startup, but not when the game restarts, as
+ // some scripts expect that the game strings remain unaffected after a
+ // restart. An example is script 98 in SQ2, which is not invoked on restart
+ // to ask Ego's name again. The name is supposed to be maintained in string 1.
+ // Fixes bug #3292784.
+ if (!_restartGame) {
+ for (i = 0; i < MAX_STRINGS; i++)
+ _game.strings[i][0] = 0;
+ }
// setup emulation
@@ -519,6 +525,21 @@ AgiBase::~AgiBase() {
}
}
+void AgiBase::initRenderMode() {
+ _renderMode = Common::kRenderEGA;
+
+ if (ConfMan.hasKey("platform")) {
+ Common::Platform platform = Common::parsePlatform(ConfMan.get("platform"));
+ _renderMode = (platform == Common::kPlatformAmiga) ? Common::kRenderAmiga : Common::kRenderEGA;
+ }
+
+ if (ConfMan.hasKey("render_mode")) {
+ Common::RenderMode tmpMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str());
+ if (tmpMode != Common::kRenderDefault)
+ _renderMode = tmpMode;
+ }
+}
+
AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBase(syst, gameDesc) {
// Setup mixer
@@ -572,11 +593,7 @@ AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBas
_predictiveDictLineCount = 0;
_firstSlot = 0;
- // NOTE: On game reload the keys do not get set again,
- // thus it is incorrect to reset it in agiInit(). Fixes bug #2823762
- _game.lastController = 0;
- for (int i = 0; i < MAX_DIRS; i++)
- _game.controllerOccured[i] = false;
+ resetControllers();
setupOpcodes();
_game._curLogic = NULL;
@@ -618,23 +635,7 @@ void AgiEngine::initialize() {
}
}
- if (ConfMan.hasKey("render_mode")) {
- _renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str());
- } else if (ConfMan.hasKey("platform")) {
- switch (Common::parsePlatform(ConfMan.get("platform"))) {
- case Common::kPlatformAmiga:
- _renderMode = Common::kRenderAmiga;
- break;
- case Common::kPlatformPC:
- _renderMode = Common::kRenderEGA;
- break;
- default:
- _renderMode = Common::kRenderEGA;
- break;
- }
- } else {
- _renderMode = Common::kRenderDefault;
- }
+ initRenderMode();
_buttonStyle = AgiButtonStyle(_renderMode);
_defaultButtonStyle = AgiButtonStyle();
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 080373d27b..6bb3beec78 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -124,7 +124,6 @@ enum AgiGameID {
GID_XMASCARD,
GID_FANMADE,
GID_GETOUTTASQ, // Fanmade
- GID_SQ0, // Fanmade
GID_MICKEY, // PreAGI
GID_WINNIE, // PreAGI
GID_TROLL // PreAGI
@@ -614,7 +613,6 @@ struct AgiGame {
bool controllerOccured[MAX_DIRS]; /**< keyboard keypress events */
AgiController controllers[MAX_CONTROLLERS];
- int lastController;
char strings[MAX_STRINGS + 1][MAX_STRINGLEN]; /**< strings */
@@ -778,6 +776,8 @@ protected:
virtual void initialize() = 0;
+ void initRenderMode();
+
public:
GfxMgr *_gfx;
@@ -809,8 +809,8 @@ public:
virtual void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
int16 p4, int16 p5, int16 p6, int16 p7) = 0;
virtual void releaseImageStack() = 0;
- virtual int saveGame(const char *fileName, const char *saveName) = 0;
- virtual int loadGame(const char *fileName, bool checkId = true) = 0;
+ virtual int saveGame(const Common::String &fileName, const Common::String &saveName) = 0;
+ virtual int loadGame(const Common::String &fileName, bool checkId = true) = 0;
int _soundemu;
@@ -881,13 +881,13 @@ public:
StringData _stringdata;
- const char *getSavegameFilename(int num);
+ Common::String getSavegameFilename(int num) const;
void getSavegameDescription(int num, char *buf, bool showEmpty = true);
int selectSlot();
- int saveGame(const char *fileName, const char *saveName);
+ int saveGame(const Common::String &fileName, const Common::String &saveName);
+ int loadGame(const Common::String &fileName, bool checkId = true);
int saveGameDialog();
int saveGameSimple();
- int loadGame(const char *fileName, bool checkId = true);
int loadGameDialog();
int loadGameSimple();
@@ -1076,7 +1076,7 @@ public:
char *agiSprintf(const char *);
void writeStatus();
void writePrompt();
- void clearPrompt();
+ void clearPrompt(bool useBlackBg = false);
void clearLines(int, int, int);
void flushLines(int, int);
bool predictiveDialog();
diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp
index e6f122f9f6..9cbab1f3c4 100644
--- a/engines/agi/cycle.cpp
+++ b/engines/agi/cycle.cpp
@@ -384,7 +384,6 @@ int AgiEngine::runGame() {
if (_restartGame) {
setflag(fRestartGame, true);
- _game.lastController = 0;
setvar(vTimeDelay, 2); // "normal" speed
_restartGame = false;
}
diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp
index 5141ab761f..21b1831261 100644
--- a/engines/agi/detection.cpp
+++ b/engines/agi/detection.cpp
@@ -276,6 +276,8 @@ SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int sl
SaveStateDescriptor desc(slot, name);
+ // Do not allow save slot 0 (used for auto-saving) to be deleted or
+ // overwritten.
desc.setDeletableFlag(slot != 0);
desc.setWriteProtectedFlag(slot == 0);
@@ -306,9 +308,12 @@ SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int sl
delete in;
return desc;
+ } else {
+ SaveStateDescriptor emptySave;
+ // Do not allow save slot 0 (used for auto-saving) to be overwritten.
+ emptySave.setWriteProtectedFlag(slot == 0);
+ return emptySave;
}
-
- return SaveStateDescriptor();
}
const ADGameDescription *AgiMetaEngine::fallbackDetect(const FileMap &allFilesXXX, const Common::FSList &fslist) const {
diff --git a/engines/agi/detection_tables.h b/engines/agi/detection_tables.h
index 28e94075a6..f0cd422ed6 100644
--- a/engines/agi/detection_tables.h
+++ b/engines/agi/detection_tables.h
@@ -299,8 +299,8 @@ static const AGIGameDescription gameDescriptions[] = {
// King's Quest 2 (IIgs) 2.0A 6/16/88 (CE)
GAME_P("kq2", "2.0A 1988-06-16 (CE)", "5203c8b95250a2ecfee93ddb99414753", 0x2917, GID_KQ2, Common::kPlatformApple2GS),
- // King's Quest 2 (Amiga) 2.0J (Broken)
- GAME_P("kq2", "2.0J 1987-01-29 [OBJECT decrypted]", "b866f0fab2fad91433a637a828cfa410", 0x2440, GID_KQ2, Common::kPlatformAmiga),
+ // King's Quest 2 (Amiga) 2.0J
+ GAME_P("kq2", "2.0J 1987-01-29", "b866f0fab2fad91433a637a828cfa410", 0x2440, GID_KQ2, Common::kPlatformAmiga),
// King's Quest 2 (Mac) 2.0R
GAME_P("kq2", "2.0R 1988-03-23", "cbdb0083317c8e7cfb7ac35da4bc7fdc", 0x2440, GID_KQ2, Common::kPlatformMacintosh),
@@ -708,39 +708,11 @@ static const AGIGameDescription gameDescriptions[] = {
FANMADE("Go West, Young Hippie", "ff31484ea465441cb5f3a0f8e956b716"),
FANMADE("Good Man (demo v3.41)", "3facd8a8f856b7b6e0f6c3200274d88c"),
- {
- // Groza
- {
- "agi-fanmade",
- "Groza (russian) [AGDS sample]",
- AD_ENTRY1("logdir", "421da3a18004122a966d64ab6bd86d2e"),
- Common::RU_RUS,
- Common::kPlatformPC,
- ADGF_USEEXTRAASTITLE,
- GUIO_NONE
- },
- GID_FANMADE,
- GType_V2,
- GF_AGDS,
- 0x2440
- },
+ GAME_LVFPNF("agi-fanmade", "Groza (russian) [AGDS sample]", "logdir", "421da3a18004122a966d64ab6bd86d2e", -1,
+ Common::RU_RUS, 0x2440, GF_AGDS, GID_FANMADE, Common::kPlatformPC,GType_V2),
- {
- // Get Outta SQ
- {
- "agi-fanmade",
- "Get Outta Space Quest",
- AD_ENTRY1("logdir", "aaea5b4a348acb669d13b0e6f22d4dc9"),
- Common::EN_ANY,
- Common::kPlatformPC,
- ADGF_USEEXTRAASTITLE,
- GUIO_NONE
- },
- GID_GETOUTTASQ,
- GType_V2,
- 0,
- 0x2440
- },
+ GAME_LVFPNF("agi-fanmade", "Get Outta Space Quest", "logdir", "aaea5b4a348acb669d13b0e6f22d4dc9", -1,
+ Common::EN_ANY, 0x2440, GF_FANMADE, GID_GETOUTTASQ, Common::kPlatformPC,GType_V2),
FANMADE_F("Half-Death - Terror At White-Mesa", "b62c05d0ace878261392073f57ae788c", GF_AGIMOUSE),
FANMADE("Hank's Quest (v1.0 English) - Victim of Society", "64c15b3d0483d17888129100dc5af213"),
diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp
index eb162e4ab0..074e5570d5 100644
--- a/engines/agi/graphics.cpp
+++ b/engines/agi/graphics.cpp
@@ -1192,7 +1192,6 @@ void GfxMgr::flushScreen() {
flushBlock(0, 0, GFX_WIDTH - 1, GFX_HEIGHT - 1);
doUpdate();
- g_system->updateScreen();
}
/**
diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp
index d899a6e202..a7f15c16fb 100644
--- a/engines/agi/keyboard.cpp
+++ b/engines/agi/keyboard.cpp
@@ -114,7 +114,7 @@ int AgiEngine::handleController(int key) {
debugC(3, kDebugLevelInput, "key = %04x", key);
- for (i = 0; i < _game.lastController; i++) {
+ for (i = 0; i < MAX_CONTROLLERS; i++) {
if (_game.controllers[i].keycode == key) {
debugC(3, kDebugLevelInput, "event %d: key press", _game.controllers[i].controller);
_game.controllerOccured[_game.controllers[i].controller] = true;
@@ -180,10 +180,17 @@ int AgiEngine::handleController(int key) {
if (!(getFeatures() & GF_AGIMOUSE)) {
// Handle mouse button events
if (key == BUTTON_LEFT) {
- v->flags |= fAdjEgoXY;
- v->parm1 = WIN_TO_PIC_X(_mouse.x);
- v->parm2 = WIN_TO_PIC_Y(_mouse.y);
- return true;
+ if (getGameID() == GID_PQ1 && _game.vars[vCurRoom] == 116) {
+ // WORKAROUND: Special handling for mouse clicks in the newspaper
+ // screen of PQ1. Fixes bug #3018770.
+ d = 3; // fake a right arrow key (next page)
+ } else {
+ // Click-to-walk mouse interface
+ v->flags |= fAdjEgoXY;
+ v->parm1 = WIN_TO_PIC_X(_mouse.x);
+ v->parm2 = WIN_TO_PIC_Y(_mouse.y);
+ return true;
+ }
}
}
diff --git a/engines/agi/objects.cpp b/engines/agi/objects.cpp
index efc8645287..94eef92579 100644
--- a/engines/agi/objects.cpp
+++ b/engines/agi/objects.cpp
@@ -68,15 +68,20 @@ int AgiEngine::decodeObjects(uint8 *mem, uint32 flen) {
for (i = 0, so = spos; i < _game.numObjects; i++, so += padsize) {
int offset;
- (_objects + i)->location = *(mem + so + 2);
+ _objects[i].location = *(mem + so + 2);
offset = READ_LE_UINT16(mem + so) + spos;
if ((uint) offset < flen) {
- (_objects + i)->name = (char *)strdup((const char *)mem + offset);
+ _objects[i].name = (char *)strdup((const char *)mem + offset);
} else {
warning("object %i name beyond object filesize (%04x > %04x)", i, offset, flen);
- (_objects + i)->name = strdup("");
+ _objects[i].name = strdup("");
}
+
+ // Don't show the invalid "?" object in ego's inventory in the fanmade
+ // game Beyond the Titanic 2 (bug #3116541).
+ if (!strcmp(_objects[i].name, "?") && _objects[i].location == EGO_OWNED)
+ _objects[i].location = 0;
}
debug(0, "Reading objects: %d objects read.", _game.numObjects);
diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp
index 17addc0c05..72f60e2516 100644
--- a/engines/agi/op_cmd.cpp
+++ b/engines/agi/op_cmd.cpp
@@ -73,9 +73,9 @@ void cmdDecrement(AgiGame *state, uint8 *p) {
void cmdAssignN(AgiGame *state, uint8 *p) {
_v[p0] = p1;
- // WORKAROUND for a bug in fan _game "Get outta SQ"
+ // WORKAROUND for a bug in fan game "Get outta SQ"
// Total number of points is stored in variable 7, which
- // is then incorrectly assigned to 0. Thus, when the _game
+ // is then incorrectly assigned to 0. Thus, when the game
// is restarted, "Points 0 of 0" is shown. We set the
// variable to the correct value here
// Fixes bug #1942476 - "AGI: Fan(Get Outta SQ) - Score
@@ -184,10 +184,10 @@ void cmdNewRoom(AgiGame *state, uint8 *p) {
// of the copy protection string (Copy protection is in logic.128) was
// left over to the intro scene (Starts with room 73 i.e. logic.073).
// The intro scene checks for any keys pressed and if it finds any it
- // jumps to the _game's start (Room 1 i.e. logic.001). We clear the
+ // jumps to the game's start (Room 1 i.e. logic.001). We clear the
// keyboard buffer when the intro sequence's first room (Room 73) is
// loaded so that no keys from the copy protection scene can be left
- // over to cause the intro to skip to the _game's start.
+ // over to cause the intro to skip to the game's start.
if (getGameID() == GID_GOLDRUSH && p0 == 73)
state->keypress = 0;
}
@@ -275,9 +275,9 @@ void cmdSetPriority(AgiGame *state, uint8 *p) {
// It seems that in this scene, ego's priority is set to 8, but the priority of
// the last dwarf with the soup bowls (view 152) is also set to 8, which causes
// the dwarf to be drawn behind ego
- // With this workaround, when the _game scripts set the priority of view 152
+ // With this workaround, when the game scripts set the priority of view 152
// (seventh dwarf with soup bowls), ego's priority is set to 7
- // The _game script itself sets priotity 8 for ego before she starts walking,
+ // The game script itself sets priotity 8 for ego before she starts walking,
// and then releases the fixed priority set on ego after ego is seated
// Therefore, this workaround only affects that specific part of this scene
// Ego is set to object 19 by script 54
@@ -902,7 +902,7 @@ void cmdDraw(AgiGame *state, uint8 *p) {
state->_vm->_sprites->eraseUpdSprites();
vt.flags |= fDrawn;
- // WORKAROUND: This fixes a bug with AGI Fanmade _game Space Trek.
+ // WORKAROUND: This fixes a bug with AGI Fanmade game Space Trek.
// The original workaround checked if AGI version was <= 2.440, which could
// cause regressions with some AGI games. The original workaround no longer
// works for Space Trek in ScummVM, as all fanmade games are set to use
@@ -1259,7 +1259,6 @@ void cmdSetMenuItem(AgiGame *state, uint8 *p) {
}
void cmdVersion(AgiGame *state, uint8 *p) {
- char verMsg[64];
char ver2Msg[] =
"\n"
" \n\n"
@@ -1269,33 +1268,17 @@ void cmdVersion(AgiGame *state, uint8 *p) {
" \n\n"
" Emulating AGI v%x.002.%03x\n";
// no Sierra as it wraps textbox
- char *r, *q;
- int ver, maj, min;
- char msg[256];
- int gap;
- int len;
- sprintf(verMsg, TITLE " v%s", gScummVMVersion);
-
- ver = getVersion();
- maj = (ver >> 12) & 0xf;
- min = ver & 0xfff;
-
- q = maj == 2 ? ver2Msg : ver3Msg;
- r = strchr(q + 1, '\n');
+ Common::String verMsg = TITLE " v%s";
+
+ int ver = getVersion();
+ int maj = (ver >> 12) & 0xf;
+ int min = ver & 0xfff;
- // insert our version into the other version
- len = strlen(verMsg);
- gap = r - q;
+ verMsg += (maj == 2 ? ver2Msg : ver3Msg);
+ verMsg = Common::String::format(verMsg.c_str(), gScummVMVersion, maj, min);
- if (gap < 0)
- gap = 0;
- else
- gap = (gap - len) / 2;
-
- strncpy(q + 1 + gap, verMsg, strlen(verMsg));
- sprintf(msg, q, maj, min);
- state->_vm->messageBox(msg);
+ state->_vm->messageBox(verMsg.c_str());
}
void cmdConfigureScreen(AgiGame *state, uint8 *p) {
@@ -1368,7 +1351,7 @@ void cmdRestartGame(AgiGame *state, uint8 *p) {
state->_vm->_sound->stopSound();
sel = getflag(fAutoRestart) ? 0 :
- state->_vm->selectionBox(" Restart _game, or continue? \n\n\n", buttons);
+ state->_vm->selectionBox(" Restart game, or continue? \n\n\n", buttons);
if (sel == 0) {
state->_vm->_restartGame = true;
@@ -1442,7 +1425,8 @@ void cmdPreventInput(AgiGame *state, uint8 *p) {
state->_vm->newInputMode(INPUT_NONE);
state->inputEnabled = false;
- state->_vm->clearPrompt();
+ // Always clear with black background. Fixes bug #3080041.
+ state->_vm->clearPrompt(true);
}
void cmdGetString(AgiGame *state, uint8 *p) {
@@ -1515,20 +1499,25 @@ void cmdSetCursorChar(AgiGame *state, uint8 *p) {
}
void cmdSetKey(AgiGame *state, uint8 *p) {
- int key;
+ int key = 256 * p1 + p0;
+ int slot = -1;
- if (state->lastController >= MAX_CONTROLLERS) {
+ for (int i = 0; i < MAX_CONTROLLERS; i++) {
+ if (slot == -1 && !state->controllers[i].keycode)
+ slot = i;
+
+ if (state->controllers[i].keycode == key && state->controllers[i].controller == p2)
+ return;
+ }
+
+ if (slot == -1) {
warning("Number of set.keys exceeded %d", MAX_CONTROLLERS);
return;
}
- debugC(4, kDebugLevelScripts, "%d %d %d", p0, p1, p2);
-
- key = 256 * p1 + p0;
-
- state->controllers[state->lastController].keycode = key;
- state->controllers[state->lastController].controller = p2;
- state->lastController++;
+ debugC(4, kDebugLevelScripts, "cmdSetKey: %d %d %d", p0, p1, p2);
+ state->controllers[slot].keycode = key;
+ state->controllers[slot].controller = p2;
state->controllerOccured[p2] = false;
}
diff --git a/engines/agi/opcodes.cpp b/engines/agi/opcodes.cpp
index c2cecefc52..d1baab93e1 100644
--- a/engines/agi/opcodes.cpp
+++ b/engines/agi/opcodes.cpp
@@ -288,7 +288,7 @@ AgiInstruction insV2[] = {
{ "status.line.on", "", &cmdStatusLineOn },
{ "status.line.off", "", &cmdStatusLineOff },
{ "set.string", "ns", &cmdSetString },
- { "get.string", "ns", &cmdGetString },
+ { "get.string", "nsnnn", &cmdGetString },
{ "word.to.string", "nn", &cmdWordToString },
{ "parse", "n", &cmdParse },
{ "get.num", "nv", &cmdGetNum },
@@ -307,7 +307,7 @@ AgiInstruction insV2[] = {
{ "program.control", "", &cmdProgramControl },
{ "player.control", "", &cmdPlayerControl },
{ "obj.status.v", "v", &cmdObjStatusF },
- { "quit", "n", &cmdQuit },
+ { "quit", "n", &cmdQuit }, // 0 args for AGI version 2.089
{ "show.mem", "", &cmdShowMem },
{ "pause", "", &cmdPause },
{ "echo.line", "", &cmdEchoLine },
@@ -324,16 +324,16 @@ AgiInstruction insV2[] = {
{ "reposition.to.v", "nvv", &cmdRepositionToF },
{ "trace.on", "", &cmdTraceOn },
{ "trace.info", "nnn", &cmdTraceInfo },
- { "print.at", "snnn", &cmdPrintAt },
+ { "print.at", "snnn", &cmdPrintAt }, // 3 args for AGI versions before 2.440
{ "print.at.v", "vnnn", &cmdPrintAtV },
{ "discard.view.v", "v", &cmdDiscardView},
{ "clear.text.rect", "nnnnn", &cmdClearTextRect },
{ "set.upper.left", "nn", &cmdSetUpperLeft },
{ "set.menu", "s", &cmdSetMenu },
- { "set.menu.member", "sn", &cmdSetMenuItem },
+ { "set.menu.item", "sn", &cmdSetMenuItem },
{ "submit.menu", "", &cmdSubmitMenu },
- { "enable.member", "n", &cmdEnableItem },
- { "disable.member", "n", &cmdDisableItem },
+ { "enable.item", "n", &cmdEnableItem },
+ { "disable.item", "n", &cmdDisableItem },
{ "menu.input", "", &cmdMenuInput },
{ "show.obj.v", "v", &cmdShowObjV },
{ "open.dialogue", "", &cmdOpenDialogue },
@@ -349,12 +349,12 @@ AgiInstruction insV2[] = {
{ "hold.key", "", &cmdHoldKey },
{ "set.pri.base", "n", &cmdSetPriBase },
{ "discard.sound", "n", &cmdDiscardSound },
- { "hide.mouse", "", &cmdHideMouse },
+ { "hide.mouse", "", &cmdHideMouse }, // 1 arg for AGI version 3.002.086
{ "allow.menu", "n", &cmdAllowMenu },
{ "show.mouse", "", &cmdShowMouse },
{ "fence.mouse", "nnnn", &cmdFenceMouse },
{ "mouse.posn", "vv", &cmdMousePosn },
- { "release.key", "", &cmdReleaseKey },
+ { "release.key", "", &cmdReleaseKey }, // 2 args for at least the Amiga GR (v2.05 1989-03-09) using AGI 2.316
{ "adj.ego.move.to.xy", "", &cmdAdjEgoMoveToXY }
};
diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp
index 34180b543f..0b5afc7f8c 100644
--- a/engines/agi/preagi.cpp
+++ b/engines/agi/preagi.cpp
@@ -54,21 +54,7 @@ PreAgiEngine::PreAgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) :
}
void PreAgiEngine::initialize() {
- if (ConfMan.hasKey("render_mode")) {
- _renderMode = Common::parseRenderMode(ConfMan.get("render_mode").c_str());
- } else if (ConfMan.hasKey("platform")) {
- switch (Common::parsePlatform(ConfMan.get("platform"))) {
- case Common::kPlatformAmiga:
- _renderMode = Common::kRenderAmiga;
- break;
- case Common::kPlatformPC:
- _renderMode = Common::kRenderEGA;
- break;
- default:
- _renderMode = Common::kRenderEGA;
- break;
- }
- }
+ initRenderMode();
_gfx = new GfxMgr(this);
_picture = new PictureMgr(this, _gfx);
@@ -185,7 +171,6 @@ void PreAgiEngine::printStr(const char* szMsg) {
clearTextArea();
drawStr(21, 0, IDA_DEFAULT, szMsg);
_gfx->doUpdate();
- _system->updateScreen();
}
void PreAgiEngine::XOR80(char *buffer) {
@@ -284,7 +269,6 @@ void PreAgiEngine::waitForTimer(int msec_delay) {
while (_system->getMillis() < start_time + msec_delay) {
_gfx->doUpdate();
- _system->updateScreen();
_system->delayMillis(10);
}
}
diff --git a/engines/agi/preagi.h b/engines/agi/preagi.h
index 14ff483d9f..5d50fb5af8 100644
--- a/engines/agi/preagi.h
+++ b/engines/agi/preagi.h
@@ -73,8 +73,8 @@ protected:
void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3,
int16 p4, int16 p5, int16 p6, int16 p7) {}
void releaseImageStack() {}
- int saveGame(const char *fileName, const char *saveName) { return -1; }
- int loadGame(const char *fileName, bool checkId = true) { return -1; }
+ int saveGame(const Common::String &fileName, const Common::String &saveName) { return -1; }
+ int loadGame(const Common::String &fileName, bool checkId = true) { return -1; }
// Game
Common::String getTargetName() { return _targetName; }
diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp
index 6d1eb445a2..ed4882fcab 100644
--- a/engines/agi/preagi_mickey.cpp
+++ b/engines/agi/preagi_mickey.cpp
@@ -150,7 +150,6 @@ void MickeyEngine::printStr(char *buffer) {
// Show the string on screen
_gfx->doUpdate();
- _system->updateScreen();
}
void MickeyEngine::printLine(const char *buffer) {
@@ -160,7 +159,6 @@ void MickeyEngine::printLine(const char *buffer) {
// Show the string on screen
_gfx->doUpdate();
- _system->updateScreen();
waitAnyKey(true);
}
@@ -284,7 +282,6 @@ void MickeyEngine::drawMenu(MSA_MENU menu, int sel0, int sel1) {
// Menu created, show it on screen
_gfx->doUpdate();
- _system->updateScreen();
}
void MickeyEngine::getMouseMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow, int x, int y) {
@@ -1364,7 +1361,6 @@ void MickeyEngine::flipSwitch() {
strcpy(_gameStateMickey.szAddr, (char *)IDS_MSA_ADDR_PLANET[_gameStateMickey.iPlanetXtal[_gameStateMickey.nXtals]]);
_gameStateMickey.nButtons = strlen(_gameStateMickey.szAddr);
_gfx->doUpdate();
- _system->updateScreen(); // TODO: this should go in the game's main loop
#endif
waitAnyKey(true);
@@ -1452,14 +1448,12 @@ void MickeyEngine::intro() {
//Set screen to white
_gfx->clearScreen(15);
_gfx->doUpdate();
- _system->updateScreen();
_system->delayMillis(IDI_MSA_ANIM_DELAY);
//Set back to black
_gfx->clearScreen(0);
_gfx->doUpdate();
- _system->updateScreen();
drawRoom();
printDesc(_gameStateMickey.iRoom);
diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp
index c2e2bef66e..50b2945383 100644
--- a/engines/agi/preagi_troll.cpp
+++ b/engines/agi/preagi_troll.cpp
@@ -362,7 +362,6 @@ void TrollEngine::intro() {
drawStr(9, 10, kColorDefault, IDS_TRO_INTRO_0);
drawStr(14, 15, kColorDefault, IDS_TRO_INTRO_1);
_gfx->doUpdate();
- _system->updateScreen();
_system->delayMillis(3200);
CursorMan.showMouse(true);
diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp
index fee8fde2b3..cc5c2470ae 100644
--- a/engines/agi/preagi_winnie.cpp
+++ b/engines/agi/preagi_winnie.cpp
@@ -193,7 +193,6 @@ void WinnieEngine::intro() {
drawPic(IDS_WTP_FILE_LOGO);
printStr(IDS_WTP_INTRO_0);
_gfx->doUpdate();
- _system->updateScreen();
_system->delayMillis(0x640);
if (getPlatform() == Common::kPlatformAmiga)
@@ -203,7 +202,6 @@ void WinnieEngine::intro() {
printStr(IDS_WTP_INTRO_1);
_gfx->doUpdate();
- _system->updateScreen();
_system->delayMillis(0x640);
if (!playSound(IDI_WTP_SND_POOH_0))
@@ -455,7 +453,6 @@ int WinnieEngine::parser(int pc, int index, uint8 *buffer) {
if (iBlock == 1)
return IDI_WTP_PAR_OK;
_gfx->doUpdate();
- _system->updateScreen();
}
return IDI_WTP_PAR_OK;
@@ -481,7 +478,6 @@ void WinnieEngine::inventory() {
drawStr(IDI_WTP_ROW_OPTION_4, IDI_WTP_COL_MENU, IDA_DEFAULT, missing.c_str());
_gfx->doUpdate();
- _system->updateScreen(); //TODO: Move to game's main loop
getSelection(kSelAnyKey);
}
@@ -760,7 +756,6 @@ void WinnieEngine::drawMenu(char *szMenu, int iSel, int fCanSel[]) {
}
drawStr(iRow, iCol - 1, IDA_DEFAULT, ">");
_gfx->doUpdate();
- _system->updateScreen(); //TODO: Move to game's main loop
}
void WinnieEngine::incMenuSel(int *iSel, int fCanSel[]) {
@@ -1019,7 +1014,6 @@ phase0:
readRoom(_room, roomdata, hdr);
drawRoomPic();
_gfx->doUpdate();
- _system->updateScreen();
phase1:
if (getObjInRoom(_room)) {
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 28dd0a53dd..3cebbf50c8 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -53,22 +53,22 @@ namespace Agi {
static const uint32 AGIflag = MKTAG('A','G','I',':');
-int AgiEngine::saveGame(const char *fileName, const char *description) {
+int AgiEngine::saveGame(const Common::String &fileName, const Common::String &description) {
char gameIDstring[8] = "gameIDX";
int i;
Common::OutSaveFile *out;
int result = errOK;
- debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::saveGame(%s, %s)", fileName, description);
+ debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::saveGame(%s, %s)", fileName.c_str(), description.c_str());
if (!(out = _saveFileMan->openForSaving(fileName))) {
- warning("Can't create file '%s', game not saved", fileName);
+ warning("Can't create file '%s', game not saved", fileName.c_str());
return errBadFileOpen;
} else {
- debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for writing", fileName);
+ debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for writing", fileName.c_str());
}
out->writeUint32BE(AGIflag);
- out->write(description, 31);
+ out->write(description.c_str(), 31);
out->writeByte(SAVEGAME_VERSION);
debugC(5, kDebugLevelMain | kDebugLevelSavegame, "Writing save game version (%d)", SAVEGAME_VERSION);
@@ -239,33 +239,33 @@ int AgiEngine::saveGame(const char *fileName, const char *description) {
out->finalize();
if (out->err()) {
- warning("Can't write file '%s'. (Disk full?)", fileName);
+ warning("Can't write file '%s'. (Disk full?)", fileName.c_str());
result = errIOError;
} else
- debugC(1, kDebugLevelMain | kDebugLevelSavegame, "Saved game %s in file %s", description, fileName);
+ debugC(1, kDebugLevelMain | kDebugLevelSavegame, "Saved game %s in file %s", description.c_str(), fileName.c_str());
delete out;
- debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName);
+ debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName.c_str());
_lastSaveTime = _system->getMillis();
return result;
}
-int AgiEngine::loadGame(const char *fileName, bool checkId) {
+int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
char description[31], saveVersion, loadId[8];
int i, vtEntries = MAX_VIEWTABLE;
uint8 t;
int16 parm[7];
Common::InSaveFile *in;
- debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::loadGame(%s)", fileName);
+ debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::loadGame(%s)", fileName.c_str());
if (!(in = _saveFileMan->openForLoading(fileName))) {
- warning("Can't open file '%s', game not loaded", fileName);
+ warning("Can't open file '%s', game not loaded", fileName.c_str());
return errBadFileOpen;
} else {
- debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for reading", fileName);
+ debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for reading", fileName.c_str());
}
uint32 typea = in->readUint32BE();
@@ -527,7 +527,7 @@ int AgiEngine::loadGame(const char *fileName, bool checkId) {
_gfx->setAGIPal(in->readSint16BE());
delete in;
- debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName);
+ debugC(3, kDebugLevelMain | kDebugLevelSavegame, "Closed %s", fileName.c_str());
setflag(fRestoreJustRan, true);
@@ -546,27 +546,27 @@ int AgiEngine::loadGame(const char *fileName, bool checkId) {
#define NUM_SLOTS 100
#define NUM_VISIBLE_SLOTS 12
-const char *AgiEngine::getSavegameFilename(int num) {
+Common::String AgiEngine::getSavegameFilename(int num) const {
Common::String saveLoadSlot = _targetName;
saveLoadSlot += Common::String::format(".%.3d", num);
- return saveLoadSlot.c_str();
+ return saveLoadSlot;
}
void AgiEngine::getSavegameDescription(int num, char *buf, bool showEmpty) {
- char fileName[MAXPATHLEN];
Common::InSaveFile *in;
+ Common::String fileName = getSavegameFilename(num);
debugC(4, kDebugLevelMain | kDebugLevelSavegame, "Current game id is %s", _targetName.c_str());
- sprintf(fileName, "%s", getSavegameFilename(num));
+
if (!(in = _saveFileMan->openForLoading(fileName))) {
- debugC(4, kDebugLevelMain | kDebugLevelSavegame, "File %s does not exist", fileName);
+ debugC(4, kDebugLevelMain | kDebugLevelSavegame, "File %s does not exist", fileName.c_str());
if (showEmpty)
strcpy(buf, " (empty slot)");
else
*buf = 0;
} else {
- debugC(4, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for reading", fileName);
+ debugC(4, kDebugLevelMain | kDebugLevelSavegame, "Successfully opened %s for reading", fileName.c_str());
uint32 type = in->readUint32BE();
@@ -782,7 +782,6 @@ getout:
}
int AgiEngine::saveGameDialog() {
- char fileName[MAXPATHLEN];
char *desc;
const char *buttons[] = { "Do as I say!", "I regret", NULL };
char dstr[200];
@@ -852,8 +851,8 @@ int AgiEngine::saveGameDialog() {
return errOK;
}
- sprintf(fileName, "%s", getSavegameFilename(_firstSlot + slot));
- debugC(8, kDebugLevelMain | kDebugLevelResources, "file is [%s]", fileName);
+ Common::String fileName = getSavegameFilename(_firstSlot + slot);
+ debugC(8, kDebugLevelMain | kDebugLevelResources, "file is [%s]", fileName.c_str());
// Make sure all graphics was blitted to screen. This fixes bug
// #2960567: "AGI: Ego partly erased in Load/Save thumbnails"
@@ -870,14 +869,15 @@ int AgiEngine::saveGameDialog() {
}
int AgiEngine::saveGameSimple() {
- int result = saveGame(getSavegameFilename(0), "Default savegame");
+ Common::String fileName = getSavegameFilename(0);
+
+ int result = saveGame(fileName, "Default savegame");
if (result != errOK)
messageBox("Error saving game.");
return result;
}
int AgiEngine::loadGameDialog() {
- char fileName[MAXPATHLEN];
int rc, slot = 0;
int hm, vm, hp, vp; // box margins
int w;
@@ -904,7 +904,7 @@ int AgiEngine::loadGameDialog() {
return errOK;
}
- sprintf(fileName, "%s", getSavegameFilename(_firstSlot + slot));
+ Common::String fileName = getSavegameFilename(_firstSlot + slot);
if ((rc = loadGame(fileName)) == errOK) {
messageBox("Game restored.");
@@ -918,10 +918,9 @@ int AgiEngine::loadGameDialog() {
}
int AgiEngine::loadGameSimple() {
- char fileName[MAXPATHLEN];
int rc = 0;
- sprintf(fileName, "%s", getSavegameFilename(0));
+ Common::String fileName = getSavegameFilename(0);
_sprites->eraseBoth();
_sound->stopSound();
@@ -980,12 +979,12 @@ void AgiEngine::releaseImageStack() {
void AgiEngine::checkQuickLoad() {
if (ConfMan.hasKey("save_slot")) {
- Common::String saveNameBuffer = Common::String::format("%s.%03d", _targetName.c_str(), ConfMan.getInt("save_slot"));
+ Common::String saveNameBuffer = getSavegameFilename(ConfMan.getInt("save_slot"));
_sprites->eraseBoth();
_sound->stopSound();
- if (loadGame(saveNameBuffer.c_str(), false) == errOK) { // Do not check game id
+ if (loadGame(saveNameBuffer, false) == errOK) { // Do not check game id
_game.exitAllLogics = 1;
_menu->enableAll();
}
@@ -993,8 +992,7 @@ void AgiEngine::checkQuickLoad() {
}
Common::Error AgiEngine::loadGameState(int slot) {
- char saveLoadSlot[12];
- sprintf(saveLoadSlot, "%s.%.3d", _targetName.c_str(), slot);
+ Common::String saveLoadSlot = getSavegameFilename(slot);
_sprites->eraseBoth();
_sound->stopSound();
@@ -1009,9 +1007,8 @@ Common::Error AgiEngine::loadGameState(int slot) {
}
Common::Error AgiEngine::saveGameState(int slot, const Common::String &desc) {
- char saveLoadSlot[12];
- sprintf(saveLoadSlot, "%s.%.3d", _targetName.c_str(), slot);
- if (saveGame(saveLoadSlot, desc.c_str()) == errOK)
+ Common::String saveLoadSlot = getSavegameFilename(slot);
+ if (saveGame(saveLoadSlot, desc) == errOK)
return Common::kNoError;
else
return Common::kUnknownError;
diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp
index cec0895073..8d13be3f68 100644
--- a/engines/agi/sprite.cpp
+++ b/engines/agi/sprite.cpp
@@ -702,6 +702,21 @@ void SpritesMgr::commitBlock(int x1, int y1, int x2, int y2, bool immediate) {
y1 = CLIP(y1, 0, _HEIGHT - 1);
y2 = CLIP(y2, 0, _HEIGHT - 1);
+ // Check if a window is active, and clip the block commited to exclude the
+ // window's contents. Fixes bug #3295652, and partially fixes bug #3080415.
+ AgiBlock &window = _vm->_game.window;
+ if (window.active) {
+ if (y1 < window.y2 && y2 > window.y2 && (x1 < window.x2 || x2 > window.x1)) {
+ // The top of the block covers the bottom of the window
+ y1 = window.y2;
+ }
+
+ if (y1 < window.y1 && y2 > window.y1 && (x1 < window.x2 || x2 > window.x1)) {
+ // The bottom of the block covers the top of the window
+ y2 = window.y1;
+ }
+ }
+
debugC(7, kDebugLevelSprites, "commitBlock(%d, %d, %d, %d)", x1, y1, x2, y2);
w = x2 - x1 + 1;
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index 82a2340ad6..502db4bdba 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -62,22 +62,18 @@ void AgiEngine::printText2(int l, const char *msg, int foff, int xoff, int yoff,
for (m = (const unsigned char *)msg, x1 = y1 = 0; *m; m++) {
- if (*m >= 0x20 || *m == 1 || *m == 2 || *m == 3) {
- // FIXME: Fingolfin asks: why is there a FIXME here? Please either clarify what
- // needs fixing, or remove it!
- // FIXME
- int ypos;
-
- ypos = (y1 * CHAR_LINES) + yoff;
+ // Note: there were extra checks for *m being a cursor character
+ // here (1, 2 or 3), which have been removed, as the cursor
+ // character is no longer printed via this function.
+ if (*m >= 0x20) {
+ int ypos = (y1 * CHAR_LINES) + yoff;
if ((x1 != (len - 1) || x1 == 39) && (ypos <= (GFX_HEIGHT - CHAR_LINES))) {
- int xpos;
-
- xpos = (x1 * CHAR_COLS) + xoff + foff;
+ int xpos = (x1 * CHAR_COLS) + xoff + foff;
if (xpos >= GFX_WIDTH)
continue;
-
+
_gfx->putTextCharacter(l, xpos, ypos, *m, fg, bg, checkerboard);
if (x1 > maxx)
@@ -88,15 +84,17 @@ void AgiEngine::printText2(int l, const char *msg, int foff, int xoff, int yoff,
x1++;
- // DF: changed the len-1 to len...
- // FIXME: m[len] doesn't make sense and may read out of bounds?
- if (x1 == len && m[len] != '\n') {
+ // Change line if we've reached the end of this one, unless the next
+ // character is a new line itself, or the end of the string
+ if (x1 == len && m[1] != '\n' && m[1] != 0) {
y1++;
x1 = foff = 0;
}
} else {
- y1++;
- x1 = foff = 0;
+ if (m[1] != 0) {
+ y1++;
+ x1 = foff = 0;
+ }
}
}
}
@@ -223,14 +221,17 @@ void AgiEngine::printTextConsole(const char *msg, int x, int y, int len, int fg,
* @param str String to wrap.
* @param len Length of line.
*
- * Based on GBAGI implementaiton with permission from the author
+ * Based on GBAGI implementation with permission from the author
*/
char *AgiEngine::wordWrapString(const char *s, int *len) {
char *outStr, *msgBuf, maxWidth = *len;
const char *pWord;
int lnLen, wLen;
- msgBuf = outStr = strdup(s);
+ // Allocate some extra space for the final buffer, as
+ // outStr may end up being longer than s
+ // 26 = 200 (screen height) / 8 (font height) + 1
+ msgBuf = outStr = (char *)malloc(strlen(s) + 26);
int msgWidth = 0;
@@ -249,6 +250,8 @@ char *AgiEngine::wordWrapString(const char *s, int *len) {
wLen--;
if (wLen + lnLen >= maxWidth) {
+ // Check if outStr isn't msgBuf. If this is the case, outStr hasn't advanced
+ // yet, so no output has been written yet
if (outStr != msgBuf) {
if (outStr[-1] == ' ')
outStr[-1] = '\n';
@@ -438,12 +441,6 @@ int AgiEngine::print(const char *p, int lin, int col, int len) {
debugC(4, kDebugLevelText, "print(): lin = %d, col = %d, len = %d", lin, col, len);
- if (col == 0 && lin == 0 && len == 0)
- lin = col = -1;
-
- if (len == 0)
- len = 30;
-
blitTextbox(p, lin, col, len);
if (getflag(fOutputMode)) {
@@ -675,11 +672,11 @@ void AgiEngine::writePrompt() {
_gfx->doUpdate();
}
-void AgiEngine::clearPrompt() {
+void AgiEngine::clearPrompt(bool useBlackBg) {
int l;
l = _game.lineUserInput;
- clearLines(l, l, _game.colorBg);
+ clearLines(l, l, useBlackBg ? 0 : _game.colorBg);
flushLines(l, l);
_gfx->doUpdate();
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 97c594684c..73a37e42ef 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -41,18 +41,51 @@
namespace AGOS {
static const GameSpecificSettings simon1_settings = {
+ "", // base_filename
+ "", // restore_filename
+ "", // tbl_filename
"EFFECTS", // effects_filename
"SIMON", // speech_filename
};
static const GameSpecificSettings simon2_settings = {
+ "", // base_filename
+ "", // restore_filename
+ "", // tbl_filename
"", // effects_filename
"SIMON2", // speech_filename
};
-static const GameSpecificSettings puzzlepack_settings = {
+static const GameSpecificSettings dimp_settings = {
+ "Gdimp", // base_filename
+ "", // restore_filename
+ "", // tbl_filename
"", // effects_filename
- "MUSIC", // speech_filename
+ "MUSIC", // speech_filename
+};
+
+static const GameSpecificSettings jumble_settings = {
+ "Gjumble", // base_filename
+ "", // restore_filename
+ "", // tbl_filename
+ "", // effects_filename
+ "MUSIC", // speech_filename
+};
+
+static const GameSpecificSettings puzzle_settings = {
+ "Gpuzzle", // base_filename
+ "", // restore_filename
+ "", // tbl_filename
+ "", // effects_filename
+ "MUSIC", // speech_filename
+};
+
+static const GameSpecificSettings swampy_settings = {
+ "Gswampy", // base_filename
+ "", // restore_filename
+ "", // tbl_filename
+ "", // effects_filename
+ "MUSIC", // speech_filename
};
#ifdef ENABLE_AGOS2
@@ -132,6 +165,7 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd)
_numMusic = 0;
_numSFX = 0;
_numSpeech = 0;
+ _numZone = 0;
_numBitArray1 = 0;
_numBitArray2 = 0;
@@ -678,7 +712,15 @@ static const uint16 initialVideoWindows_PN[20] = {
#ifdef ENABLE_AGOS2
void AGOSEngine_PuzzlePack::setupGame() {
- gss = &puzzlepack_settings;
+ if (getGameId() == GID_DIMP) {
+ gss = &dimp_settings;
+ } else if (getGameId() == GID_JUMBLE) {
+ gss = &jumble_settings;
+ } else if (getGameId() == GID_PUZZLE) {
+ gss = &puzzle_settings;
+ } else if (getGameId() == GID_SWAMPY) {
+ gss = &swampy_settings;
+ }
_numVideoOpcodes = 85;
_vgaMemSize = 7500000;
_itemMemSize = 20000;
@@ -691,6 +733,8 @@ void AGOSEngine_PuzzlePack::setupGame() {
_numTextBoxes = 40;
_numVars = 2048;
+ _numZone = 450;
+
AGOSEngine::setupGame();
}
#endif
@@ -725,6 +769,7 @@ void AGOSEngine_Simon2::setupGame() {
_numMusic = 93;
_numSFX = 222;
_numSpeech = 11997;
+ _numZone = 140;
AGOSEngine::setupGame();
}
@@ -751,6 +796,7 @@ void AGOSEngine_Simon1::setupGame() {
_numMusic = 34;
_numSFX = 127;
_numSpeech = 3623;
+ _numZone = 164;
AGOSEngine::setupGame();
}
@@ -771,6 +817,7 @@ void AGOSEngine_Waxworks::setupGame() {
_numVars = 255;
_numMusic = 26;
+ _numZone = 155;
AGOSEngine::setupGame();
}
@@ -790,6 +837,7 @@ void AGOSEngine_Elvira2::setupGame() {
_numVars = 255;
_numMusic = 9;
+ _numZone = 99;
AGOSEngine::setupGame();
}
@@ -806,6 +854,7 @@ void AGOSEngine_Elvira1::setupGame() {
_numVars = 512;
_numMusic = 14;
+ _numZone = 74;
AGOSEngine::setupGame();
}
@@ -819,6 +868,8 @@ void AGOSEngine_PN::setupGame() {
_vgaPeriod = 50;
_numVars = 256;
+ _numZone = 26;
+
AGOSEngine::setupGame();
}
@@ -963,6 +1014,10 @@ void AGOSEngine::pause() {
}
Common::Error AGOSEngine::go() {
+#ifdef ENABLE_AGOS2
+ loadArchives();
+#endif
+
loadGamePcFile();
addTimeEvent(0, 1);
diff --git a/engines/agos/agos.h b/engines/agos/agos.h
index 820bc0260b..cf75842cdd 100644
--- a/engines/agos/agos.h
+++ b/engines/agos/agos.h
@@ -25,6 +25,7 @@
#include "engines/engine.h"
+#include "common/archive.h"
#include "common/array.h"
#include "common/error.h"
#include "common/keyboard.h"
@@ -186,6 +187,22 @@ class Debugger;
# define _OPCODE(ver, x) { &ver::x, "" }
#endif
+class ArchiveMan : public Common::SearchSet {
+public:
+ ArchiveMan();
+
+ void enableFallback(bool val) { _fallBack = val; }
+
+#ifdef ENABLE_AGOS2
+ void registerArchive(const Common::String &filename, int priority);
+#endif
+
+ Common::SeekableReadStream *open(const Common::String &filename);
+
+private:
+ bool _fallBack;
+};
+
class AGOSEngine : public Engine {
protected:
friend class Debugger;
@@ -240,6 +257,7 @@ protected:
uint8 _numMusic, _numSFX;
uint16 _numSpeech;
+ uint16 _numZone;
uint8 _numBitArray1, _numBitArray2, _numBitArray3, _numItemStore;
uint16 _numVars;
@@ -599,6 +617,8 @@ public:
AGOSEngine(OSystem *system, const AGOSGameDescription *gd);
virtual ~AGOSEngine();
+ ArchiveMan _archives;
+
byte *_curSfxFile;
uint32 _curSfxFileSize;
uint16 _sampleEnd, _sampleWait;
@@ -608,6 +628,10 @@ protected:
virtual uint16 readUint16Wrapper(const void *src);
virtual uint32 readUint32Wrapper(const void *src);
+#ifdef ENABLE_AGOS2
+ void loadArchives();
+#endif
+
int allocGamePcVars(Common::SeekableReadStream *in);
void createPlayer();
void allocateStringTable(int num);
@@ -792,14 +816,14 @@ protected:
void loadTextIntoMem(uint16 stringId);
uint loadTextFile(const char *filename, byte *dst);
- Common::File *openTablesFile(const char *filename);
- void closeTablesFile(Common::File *in);
+ Common::SeekableReadStream *openTablesFile(const char *filename);
+ void closeTablesFile(Common::SeekableReadStream *in);
uint loadTextFile_simon1(const char *filename, byte *dst);
- Common::File *openTablesFile_simon1(const char *filename);
+ Common::SeekableReadStream *openTablesFile_simon1(const char *filename);
uint loadTextFile_gme(const char *filename, byte *dst);
- Common::File *openTablesFile_gme(const char *filename);
+ Common::SeekableReadStream *openTablesFile_gme(const char *filename);
void invokeTimeEvent(TimeEvent *te);
bool kickoffTimeEvents();
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index d9a585bd05..d9d6b71a2a 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -137,7 +137,7 @@ void MoviePlayer::handleNextFrame() {
// Movie player for DXA movies
///////////////////////////////////////////////////////////////////////////////
-const char * MoviePlayerDXA::_sequenceList[90] = {
+const char *const MoviePlayerDXA::_sequenceList[90] = {
"agent32",
"Airlock",
"Badluck",
@@ -251,8 +251,11 @@ bool MoviePlayerDXA::load() {
}
Common::String videoName = Common::String::format("%s.dxa", baseName);
- if (!loadFile(videoName))
+ Common::SeekableReadStream *videoStream = _vm->_archives.open(videoName);
+ if (!videoStream)
error("Failed to load video file %s", videoName.c_str());
+ if (!loadStream(videoStream))
+ error("Failed to load video stream from file %s", videoName.c_str());
debug(0, "Playing video %s", videoName.c_str());
@@ -412,8 +415,11 @@ MoviePlayerSMK::MoviePlayerSMK(AGOSEngine_Feeble *vm, const char *name)
bool MoviePlayerSMK::load() {
Common::String videoName = Common::String::format("%s.smk", baseName);
- if (!loadFile(videoName))
+ Common::SeekableReadStream *videoStream = _vm->_archives.open(videoName);
+ if (!videoStream)
error("Failed to load video file %s", videoName.c_str());
+ if (!loadStream(videoStream))
+ error("Failed to load video stream from file %s", videoName.c_str());
debug(0, "Playing video %s", videoName.c_str());
diff --git a/engines/agos/animation.h b/engines/agos/animation.h
index e1d7207251..11936aa338 100644
--- a/engines/agos/animation.h
+++ b/engines/agos/animation.h
@@ -73,7 +73,7 @@ protected:
};
class MoviePlayerDXA : public MoviePlayer, Video::DXADecoder {
- static const char *_sequenceList[90];
+ static const char *const _sequenceList[90];
uint8 _sequenceNum;
public:
MoviePlayerDXA(AGOSEngine_Feeble *vm, const char *name);
diff --git a/engines/agos/debug.cpp b/engines/agos/debug.cpp
index 18c4736031..841ac6bb1a 100644
--- a/engines/agos/debug.cpp
+++ b/engines/agos/debug.cpp
@@ -297,20 +297,18 @@ void AGOSEngine::dumpVgaScriptAlways(const byte *ptr, uint16 res, uint16 id) {
}
void AGOSEngine::dumpAllVgaImageFiles() {
- uint8 start = (getGameType() == GType_PN) ? 0 : 2;
- uint16 end = (getGameType() == GType_PN) ? 26 : 450;
+ const uint8 start = (getGameType() == GType_PN) ? 0 : 2;
- for (int z = start; z < end; z++) {
+ for (int z = start; z < _numZone; z++) {
loadZone(z, false);
dumpVgaBitmaps(z);
}
}
void AGOSEngine::dumpAllVgaScriptFiles() {
- uint8 start = (getGameType() == GType_PN) ? 0 : 2;
- uint16 end = (getGameType() == GType_PN) ? 26 : 450;
+ const uint8 start = (getGameType() == GType_PN) ? 0 : 2;
- for (int z = start; z < end; z++) {
+ for (int z = start; z < _numZone; z++) {
uint16 zoneNum = (getGameType() == GType_PN) ? 0 : z;
loadZone(z, false);
@@ -516,7 +514,7 @@ void AGOSEngine::dumpBitmap(const char *filename, const byte *offs, uint16 w, ui
dst += w;
src += w;
}
- } else if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) && w == 320 && (h == 134 || h == 200)) {
+ } else if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) && w == 320 && (h == 134 || h == 135 || h == 200)) {
for (j = 0; j != h; j++) {
uint16 count = w / 8;
@@ -620,7 +618,7 @@ void AGOSEngine::palLoad(byte *pal, const byte *vga1, int a, int b) {
void AGOSEngine::dumpVgaBitmaps(uint16 zoneNum) {
uint16 width, height, flags;
- uint32 offs, curOffs = 0;
+ uint32 offs, offsEnd;
const byte *p2;
byte pal[768];
@@ -636,7 +634,11 @@ void AGOSEngine::dumpVgaBitmaps(uint16 zoneNum) {
memset(pal, 0, sizeof(pal));
palLoad(pal, vga1, 0, 0);
- for (int i = 1; ; i++) {
+ offsEnd = readUint32Wrapper(vga2 + 8);
+ for (uint i = 1; ; i++) {
+ if ((i * 8) >= offsEnd)
+ break;
+
p2 = vga2 + i * 8;
offs = readUint32Wrapper(p2);
@@ -650,10 +652,8 @@ void AGOSEngine::dumpVgaBitmaps(uint16 zoneNum) {
}
debug(1, "Zone %d: Image %d. Offs= %d Width=%d, Height=%d, Flags=0x%X", zoneNum, i, offs, width, height, flags);
- if (offs < curOffs || offs >= imageBlockSize || width == 0 || height == 0)
- return;
-
- curOffs = offs;
+ if (offs >= imageBlockSize || width == 0 || height == 0)
+ break;
/* dump bitmap */
char buf[40];
diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp
index 2be888b92a..116e66820a 100644
--- a/engines/agos/detection.cpp
+++ b/engines/agos/detection.cpp
@@ -83,7 +83,7 @@ static const PlainGameDescriptor agosGames[] = {
#include "agos/detection_tables.h"
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"execute", // Used by Simon1 Acorn CD
0
};
@@ -240,6 +240,22 @@ Common::Platform AGOSEngine::getPlatform() const {
}
const char *AGOSEngine::getFileName(int type) const {
+ // Required if the InstallShield cab is been used
+ if (getGameType() == GType_PP) {
+ if (type == GAME_BASEFILE)
+ return gss->base_filename;
+ }
+
+ // Required if the InstallShield cab is been used
+ if (getGameType() == GType_FF && getPlatform() == Common::kPlatformWindows) {
+ if (type == GAME_BASEFILE)
+ return gss->base_filename;
+ if (type == GAME_RESTFILE)
+ return gss->restore_filename;
+ if (type == GAME_TBLFILE)
+ return gss->tbl_filename;
+ }
+
for (int i = 0; _gameDescription->desc.filesDescriptions[i].fileType; i++) {
if (_gameDescription->desc.filesDescriptions[i].fileType == type)
return _gameDescription->desc.filesDescriptions[i].fileName;
@@ -247,4 +263,17 @@ const char *AGOSEngine::getFileName(int type) const {
return NULL;
}
+#ifdef ENABLE_AGOS2
+void AGOSEngine::loadArchives() {
+ const ADGameFileDescription *ag;
+
+ if (getFeatures() & GF_PACKED) {
+ for (ag = _gameDescription->desc.filesDescriptions; ag->fileName; ag++) {
+ if (!_archives.hasArchive(ag->fileName))
+ _archives.registerArchive(ag->fileName, ag->fileType);
+ }
+ }
+}
+#endif
+
} // End of namespace AGOS
diff --git a/engines/agos/detection_tables.h b/engines/agos/detection_tables.h
index d9f321d98e..a7a384a496 100644
--- a/engines/agos/detection_tables.h
+++ b/engines/agos/detection_tables.h
@@ -2519,6 +2519,27 @@ static const AGOSGameDescription gameDescriptions[] = {
GF_OLD_BUNDLE | GF_ZLIBCOMP | GF_TALKIE
},
+ // The Feeble Files - English Windows 2CD (with InstallShield cab)
+ {
+ {
+ "feeble",
+ "2CD",
+
+ {
+ { "data1.cab", 0, "600db08891e7a21badc8215e604cd88f", 28845430},
+ { NULL, 0, NULL, 0}
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ },
+
+ GType_FF,
+ GID_FEEBLEFILES,
+ GF_OLD_BUNDLE | GF_TALKIE | GF_PACKED
+ },
+
// The Feeble Files - English Windows 2CD
{
{
@@ -2565,6 +2586,27 @@ static const AGOSGameDescription gameDescriptions[] = {
GF_OLD_BUNDLE | GF_TALKIE
},
+ // The Feeble Files - English Windows 4CD (with InstallShield cab)
+ {
+ {
+ "feeble",
+ "4CD",
+
+ {
+ { "data1.cab", 0, "65804cbc9036ac4b1275d97e0de3be2f", 28943062},
+ { NULL, 0, NULL, 0}
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ },
+
+ GType_FF,
+ GID_FEEBLEFILES,
+ GF_OLD_BUNDLE | GF_TALKIE | GF_PACKED
+ },
+
// The Feeble Files - English Windows 4CD
{
{
@@ -2703,6 +2745,27 @@ static const AGOSGameDescription gameDescriptions[] = {
GF_OLD_BUNDLE | GF_TALKIE
},
+ // Simon the Sorcerer's Puzzle Pack - Demon in my Pocket (with InstallShield cab)
+ {
+ {
+ "dimp",
+ "CD",
+
+ {
+ { "data1.cab", 0, "36dd86c1d872cea81ac1de7753dd684a", 40394693},
+ { NULL, 0, NULL, 0}
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO_NOSUBTITLES | GUIO_NOMUSIC
+ },
+
+ GType_PP,
+ GID_DIMP,
+ GF_OLD_BUNDLE | GF_TALKIE | GF_PACKED
+ },
+
// Simon the Sorcerer's Puzzle Pack - Demon in my Pocket
{
{
@@ -2724,6 +2787,27 @@ static const AGOSGameDescription gameDescriptions[] = {
GF_OLD_BUNDLE | GF_TALKIE
},
+ // Simon the Sorcerer's Puzzle Pack - Jumble (with InstallShield cab)
+ {
+ {
+ "jumble",
+ "CD",
+
+ {
+ { "data1.cab", 0, "36dd86c1d872cea81ac1de7753dd684a", 40394693},
+ { NULL, 0, NULL, 0}
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO_NOSUBTITLES
+ },
+
+ GType_PP,
+ GID_JUMBLE,
+ GF_OLD_BUNDLE | GF_TALKIE | GF_PACKED
+ },
+
// Simon the Sorcerer's Puzzle Pack - Jumble
{
{
@@ -2745,6 +2829,27 @@ static const AGOSGameDescription gameDescriptions[] = {
GF_OLD_BUNDLE | GF_TALKIE
},
+ // Simon the Sorcerer's Puzzle Pack - NoPatience (with InstallShield cab)
+ {
+ {
+ "puzzle",
+ "CD",
+
+ {
+ { "data1.cab", 0, "36dd86c1d872cea81ac1de7753dd684a", 40394693},
+ { NULL, 0, NULL, 0}
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO_NOSUBTITLES
+ },
+
+ GType_PP,
+ GID_PUZZLE,
+ GF_OLD_BUNDLE | GF_TALKIE | GF_PACKED
+ },
+
// Simon the Sorcerer's Puzzle Pack - NoPatience
{
{
@@ -2766,6 +2871,27 @@ static const AGOSGameDescription gameDescriptions[] = {
GF_OLD_BUNDLE | GF_TALKIE
},
+ // Simon the Sorcerer's Puzzle Pack - Swampy Adventures - English (with InstallShield cab)
+ {
+ {
+ "swampy",
+ "CD",
+
+ {
+ { "data1.cab", 0, "36dd86c1d872cea81ac1de7753dd684a", 40394693},
+ { NULL, 0, NULL, 0}
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO_NOSUBTITLES
+ },
+
+ GType_PP,
+ GID_SWAMPY,
+ GF_OLD_BUNDLE | GF_TALKIE | GF_PACKED
+ },
+
// Simon the Sorcerer's Puzzle Pack - Swampy Adventures - English
{
{
diff --git a/engines/agos/feeble.cpp b/engines/agos/feeble.cpp
index 4c82b7e19d..4608969667 100644
--- a/engines/agos/feeble.cpp
+++ b/engines/agos/feeble.cpp
@@ -45,6 +45,9 @@ AGOSEngine_Feeble::~AGOSEngine_Feeble() {
}
static const GameSpecificSettings feeblefiles_settings = {
+ "game22", // base_filename
+ "save.999", // restore_filename
+ "tbllist", // tbl_filename
"", // effects_filename
"VOICES", // speech_filename
};
@@ -66,6 +69,7 @@ void AGOSEngine_Feeble::setupGame() {
_numVars = 255;
_numSpeech = 10000;
+ _numZone = 450;
AGOSEngine::setupGame();
}
diff --git a/engines/agos/installshield_cab.cpp b/engines/agos/installshield_cab.cpp
new file mode 100644
index 0000000000..f7b49a64c5
--- /dev/null
+++ b/engines/agos/installshield_cab.cpp
@@ -0,0 +1,221 @@
+/* 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.
+ *
+ */
+
+// The following code is based on unshield
+// Original copyright:
+
+// Copyright (c) 2003 David Eriksson <twogood@users.sourceforge.net>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of
+// this software and associated documentation files (the "Software"), to deal in
+// the Software without restriction, including without limitation the rights to
+// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+// of the Software, and to permit persons to whom the Software is furnished to do
+// so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in all
+// copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+// SOFTWARE.
+
+#include "agos/installshield_cab.h"
+
+#include "common/debug.h"
+#include "common/file.h"
+#include "common/memstream.h"
+#include "common/zlib.h"
+
+namespace AGOS {
+
+class InstallShieldCabinet : public Common::Archive {
+ Common::String _installShieldFilename;
+
+public:
+ InstallShieldCabinet(const Common::String &filename);
+ ~InstallShieldCabinet();
+
+ // Common::Archive API implementation
+ bool hasFile(const Common::String &name);
+ int listMembers(Common::ArchiveMemberList &list);
+ Common::ArchiveMemberPtr getMember(const Common::String &name);
+ Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
+
+private:
+ struct FileEntry {
+ uint32 uncompressedSize;
+ uint32 compressedSize;
+ uint32 offset;
+ uint16 flags;
+ };
+
+ typedef Common::HashMap<Common::String, FileEntry, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> FileMap;
+ FileMap _map;
+};
+
+InstallShieldCabinet::~InstallShieldCabinet() {
+ _map.clear();
+}
+
+InstallShieldCabinet::InstallShieldCabinet(const Common::String &filename) : _installShieldFilename(filename) {
+ Common::File installShieldFile;
+
+ if (!installShieldFile.open(_installShieldFilename)) {
+ warning("InstallShieldCabinet::InstallShieldCabinet(): Could not find the archive file %s", _installShieldFilename.c_str());
+ return;
+ }
+
+ // Note that we only support a limited subset of cabinet files
+ // Only single cabinet files and ones without data shared between
+ // cabinets.
+
+ // Check for the magic uint32
+ if (installShieldFile.readUint32LE() != 0x28635349) {
+ warning("InstallShieldCabinet::InstallShieldCabinet(): Magic ID doesn't match");
+ return;
+ }
+
+ uint32 version = installShieldFile.readUint32LE();
+
+ if (version != 0x01000004) {
+ warning("Unsupported CAB version %08x", version);
+ return;
+ }
+
+ /* uint32 volumeInfo = */ installShieldFile.readUint32LE();
+ uint32 cabDescriptorOffset = installShieldFile.readUint32LE();
+ /* uint32 cabDescriptorSize = */ installShieldFile.readUint32LE();
+
+ installShieldFile.seek(cabDescriptorOffset);
+
+ installShieldFile.skip(12);
+ uint32 fileTableOffset = installShieldFile.readUint32LE();
+ installShieldFile.skip(4);
+ uint32 fileTableSize = installShieldFile.readUint32LE();
+ uint32 fileTableSize2 = installShieldFile.readUint32LE();
+ uint32 directoryCount = installShieldFile.readUint32LE();
+ installShieldFile.skip(8);
+ uint32 fileCount = installShieldFile.readUint32LE();
+
+ if (fileTableSize != fileTableSize2)
+ warning("file table sizes do not match");
+
+ // We're ignoring file groups and components since we
+ // should not need them. Moving on to the files...
+
+ installShieldFile.seek(cabDescriptorOffset + fileTableOffset);
+ uint32 fileTableCount = directoryCount + fileCount;
+ uint32 *fileTableOffsets = new uint32[fileTableCount];
+ for (uint32 i = 0; i < fileTableCount; i++)
+ fileTableOffsets[i] = installShieldFile.readUint32LE();
+
+ for (uint32 i = directoryCount; i < fileCount + directoryCount; i++) {
+ installShieldFile.seek(cabDescriptorOffset + fileTableOffset + fileTableOffsets[i]);
+ uint32 nameOffset = installShieldFile.readUint32LE();
+ /* uint32 directoryIndex = */ installShieldFile.readUint32LE();
+
+ // First read in data needed by us to get at the file data
+ FileEntry entry;
+ entry.flags = installShieldFile.readUint16LE();
+ entry.uncompressedSize = installShieldFile.readUint32LE();
+ entry.compressedSize = installShieldFile.readUint32LE();
+ installShieldFile.skip(20);
+ entry.offset = installShieldFile.readUint32LE();
+
+ // Then let's get the string
+ installShieldFile.seek(cabDescriptorOffset + fileTableOffset + nameOffset);
+ Common::String fileName;
+
+ char c = installShieldFile.readByte();
+ while (c) {
+ fileName += c;
+ c = installShieldFile.readByte();
+ }
+ _map[fileName] = entry;
+ }
+
+ delete[] fileTableOffsets;
+}
+
+bool InstallShieldCabinet::hasFile(const Common::String &name) {
+ warning("hasFile: Filename %s", name.c_str());
+ return _map.contains(name);
+}
+
+int InstallShieldCabinet::listMembers(Common::ArchiveMemberList &list) {
+ for (FileMap::const_iterator it = _map.begin(); it != _map.end(); it++)
+ list.push_back(getMember(it->_key));
+
+ return _map.size();
+}
+
+Common::ArchiveMemberPtr InstallShieldCabinet::getMember(const Common::String &name) {
+ return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
+}
+
+Common::SeekableReadStream *InstallShieldCabinet::createReadStreamForMember(const Common::String &name) const {
+ if (!_map.contains(name))
+ return 0;
+
+ const FileEntry &entry = _map[name];
+
+ Common::File archiveFile;
+ archiveFile.open(_installShieldFilename);
+ archiveFile.seek(entry.offset);
+
+ if (!(entry.flags & 0x04)) {
+ // Not compressed
+ return archiveFile.readStream(entry.uncompressedSize);
+ }
+
+#ifdef USE_ZLIB
+ byte *src = (byte *)malloc(entry.compressedSize);
+ byte *dst = (byte *)malloc(entry.uncompressedSize);
+
+ archiveFile.read(src, entry.compressedSize);
+
+ bool result = Common::inflateZlibHeaderless(dst, entry.uncompressedSize, src, entry.compressedSize);
+ free(src);
+
+ if (!result) {
+ warning("failed to inflate CAB file '%s'", name.c_str());
+ free(dst);
+ return 0;
+ }
+
+ return new Common::MemoryReadStream(dst, entry.uncompressedSize, DisposeAfterUse::YES);
+#else
+ warning("zlib required to extract compressed CAB file '%s'", name.c_str());
+ return 0;
+#endif
+}
+
+Common::Archive *makeInstallShieldArchive(const Common::String &name) {
+ return new InstallShieldCabinet(name);
+}
+
+} // End of namespace AGOS
diff --git a/engines/agos/installshield_cab.h b/engines/agos/installshield_cab.h
new file mode 100644
index 0000000000..f7e8bed277
--- /dev/null
+++ b/engines/agos/installshield_cab.h
@@ -0,0 +1,41 @@
+/* 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 "common/archive.h"
+#include "common/str.h"
+
+#ifndef AGOS_INSTALLSHIELD_CAB_H
+#define AGOS_INSTALLSHIELD_CAB_H
+
+namespace AGOS {
+
+/**
+ * This factory method creates an Archive instance corresponding to the content
+ * of the InstallShield compressed file with the given name.
+ *
+ * May return 0 in case of a failure.
+ */
+Common::Archive *makeInstallShieldArchive(const Common::String &name);
+
+} // End of namespace AGOS
+
+#endif
diff --git a/engines/agos/intern.h b/engines/agos/intern.h
index 18f56be4a4..773b9c15bd 100644
--- a/engines/agos/intern.h
+++ b/engines/agos/intern.h
@@ -193,6 +193,9 @@ struct TimeEvent {
};
struct GameSpecificSettings {
+ const char *base_filename;
+ const char *restore_filename;
+ const char *tbl_filename;
const char *effects_filename;
const char *speech_filename;
};
@@ -251,7 +254,8 @@ enum GameFeatures {
GF_32COLOR = 1 << 5,
GF_EGA = 1 << 6,
GF_PLANAR = 1 << 7,
- GF_DEMO = 1 << 8
+ GF_DEMO = 1 << 8,
+ GF_PACKED = 1 << 9
};
enum GameFileTypes {
diff --git a/engines/agos/midi.cpp b/engines/agos/midi.cpp
index 9a93e0a273..431f080bf2 100644
--- a/engines/agos/midi.cpp
+++ b/engines/agos/midi.cpp
@@ -62,6 +62,7 @@ MidiPlayer::~MidiPlayer() {
Common::StackLock lock(_mutex);
if (_driver) {
+ _driver->setTimerCallback(0, 0);
_driver->close();
delete _driver;
}
diff --git a/engines/agos/module.mk b/engines/agos/module.mk
index 7069d8005b..7ae5e17bf2 100644
--- a/engines/agos/module.mk
+++ b/engines/agos/module.mk
@@ -51,6 +51,7 @@ ifdef ENABLE_AGOS2
MODULE_OBJS += \
animation.o \
feeble.o \
+ installshield_cab.o \
oracle.o \
script_dp.o \
script_ff.o \
diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp
index a71d4d8150..69447f4b83 100644
--- a/engines/agos/res.cpp
+++ b/engines/agos/res.cpp
@@ -31,11 +31,30 @@
#include "agos/agos.h"
#include "agos/intern.h"
#include "agos/sound.h"
+#include "agos/installshield_cab.h"
#include "common/zlib.h"
namespace AGOS {
+ArchiveMan::ArchiveMan() {
+ _fallBack = true;
+}
+
+#ifdef ENABLE_AGOS2
+void ArchiveMan::registerArchive(const Common::String &filename, int priority) {
+ add(filename, makeInstallShieldArchive(filename), priority);
+}
+#endif
+
+Common::SeekableReadStream *ArchiveMan::open(const Common::String &filename) {
+ if (_fallBack && SearchMan.hasFile(filename)) {
+ return SearchMan.createReadStreamForMember(filename);
+ }
+
+ return createReadStreamForMember(filename);
+}
+
#ifdef ENABLE_AGOS2
uint16 AGOSEngine_Feeble::to16Wrapper(uint value) {
return TO_LE_16(value);
@@ -150,21 +169,21 @@ int AGOSEngine::allocGamePcVars(Common::SeekableReadStream *in) {
}
void AGOSEngine_PN::loadGamePcFile() {
- Common::File in;
+ Common::SeekableReadStream *in;
if (getFileName(GAME_BASEFILE) != NULL) {
// Read dataBase
- in.open(getFileName(GAME_BASEFILE));
- if (in.isOpen() == false) {
+ in = _archives.open(getFileName(GAME_BASEFILE));
+ if (!in) {
error("loadGamePcFile: Can't load database file '%s'", getFileName(GAME_BASEFILE));
}
- _dataBaseSize = in.size();
+ _dataBaseSize = in->size();
_dataBase = (byte *)malloc(_dataBaseSize);
if (_dataBase == NULL)
error("loadGamePcFile: Out of memory for dataBase");
- in.read(_dataBase, _dataBaseSize);
- in.close();
+ in->read(_dataBase, _dataBaseSize);
+ delete in;
if (_dataBase[31] != 0)
error("Later version of system requested");
@@ -172,17 +191,17 @@ void AGOSEngine_PN::loadGamePcFile() {
if (getFileName(GAME_TEXTFILE) != NULL) {
// Read textBase
- in.open(getFileName(GAME_TEXTFILE));
- if (in.isOpen() == false) {
+ in = _archives.open(getFileName(GAME_TEXTFILE));
+ if (!in) {
error("loadGamePcFile: Can't load textbase file '%s'", getFileName(GAME_TEXTFILE));
}
- _textBaseSize = in.size();
+ _textBaseSize = in->size();
_textBase = (byte *)malloc(_textBaseSize);
if (_textBase == NULL)
error("loadGamePcFile: Out of memory for textBase");
- in.read(_textBase, _textBaseSize);
- in.close();
+ in->read(_textBase, _textBaseSize);
+ delete in;
if (_textBase[getlong(30L)] != 128)
error("Unknown compression format");
@@ -190,20 +209,20 @@ void AGOSEngine_PN::loadGamePcFile() {
}
void AGOSEngine::loadGamePcFile() {
- Common::File in;
+ Common::SeekableReadStream *in;
int fileSize;
if (getFileName(GAME_BASEFILE) != NULL) {
/* Read main gamexx file */
- in.open(getFileName(GAME_BASEFILE));
- if (in.isOpen() == false) {
+ in = _archives.open(getFileName(GAME_BASEFILE));
+ if (!in) {
error("loadGamePcFile: Can't load gamexx file '%s'", getFileName(GAME_BASEFILE));
}
if (getFeatures() & GF_CRUNCHED_GAMEPC) {
- uint srcSize = in.size();
+ uint srcSize = in->size();
byte *srcBuf = (byte *)malloc(srcSize);
- in.read(srcBuf, srcSize);
+ in->read(srcBuf, srcSize);
uint dstSize = READ_BE_UINT32(srcBuf + srcSize - 4);
byte *dstBuf = (byte *)malloc(dstSize);
@@ -214,25 +233,25 @@ void AGOSEngine::loadGamePcFile() {
readGamePcFile(&stream);
free(dstBuf);
} else {
- readGamePcFile(&in);
+ readGamePcFile(in);
}
- in.close();
+ delete in;
}
if (getFileName(GAME_TBLFILE) != NULL) {
/* Read list of TABLE resources */
- in.open(getFileName(GAME_TBLFILE));
- if (in.isOpen() == false) {
+ in = _archives.open(getFileName(GAME_TBLFILE));
+ if (!in) {
error("loadGamePcFile: Can't load table resources file '%s'", getFileName(GAME_TBLFILE));
}
- fileSize = in.size();
+ fileSize = in->size();
_tblList = (byte *)malloc(fileSize);
if (_tblList == NULL)
error("loadGamePcFile: Out of memory for strip table list");
- in.read(_tblList, fileSize);
- in.close();
+ in->read(_tblList, fileSize);
+ delete in;
/* Remember the current state */
_subroutineListOrg = _subroutineList;
@@ -242,71 +261,71 @@ void AGOSEngine::loadGamePcFile() {
if (getFileName(GAME_STRFILE) != NULL) {
/* Read list of TEXT resources */
- in.open(getFileName(GAME_STRFILE));
- if (in.isOpen() == false)
+ in = _archives.open(getFileName(GAME_STRFILE));
+ if (!in)
error("loadGamePcFile: Can't load text resources file '%s'", getFileName(GAME_STRFILE));
- fileSize = in.size();
+ fileSize = in->size();
_strippedTxtMem = (byte *)malloc(fileSize);
if (_strippedTxtMem == NULL)
error("loadGamePcFile: Out of memory for strip text list");
- in.read(_strippedTxtMem, fileSize);
- in.close();
+ in->read(_strippedTxtMem, fileSize);
+ delete in;
}
if (getFileName(GAME_STATFILE) != NULL) {
/* Read list of ROOM STATE resources */
- in.open(getFileName(GAME_STATFILE));
- if (in.isOpen() == false) {
+ in = _archives.open(getFileName(GAME_STATFILE));
+ if (!in) {
error("loadGamePcFile: Can't load state resources file '%s'", getFileName(GAME_STATFILE));
}
- _numRoomStates = in.size() / 8;
+ _numRoomStates = in->size() / 8;
_roomStates = (RoomState *)calloc(_numRoomStates, sizeof(RoomState));
if (_roomStates == NULL)
error("loadGamePcFile: Out of memory for room state list");
for (uint s = 0; s < _numRoomStates; s++) {
- uint16 num = in.readUint16BE() - (_itemArrayInited - 2);
+ uint16 num = in->readUint16BE() - (_itemArrayInited - 2);
- _roomStates[num].state = in.readUint16BE();
- _roomStates[num].classFlags = in.readUint16BE();
- _roomStates[num].roomExitStates = in.readUint16BE();
+ _roomStates[num].state = in->readUint16BE();
+ _roomStates[num].classFlags = in->readUint16BE();
+ _roomStates[num].roomExitStates = in->readUint16BE();
}
- in.close();
+ delete in;
}
if (getFileName(GAME_RMSLFILE) != NULL) {
/* Read list of ROOM ITEMS resources */
- in.open(getFileName(GAME_RMSLFILE));
- if (in.isOpen() == false) {
+ in = _archives.open(getFileName(GAME_RMSLFILE));
+ if (!in) {
error("loadGamePcFile: Can't load room resources file '%s'", getFileName(GAME_RMSLFILE));
}
- fileSize = in.size();
+ fileSize = in->size();
_roomsList = (byte *)malloc(fileSize);
if (_roomsList == NULL)
error("loadGamePcFile: Out of memory for room items list");
- in.read(_roomsList, fileSize);
- in.close();
+ in->read(_roomsList, fileSize);
+ delete in;
}
if (getFileName(GAME_XTBLFILE) != NULL) {
/* Read list of XTABLE resources */
- in.open(getFileName(GAME_XTBLFILE));
- if (in.isOpen() == false) {
+ in = _archives.open(getFileName(GAME_XTBLFILE));
+ if (!in) {
error("loadGamePcFile: Can't load xtable resources file '%s'", getFileName(GAME_XTBLFILE));
}
- fileSize = in.size();
+ fileSize = in->size();
_xtblList = (byte *)malloc(fileSize);
if (_xtblList == NULL)
error("loadGamePcFile: Out of memory for strip xtable list");
- in.read(_xtblList, fileSize);
- in.close();
+ in->read(_xtblList, fileSize);
+ delete in;
/* Remember the current state */
_xsubroutineListOrg = _subroutineList;
@@ -780,7 +799,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) {
uint32 offs, size;
if (getFeatures() & GF_OLD_BUNDLE) {
- Common::File in;
+ Common::SeekableReadStream *in;
char filename[15];
if (id == 23)
id = 112;
@@ -796,22 +815,22 @@ void AGOSEngine::loadVGABeardFile(uint16 id) {
sprintf(filename, "0%d.VGA", id);
}
- in.open(filename);
- if (in.isOpen() == false)
+ in = _archives.open(filename);
+ if (!in)
error("loadSimonVGAFile: Can't load %s", filename);
- size = in.size();
+ size = in->size();
if (getFeatures() & GF_CRUNCHED) {
byte *srcBuffer = (byte *)malloc(size);
- if (in.read(srcBuffer, size) != size)
+ if (in->read(srcBuffer, size) != size)
error("loadSimonVGAFile: Read failed");
decrunchFile(srcBuffer, _vgaBufferPointers[11].vgaFile2, size);
free(srcBuffer);
} else {
- if (in.read(_vgaBufferPointers[11].vgaFile2, size) != size)
+ if (in->read(_vgaBufferPointers[11].vgaFile2, size) != size)
error("loadSimonVGAFile: Read failed");
}
- in.close();
+ delete in;
} else {
offs = _gameOffsetsPtr[id];
@@ -821,7 +840,7 @@ void AGOSEngine::loadVGABeardFile(uint16 id) {
}
void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
- Common::File in;
+ Common::SeekableReadStream *in;
char filename[15];
byte *dst;
uint32 file, offs, srcSize, dstSize;
@@ -874,8 +893,8 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
}
}
- in.open(filename);
- if (in.isOpen() == false) {
+ in = _archives.open(filename);
+ if (!in) {
if (useError)
error("loadVGAVideoFile: Can't load %s", filename);
@@ -883,11 +902,11 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
return;
}
- dstSize = srcSize = in.size();
+ dstSize = srcSize = in->size();
if (getGameType() == GType_PN && getPlatform() == Common::kPlatformPC && id == 17 && type == 2) {
// The A2.out file isn't compressed in PC version of Personal Nightmare
dst = allocBlock(dstSize + extraBuffer);
- if (in.read(dst, dstSize) != dstSize)
+ if (in->read(dst, dstSize) != dstSize)
error("loadVGAVideoFile: Read failed");
} else if (getGameType() == GType_PN && (getFeatures() & GF_CRUNCHED)) {
Common::Stack<uint32> data;
@@ -895,7 +914,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
int dataOutSize = 0;
for (uint i = 0; i < srcSize / 4; ++i) {
- uint32 dataVal = in.readUint32BE();
+ uint32 dataVal = in->readUint32BE();
// Correct incorrect byte, in corrupt 72.out file, included in some PC versions.
if (dataVal == 168042714)
data.push(168050906);
@@ -909,7 +928,7 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
delete[] dataOut;
} else if (getFeatures() & GF_CRUNCHED) {
byte *srcBuffer = (byte *)malloc(srcSize);
- if (in.read(srcBuffer, srcSize) != srcSize)
+ if (in->read(srcBuffer, srcSize) != srcSize)
error("loadVGAVideoFile: Read failed");
dstSize = READ_BE_UINT32(srcBuffer + srcSize - 4);
@@ -918,10 +937,10 @@ void AGOSEngine::loadVGAVideoFile(uint16 id, uint8 type, bool useError) {
free(srcBuffer);
} else {
dst = allocBlock(dstSize + extraBuffer);
- if (in.read(dst, dstSize) != dstSize)
+ if (in->read(dst, dstSize) != dstSize)
error("loadVGAVideoFile: Read failed");
}
- in.close();
+ delete in;
} else {
id = id * 2 + (type - 1);
offs = _gameOffsetsPtr[id];
diff --git a/engines/agos/res_snd.cpp b/engines/agos/res_snd.cpp
index 9a04ce2d26..b5612d710d 100644
--- a/engines/agos/res_snd.cpp
+++ b/engines/agos/res_snd.cpp
@@ -413,7 +413,7 @@ bool AGOSEngine::loadVGASoundFile(uint16 id, uint8 type) {
return true;
}
-static const char *dimpSoundList[32] = {
+static const char *const dimpSoundList[32] = {
"Beep",
"Birth",
"Boiling",
@@ -450,17 +450,17 @@ static const char *dimpSoundList[32] = {
void AGOSEngine::loadSoundFile(const char* filename) {
- Common::File in;
+ Common::SeekableReadStream *in;
- in.open(filename);
- if (in.isOpen() == false)
+ in = _archives.open(filename);
+ if (!in)
error("loadSound: Can't load %s", filename);
- uint32 dstSize = in.size();
+ uint32 dstSize = in->size();
byte *dst = (byte *)malloc(dstSize);
- if (in.read(dst, dstSize) != dstSize)
+ if (in->read(dst, dstSize) != dstSize)
error("loadSound: Read failed");
- in.close();
+ delete in;
_sound->playSfxData(dst, 0, 0, 0);
}
@@ -469,21 +469,21 @@ void AGOSEngine::loadSound(uint16 sound, int16 pan, int16 vol, uint16 type) {
byte *dst;
if (getGameId() == GID_DIMP) {
- Common::File in;
+ Common::SeekableReadStream *in;
char filename[15];
assert(sound >= 1 && sound <= 32);
sprintf(filename, "%s.wav", dimpSoundList[sound - 1]);
- in.open(filename);
- if (in.isOpen() == false)
+ in = _archives.open(filename);
+ if (!in)
error("loadSound: Can't load %s", filename);
- uint32 dstSize = in.size();
+ uint32 dstSize = in->size();
dst = (byte *)malloc(dstSize);
- if (in.read(dst, dstSize) != dstSize)
+ if (in->read(dst, dstSize) != dstSize)
error("loadSound: Read failed");
- in.close();
+ delete in;
} else if (getFeatures() & GF_ZLIBCOMP) {
char filename[15];
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index 10830db002..6779eabdbf 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -1019,9 +1019,7 @@ bool AGOSEngine::loadGame(const char *filename, bool restartMode) {
if (restartMode) {
// Load restart state
- Common::File *file = new Common::File();
- file->open(filename);
- f = file;
+ f = _archives.open(filename);
} else {
f = _saveFileMan->openForLoading(filename);
}
@@ -1195,9 +1193,7 @@ bool AGOSEngine_Elvira2::loadGame(const char *filename, bool restartMode) {
if (restartMode) {
// Load restart state
- Common::File *file = new Common::File();
- file->open(filename);
- f = file;
+ f = _archives.open(filename);
} else {
f = _saveFileMan->openForLoading(filename);
}
diff --git a/engines/agos/string_pn.cpp b/engines/agos/string_pn.cpp
index 570fbc6200..ac8c263da3 100644
--- a/engines/agos/string_pn.cpp
+++ b/engines/agos/string_pn.cpp
@@ -68,7 +68,7 @@ void AGOSEngine_PN::uncomstr(char *c, uint32 x) {
*c = 0;
}
-static const char *objectNames[30] = {
+static const char *const objectNames[30] = {
"\0",
"Take \0",
"Inventory\r",
diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp
index bd9abb16b5..10c1c1aaf9 100644
--- a/engines/agos/subroutine.cpp
+++ b/engines/agos/subroutine.cpp
@@ -258,22 +258,21 @@ void AGOSEngine::endCutscene() {
_runScriptReturn1 = true;
}
-Common::File *AGOSEngine::openTablesFile(const char *filename) {
+Common::SeekableReadStream *AGOSEngine::openTablesFile(const char *filename) {
if (getFeatures() & GF_OLD_BUNDLE)
return openTablesFile_simon1(filename);
else
return openTablesFile_gme(filename);
}
-Common::File *AGOSEngine::openTablesFile_simon1(const char *filename) {
- Common::File *fo = new Common::File();
- fo->open(filename);
- if (fo->isOpen() == false)
+Common::SeekableReadStream *AGOSEngine::openTablesFile_simon1(const char *filename) {
+ Common::SeekableReadStream *in = _archives.open(filename);
+ if (!in)
error("openTablesFile: Can't open '%s'", filename);
- return fo;
+ return in;
}
-Common::File *AGOSEngine::openTablesFile_gme(const char *filename) {
+Common::SeekableReadStream *AGOSEngine::openTablesFile_gme(const char *filename) {
uint res;
uint32 offs;
@@ -287,7 +286,7 @@ Common::File *AGOSEngine::openTablesFile_gme(const char *filename) {
bool AGOSEngine::loadTablesIntoMem(uint16 subrId) {
byte *p;
uint16 min_num, max_num, file_num;
- Common::File *in;
+ Common::SeekableReadStream *in;
char filename[30];
if (_tblList == NULL)
@@ -336,7 +335,7 @@ bool AGOSEngine::loadTablesIntoMem(uint16 subrId) {
bool AGOSEngine_Waxworks::loadTablesIntoMem(uint16 subrId) {
byte *p;
uint min_num, max_num;
- Common::File *in;
+ Common::SeekableReadStream *in;
p = _tblList;
if (p == NULL)
@@ -403,7 +402,7 @@ bool AGOSEngine::loadXTablesIntoMem(uint16 subrId) {
int i;
uint min_num, max_num;
char filename[30];
- Common::File *in;
+ Common::SeekableReadStream *in;
p = _xtblList;
if (p == NULL)
@@ -453,9 +452,8 @@ bool AGOSEngine::loadXTablesIntoMem(uint16 subrId) {
return 0;
}
-void AGOSEngine::closeTablesFile(Common::File *in) {
+void AGOSEngine::closeTablesFile(Common::SeekableReadStream *in) {
if (getFeatures() & GF_OLD_BUNDLE) {
- in->close();
delete in;
}
}
diff --git a/engines/agos/verb_pn.cpp b/engines/agos/verb_pn.cpp
index 19e8bb2d48..9dd0079b6d 100644
--- a/engines/agos/verb_pn.cpp
+++ b/engines/agos/verb_pn.cpp
@@ -258,7 +258,7 @@ void AGOSEngine_PN::hitBox9(HitArea *ha) {
iconPage();
}
-static const char *messageList[9] = {
+static const char *const messageList[9] = {
"North\r",
"East\r",
"South\r",
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
new file mode 100644
index 0000000000..39bafc5e98
--- /dev/null
+++ b/engines/cge/bitmap.cpp
@@ -0,0 +1,392 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#include "cge/bitmap.h"
+#include "cge/vga13h.h"
+#include "cge/cge_main.h"
+#include "common/system.h"
+#include "common/debug.h"
+#include "common/debug-channels.h"
+
+namespace CGE {
+
+Bitmap::Bitmap(CGEEngine *vm, const char *fname) : _m(NULL), _v(NULL), _map(0), _vm(vm) {
+ debugC(1, kCGEDebugBitmap, "Bitmap::Bitmap(%s)", fname);
+
+ char pat[kMaxPath];
+ forceExt(pat, fname, ".VBM");
+
+ if (_vm->_resman->exist(pat)) {
+ EncryptedStream file(_vm, pat);
+ if (file.err())
+ error("Unable to find VBM [%s]", fname);
+ if (!loadVBM(&file))
+ error("Bad VBM [%s]", fname);
+ } else {
+ error("Bad VBM [%s]", fname);
+ }
+}
+
+Bitmap::Bitmap(CGEEngine *vm, uint16 w, uint16 h, uint8 *map) : _w(w), _h(h), _m(map), _v(NULL), _map(0), _vm(vm) {
+ debugC(1, kCGEDebugBitmap, "Bitmap::Bitmap(%d, %d, map)", w, h);
+ if (map)
+ code();
+}
+
+// following routine creates filled rectangle
+// immediately as VGA video chunks, in near memory as fast as possible,
+// especially for text line real time display
+Bitmap::Bitmap(CGEEngine *vm, uint16 w, uint16 h, uint8 fill)
+ : _w((w + 3) & ~3), // only full uint32 allowed!
+ _h(h), _m(NULL), _map(0), _vm(vm) {
+ debugC(1, kCGEDebugBitmap, "Bitmap::Bitmap(%d, %d, %d)", w, h, fill);
+
+ uint16 dsiz = _w >> 2; // data size (1 plane line size)
+ uint16 lsiz = 2 + dsiz + 2; // uint16 for line header, uint16 for gap
+ uint16 psiz = _h * lsiz; // - last gape, but + plane trailer
+ uint8 *v = new uint8[4 * psiz + _h * sizeof(*_b)];// the same for 4 planes
+ // + room for wash table
+ assert(v != NULL);
+
+ *(uint16 *) v = TO_LE_16(kBmpCPY | dsiz); // data chunk hader
+ memset(v + 2, fill, dsiz); // data bytes
+ *(uint16 *)(v + lsiz - 2) = TO_LE_16(kBmpSKP | ((kScrWidth / 4) - dsiz)); // gap
+
+ // Replicate lines
+ byte *destP;
+ for (destP = v + lsiz; destP < (v + psiz); destP += lsiz)
+ Common::copy(v, v + lsiz, destP);
+
+ *(uint16 *)(v + psiz - 2) = TO_LE_16(kBmpEOI); // plane trailer uint16
+
+ // Replicate planes
+ for (destP = v + psiz; destP < (v + 4 * psiz); destP += psiz)
+ Common::copy(v, v + psiz, destP);
+
+ HideDesc *b = (HideDesc *)(v + 4 * psiz);
+ b->_skip = (kScrWidth - _w) >> 2;
+ b->_hide = _w >> 2;
+
+ // Replicate across the entire table
+ for (HideDesc *hdP = b + 1; hdP < (b + _h); hdP++)
+ *hdP = *b;
+
+ b->_skip = 0; // fix the first entry
+ _v = v;
+ _b = b;
+}
+
+Bitmap::Bitmap(CGEEngine *vm, const Bitmap &bmp) : _w(bmp._w), _h(bmp._h), _m(NULL), _v(NULL), _map(0), _vm(vm) {
+ debugC(1, kCGEDebugBitmap, "Bitmap::Bitmap(bmp)");
+ uint8 *v0 = bmp._v;
+ if (!v0)
+ return;
+
+ uint16 vsiz = (uint8 *)(bmp._b) - (uint8 *)(v0);
+ uint16 siz = vsiz + _h * sizeof(HideDesc);
+ uint8 *v1 = new uint8[siz];
+ assert(v1 != NULL);
+ memcpy(v1, v0, siz);
+ _b = (HideDesc *)((_v = v1) + vsiz);
+}
+
+Bitmap::~Bitmap() {
+ debugC(6, kCGEDebugBitmap, "Bitmap::~Bitmap()");
+
+ free(_m);
+ delete[] _v;
+}
+
+Bitmap &Bitmap::operator=(const Bitmap &bmp) {
+ debugC(1, kCGEDebugBitmap, "&Bitmap::operator =");
+
+ uint8 *v0 = bmp._v;
+ _w = bmp._w;
+ _h = bmp._h;
+ _m = NULL;
+ _map = 0;
+ delete[] _v;
+
+ if (v0 == NULL) {
+ _v = NULL;
+ } else {
+ uint16 vsiz = (uint8 *)bmp._b - (uint8 *)v0;
+ uint16 siz = vsiz + _h * sizeof(HideDesc);
+ uint8 *v1 = (uint8 *)malloc(sizeof(uint8) * siz);
+ assert(v1 != NULL);
+ memcpy(v1, v0, siz);
+ _b = (HideDesc *)((_v = v1) + vsiz);
+ }
+ return *this;
+}
+
+char *Bitmap::forceExt(char *buf, const char *name, const char *ext) {
+ strcpy(buf, name);
+ char *dot = strrchr(buf, '.');
+ if (dot)
+ *dot = '\0';
+ strcat(buf, ext);
+
+ return buf;
+}
+
+uint16 Bitmap::moveVmap(uint8 *buf) {
+ debugC(1, kCGEDebugBitmap, "Bitmap::moveVmap(buf)");
+
+ if (!_v)
+ return 0;
+
+ uint16 vsiz = (uint8 *)_b - (uint8 *)_v;
+ uint16 siz = vsiz + _h * sizeof(HideDesc);
+ memcpy(buf, _v, siz);
+ delete[] _v;
+ _b = (HideDesc *)((_v = buf) + vsiz);
+ return siz;
+}
+
+BitmapPtr Bitmap::code() {
+ debugC(1, kCGEDebugBitmap, "Bitmap::code()");
+
+ if (!_m)
+ return false;
+
+ uint16 cnt;
+
+ if (_v) { // old X-map exists, so remove it
+ delete[] _v;
+ _v = NULL;
+ }
+
+ while (true) { // at most 2 times: for (V == NULL) & for allocated block;
+ uint8 *im = _v + 2;
+ uint16 *cp = (uint16 *) _v;
+ int bpl;
+
+ if (_v) { // 2nd pass - fill the hide table
+ for (uint16 i = 0; i < _h; i++) {
+ _b[i]._skip = 0xFFFF;
+ _b[i]._hide = 0x0000;
+ }
+ }
+ for (bpl = 0; bpl < 4; bpl++) { // once per each bitplane
+ uint8 *bm = _m;
+ bool skip = (bm[bpl] == kPixelTransp);
+ uint16 j;
+
+ cnt = 0;
+ for (uint16 i = 0; i < _h; i++) { // once per each line
+ uint8 pix;
+ for (j = bpl; j < _w; j += 4) {
+ pix = bm[j];
+ if (_v && pix != kPixelTransp) {
+ if (j < _b[i]._skip)
+ _b[i]._skip = j;
+
+ if (j >= _b[i]._hide)
+ _b[i]._hide = j + 1;
+ }
+ if ((pix == kPixelTransp) != skip || cnt >= 0x3FF0) { // end of block
+ cnt |= (skip) ? kBmpSKP : kBmpCPY;
+ if (_v)
+ *cp = TO_LE_16(cnt); // store block description uint16
+
+ cp = (uint16 *) im;
+ im += 2;
+ skip = (pix == kPixelTransp);
+ cnt = 0;
+ }
+ if (!skip) {
+ if (_v)
+ *im = pix;
+ im++;
+ }
+ cnt++;
+ }
+
+ bm += _w;
+ if (_w < kScrWidth) {
+ if (skip) {
+ cnt += (kScrWidth - j + 3) / 4;
+ } else {
+ cnt |= kBmpCPY;
+ if (_v)
+ *cp = TO_LE_16(cnt);
+
+ cp = (uint16 *) im;
+ im += 2;
+ skip = true;
+ cnt = (kScrWidth - j + 3) / 4;
+ }
+ }
+ }
+ if (cnt && ! skip) {
+ cnt |= kBmpCPY;
+ if (_v)
+ *cp = TO_LE_16(cnt);
+
+ cp = (uint16 *) im;
+ im += 2;
+ }
+ if (_v)
+ *cp = TO_LE_16(kBmpEOI);
+ cp = (uint16 *) im;
+ im += 2;
+ }
+ if (_v)
+ break;
+
+ uint16 sizV = (uint16)(im - 2 - _v);
+ _v = new uint8[sizV + _h * sizeof(*_b)];
+ assert(_v != NULL);
+
+ _b = (HideDesc *)(_v + sizV);
+ }
+ cnt = 0;
+ for (uint16 i = 0; i < _h; i++) {
+ if (_b[i]._skip == 0xFFFF) { // whole line is skipped
+ _b[i]._skip = (cnt + kScrWidth) >> 2;
+ cnt = 0;
+ } else {
+ uint16 s = _b[i]._skip & ~3;
+ uint16 h = (_b[i]._hide + 3) & ~3;
+ _b[i]._skip = (cnt + s) >> 2;
+ _b[i]._hide = (h - s) >> 2;
+ cnt = kScrWidth - h;
+ }
+ }
+
+ return this;
+}
+
+bool Bitmap::solidAt(int16 x, int16 y) {
+ debugC(6, kCGEDebugBitmap, "Bitmap::solidAt(%d, %d)", x, y);
+
+ if ((x >= _w) || (y >= _h))
+ return false;
+
+ uint8 *m = _v;
+ uint16 r = static_cast<uint16>(x) % 4;
+ uint16 n0 = (kScrWidth * y + x) / 4;
+ uint16 n = 0;
+
+ while (r) {
+ uint16 w, t;
+
+ w = READ_LE_UINT16(m);
+ m += 2;
+ t = w & 0xC000;
+ w &= 0x3FFF;
+
+ switch (t) {
+ case kBmpEOI:
+ r--;
+ case kBmpSKP:
+ w = 0;
+ break;
+ case kBmpREP:
+ w = 1;
+ break;
+ }
+ m += w;
+ }
+
+ while (true) {
+ uint16 w, t;
+
+ w = READ_LE_UINT16(m);
+ m += 2;
+ t = w & 0xC000;
+ w &= 0x3FFF;
+
+ if (n > n0)
+ return false;
+
+ n += w;
+ switch (t) {
+ case kBmpEOI:
+ return false;
+ case kBmpSKP:
+ w = 0;
+ break;
+ case kBmpREP:
+ case kBmpCPY:
+ if (n - w <= n0 && n > n0)
+ return true;
+ break;
+ }
+ m += ((t == kBmpREP) ? 1 : w);
+ }
+}
+
+bool Bitmap::loadVBM(EncryptedStream *f) {
+ debugC(5, kCGEDebugBitmap, "Bitmap::loadVBM(f)");
+
+ uint16 p = 0, n = 0;
+ if (!f->err())
+ f->read((uint8 *)&p, sizeof(p));
+ p = FROM_LE_16(p);
+
+ if (!f->err())
+ f->read((uint8 *)&n, sizeof(n));
+ n = FROM_LE_16(n);
+
+ if (!f->err())
+ f->read((uint8 *)&_w, sizeof(_w));
+ _w = FROM_LE_16(_w);
+
+ if (!f->err())
+ f->read((uint8 *)&_h, sizeof(_h));
+ _h = FROM_LE_16(_h);
+
+ if (!f->err()) {
+ if (p) {
+ if (_vm->_bitmapPalette) {
+ // Read in the palette
+ byte palData[kPalSize];
+ f->read(palData, kPalSize);
+
+ const byte *srcP = palData;
+ for (int idx = 0; idx < kPalCount; idx++, srcP += 3) {
+ _vm->_bitmapPalette[idx]._r = *srcP;
+ _vm->_bitmapPalette[idx]._g = *(srcP + 1);
+ _vm->_bitmapPalette[idx]._b = *(srcP + 2);
+ }
+ } else
+ f->seek(f->pos() + kPalSize);
+ }
+ }
+ if ((_v = new uint8[n]) == NULL)
+ return false;
+
+ if (!f->err())
+ f->read(_v, n);
+
+ _b = (HideDesc *)(_v + n - _h * sizeof(HideDesc));
+ return (!f->err());
+}
+
+} // End of namespace CGE
diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h
new file mode 100644
index 0000000000..aa6282705c
--- /dev/null
+++ b/engines/cge/bitmap.h
@@ -0,0 +1,88 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#ifndef CGE_BITMAP_H
+#define CGE_BITMAP_H
+
+#include "cge/general.h"
+#include "common/file.h"
+
+namespace CGE {
+
+class CGEEngine;
+class EncryptedStream;
+
+#define kMaxPath 128
+enum {
+ kBmpEOI = 0x0000,
+ kBmpSKP = 0x4000,
+ kBmpREP = 0x8000,
+ kBmpCPY = 0xC000
+};
+
+#include "common/pack-start.h"
+
+struct HideDesc {
+ uint16 _skip;
+ uint16 _hide;
+};
+
+#include "common/pack-end.h"
+
+class Bitmap {
+ CGEEngine *_vm;
+ char *forceExt(char *buf, const char *name, const char *ext);
+ bool loadVBM(EncryptedStream *f);
+public:
+ uint16 _w;
+ uint16 _h;
+ uint8 *_m;
+ uint8 *_v;
+ int32 _map;
+ HideDesc *_b;
+
+ Bitmap(CGEEngine *vm, const char *fname);
+ Bitmap(CGEEngine *vm, uint16 w, uint16 h, uint8 *map);
+ Bitmap(CGEEngine *vm, uint16 w, uint16 h, uint8 fill);
+ Bitmap(CGEEngine *vm, const Bitmap &bmp);
+ ~Bitmap();
+
+ Bitmap *code();
+ Bitmap &operator=(const Bitmap &bmp);
+ void hide(int16 x, int16 y);
+ void show(int16 x, int16 y);
+ void xShow(int16 x, int16 y);
+ bool solidAt(int16 x, int16 y);
+ uint16 moveVmap(uint8 *buf);
+};
+
+
+typedef Bitmap *BitmapPtr;
+
+} // End of namespace CGE
+
+#endif
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
new file mode 100644
index 0000000000..4ed2932cd9
--- /dev/null
+++ b/engines/cge/cge.cpp
@@ -0,0 +1,220 @@
+/* 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 "common/scummsys.h"
+#include "common/config-manager.h"
+#include "common/debug.h"
+#include "common/debug-channels.h"
+#include "common/error.h"
+#include "common/EventRecorder.h"
+#include "common/file.h"
+#include "common/fs.h"
+#include "engines/util.h"
+#include "cge/cge.h"
+#include "cge/vga13h.h"
+#include "cge/cge_main.h"
+#include "cge/talk.h"
+#include "cge/text.h"
+#include "cge/walk.h"
+
+namespace CGE {
+
+const int CGEEngine::_maxSceneArr[5] = {1, 8, 16, 23, 24};
+
+CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
+ : Engine(syst), _gameDescription(gameDescription), _randomSource("cge") {
+
+ // Debug/console setup
+ DebugMan.addDebugChannel(kCGEDebugBitmap, "bitmap", "CGE Bitmap debug channel");
+ DebugMan.addDebugChannel(kCGEDebugFile, "file", "CGE IO debug channel");
+ DebugMan.addDebugChannel(kCGEDebugEngine, "engine", "CGE Engine debug channel");
+
+ _startupMode = 1;
+ _demoText = kDemo;
+ _oldLev = 0;
+ _pocPtr = 0;
+ _bitmapPalette = NULL;
+
+
+
+}
+
+void CGEEngine::initSceneValues() {
+ for (int i = 0; i < kSceneMax; i++) {
+ _heroXY[i].x = 0;
+ _heroXY[i].y = 0;
+ }
+
+ for (int i = 0; i < kSceneMax + 1; i++) {
+ _barriers[i]._horz = 0xFF;
+ _barriers[i]._vert = 0xFF;
+ }
+}
+
+void CGEEngine::init() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::setup()");
+
+ // Initialise fields
+ _lastFrame = 0;
+ _lastTick = 0;
+ _hero = NULL;
+ _shadow = NULL;
+ _miniScene = NULL;
+ _miniShp = NULL;
+ _miniShpList = NULL;
+ _sprite = NULL;
+ _resman = new ResourceManager();
+
+ // Create debugger console
+ _console = new CGEConsole(this);
+
+ // Initialise engine objects
+ _font = new Font(this, "CGE");
+ _text = new Text(this, "CGE");
+ _talk = NULL;
+ _vga = new Vga();
+ _sys = new System(this);
+ _pocLight = new PocLight(this);
+ for (int i = 0; i < kPocketNX; i++)
+ _pocket[i] = NULL;
+ _horzLine = new HorizLine(this);
+ _infoLine = new InfoLine(this, kInfoW);
+ _sceneLight = new SceneLight(this);
+ _debugLine = new InfoLine(this, kScrWidth);
+ _commandHandler = new CommandHandler(this, false);
+ _commandHandlerTurbo = new CommandHandler(this, true);
+ _midiPlayer = new MusicPlayer(this);
+ _mouse = new Mouse(this);
+ _keyboard = new Keyboard(this);
+ _eventManager = new EventManager(this);
+ _fx = new Fx(this, 16); // must precede SOUND!!
+ _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;
+ _finis = 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;
+ _offUseCount = 0;
+
+ _startGameSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
+}
+
+void CGEEngine::deinit() {
+ // Remove all of our debug levels here
+ DebugMan.clearAllDebugChannels();
+
+ delete _console;
+ _midiPlayer->killMidi();
+
+ // Delete engine objects
+ delete _vga;
+ delete _sys;
+ delete _sprite;
+ delete _miniScene;
+ delete _shadow;
+ delete _horzLine;
+ delete _infoLine;
+ delete _sceneLight;
+ delete _debugLine;
+ delete _text;
+ delete _pocLight;
+ delete _keyboard;
+ delete _mouse;
+ delete _eventManager;
+ delete _fx;
+ delete _sound;
+ delete _font;
+ delete _commandHandler;
+ delete _commandHandlerTurbo;
+ delete _hero;
+ delete _resman;
+
+ if (_miniShpList) {
+ for (int i = 0; _miniShpList[i]; ++i)
+ delete _miniShpList[i];
+ delete[] _miniShpList;
+ }
+}
+
+CGEEngine::~CGEEngine() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::~CGEEngine()");
+}
+
+Common::Error CGEEngine::run() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::run()");
+
+ if (_gameDescription->flags & ADGF_DEMO) {
+ warning("Demos of Soltys are not supported.\nPlease get a free version on ScummVM download page");
+ return Common::kUnsupportedGameidError;
+ }
+
+ // Initialize graphics using following:
+ initGraphics(320, 200, false);
+
+ // Setup necessary game objects
+ init();
+ // Run the game
+ cge_main();
+
+ // Remove game objects
+ deinit();
+
+ return Common::kNoError;
+}
+
+bool CGEEngine::hasFeature(EngineFeature f) const {
+ return
+ (f == kSupportsRTL) ||
+ (f == kSupportsLoadingDuringRuntime) ||
+ (f == kSupportsSavingDuringRuntime);
+}
+
+bool CGEEngine::canLoadGameStateCurrently() {
+ return (_startupMode == 0) && _mouse->_active;
+}
+
+bool CGEEngine::canSaveGameStateCurrently() {
+ return (_startupMode == 0) && _mouse->_active;
+}
+
+} // End of namespace CGE
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
new file mode 100644
index 0000000000..2ce154a4fb
--- /dev/null
+++ b/engines/cge/cge.h
@@ -0,0 +1,339 @@
+/* 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.
+*
+*/
+
+#ifndef CGE_H
+#define CGE_H
+
+#include "common/random.h"
+#include "common/savefile.h"
+#include "common/serializer.h"
+#include "common/str.h"
+#include "common/rect.h"
+#include "engines/engine.h"
+#include "gui/debugger.h"
+#include "graphics/surface.h"
+#include "engines/advancedDetector.h"
+#include "cge/console.h"
+#include "cge/bitmap.h"
+#include "cge/sound.h"
+
+namespace CGE {
+
+class Console;
+class Sprite;
+class Cluster;
+class Vga;
+class System;
+class Keyboard;
+class Mouse;
+class HorizLine;
+class InfoLine;
+class SceneLight;
+class CommandHandler;
+class EventManager;
+class ResourceManager;
+class Walk;
+class Text;
+class Talk;
+
+#define kSavegameVersion 2
+#define kSavegameStrSize 11
+#define kPocketX 174
+#define kPocketY 176
+#define kPocketDX 18
+#define kPocketDY 22
+#define kPocketNX 8
+#define kPocketNY 1
+#define kPocketSX 8
+#define kPocketSY 3
+#define kSceneDx 9
+#define kSceneDy 10
+#define kSceneNx 8
+#define kSceneNy 3
+#define kSceneMax kSceneNx * kSceneNy
+#define kPathMax 128
+#define kCryptSeed 0xA5
+#define kMaxFile 128
+#define kMapXCnt 40
+#define kMapZCnt 20
+
+// our engine debug channels
+enum {
+ kCGEDebugBitmap = 1 << 0,
+ kCGEDebugFile = 1 << 1,
+ kCGEDebugEngine = 1 << 2
+};
+
+enum SnList {
+ kNear, kTake
+};
+
+enum CallbackType {
+ kNullCB = 0, kQGame, kMiniStep, kXScene, kSoundSetVolume
+};
+
+struct SavegameHeader {
+ uint8 version;
+ Common::String saveName;
+ Graphics::Surface *thumbnail;
+ int saveYear, saveMonth, saveDay;
+ int saveHour, saveMinutes;
+ int totalFrames;
+};
+
+extern const char *savegameStr;
+
+struct Bar {
+ uint8 _horz;
+ uint8 _vert;
+};
+
+class Font {
+ char _path[kPathMax];
+ void load();
+ CGEEngine *_vm;
+public:
+ uint8 *_widthArr;
+ uint16 *_pos;
+ uint8 *_map;
+ Font(CGEEngine *vm, const char *name);
+ ~Font();
+ uint16 width(const char *text);
+ void save();
+};
+
+class CGEEngine : public Engine {
+private:
+ uint32 _lastFrame, _lastTick;
+ void tick();
+ void syncHeader(Common::Serializer &s);
+ void writeSavegameHeader(Common::OutSaveFile *out, SavegameHeader &header);
+ void syncGame(Common::SeekableReadStream *readStream, Common::WriteStream *writeStream, bool tiny);
+ bool savegameExists(int slotNumber);
+ Common::String generateSaveName(int slot);
+public:
+ CGEEngine(OSystem *syst, const ADGameDescription *gameDescription);
+ ~CGEEngine();
+ virtual bool hasFeature(EngineFeature f) const;
+ virtual bool canLoadGameStateCurrently();
+ virtual bool canSaveGameStateCurrently();
+ virtual Common::Error loadGameState(int slot);
+ virtual Common::Error saveGameState(int slot, const Common::String &desc);
+
+ static const int _maxSceneArr[5];
+
+ const ADGameDescription *_gameDescription;
+ int _startupMode;
+ int _demoText;
+ int _oldLev;
+ int _pocPtr;
+ bool _music;
+ int _pocref[kPocketNX];
+ uint8 _volume[2];
+ int _maxScene;
+ bool _flag[4];
+ bool _dark;
+ bool _game;
+ bool _finis;
+ int _now;
+ int _lev;
+ int _mode;
+ int _soundOk;
+ int _gameCase2Cpt;
+ int _offUseCount;
+ Dac *_bitmapPalette;
+ uint8 _clusterMap[kMapZCnt][kMapXCnt];
+
+ Sprite *_sprTv;
+ Sprite *_sprK1;
+ Sprite *_sprK2;
+ Sprite *_sprK3;
+
+ Common::Point _heroXY[kSceneMax];
+ Bar _barriers[kSceneMax + 1];
+ Font *_font;
+ Vga *_vga;
+ System *_sys;
+ Sprite *_pocLight;
+ Keyboard *_keyboard;
+ Mouse *_mouse;
+ Sprite *_sprite;
+ Sprite *_miniScene;
+ Sprite *_shadow;
+ HorizLine *_horzLine;
+ InfoLine *_infoLine;
+ InfoLine *_debugLine;
+ SceneLight *_sceneLight;
+ CommandHandler *_commandHandler;
+ CommandHandler *_commandHandlerTurbo;
+ EventManager *_eventManager;
+ Fx *_fx;
+ Sound *_sound;
+ ResourceManager *_resman;
+ Sprite *_pocket[kPocketNX];
+ Walk *_hero;
+ Text *_text;
+ Talk *_talk;
+
+
+ Common::RandomSource _randomSource;
+ MusicPlayer *_midiPlayer;
+ BitmapPtr *_miniShp;
+ BitmapPtr *_miniShpList;
+ int _startGameSlot;
+
+ virtual Common::Error run();
+ GUI::Debugger *getDebugger() {
+ return _console;
+ }
+
+ void cge_main();
+ void switchScene(int newScene);
+ void startCountDown();
+ void quit();
+ void resetQSwitch();
+ void optionTouch(int opt, uint16 mask);
+ void resetGame();
+ bool loadGame(int slotNumber, SavegameHeader *header = NULL, bool tiny = false);
+ void setMapBrick(int x, int z);
+ void switchMapping();
+ void loadSprite(const char *fname, int ref, int scene, int col, int row, int pos);
+ void loadScript(const char *fname);
+ void loadUser();
+ void runGame();
+ bool showTitle(const char *name);
+ void movie(const char *ext);
+ void inf(const char *text);
+ void selectSound();
+ void dummy() {}
+ void NONE();
+ void SB();
+ void sceneDown();
+ void sceneUp();
+ void xScene();
+ void qGame();
+ void SBM();
+ void GUS();
+ void GUSM();
+ void MIDI();
+ void AUTO();
+ void setPortD();
+ void setPortM();
+ void setIRQ();
+ void setDMA();
+ void mainLoop();
+ void handleFrame();
+ void saveGame(int slotNumber, const Common::String &desc);
+ static bool readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header);
+ void switchMusic();
+ void selectPocket(int n);
+ void expandSprite(Sprite *spr);
+ void contractSprite(Sprite *spr);
+ int findPocket(Sprite *spr);
+ void feedSnail(Sprite *spr, SnList snq);
+ void pocFul();
+ void hide1(Sprite *spr);
+ void loadMapping();
+ void heroCover(int cvr);
+ void trouble(int seq, int text);
+ void offUse();
+ void tooFar();
+ void loadHeroXY();
+ void keyClick();
+ void switchColorMode();
+ void killSprite();
+ void switchDebug();
+ void miniStep(int stp);
+ void postMiniStep(int stp);
+ void showBak(int ref);
+ void initSceneValues();
+ char *mergeExt(char *buf, const char *name, const char *ext);
+ int takeEnum(const char **tab, const char *text);
+ int newRandom(int range);
+ void sndSetVolume();
+ Sprite *locate(int ref);
+ Sprite *spriteAt(int x, int y);
+ Cluster XZ(int16 x, int16 y);
+ void killText();
+
+ void snBackPt(Sprite *spr, int stp);
+ void snHBarrier(const int scene, const int barX);
+ void snVBarrier(const int scene, const int barY);
+ void snCover(Sprite *spr, int xref);
+ void snFlag(int indx, bool v);
+ void snFlash(bool on);
+ void snGame(Sprite *spr, int num);
+ void snGhost(Bitmap *bmp);
+ void snGive(Sprite *spr, int stp);
+ void snHide(Sprite *spr, int val);
+ void snKeep(Sprite *spr, int stp);
+ void snKill(Sprite *spr);
+ void snLevel(Sprite *spr, int lev);
+ void snLight(bool in);
+ void snMouse(bool on);
+ void snNNext(Sprite *spr, int p);
+ void snPort(Sprite *spr, int port);
+ void snReach(Sprite *spr, int mode);
+ void snRelZ(Sprite *spr, int z);
+ void snRNNext(Sprite *spr, int p);
+ void snRTNext(Sprite *spr, int p);
+ void snSend(Sprite *spr, int val);
+ void snRelX(Sprite *spr, int x);
+ void snRelY(Sprite *spr, int y);
+ void snRmNear(Sprite *spr);
+ void snRmTake(Sprite *spr);
+ void snRSeq(Sprite *spr, int val);
+ void snSeq(Sprite *spr, int val);
+ void snSetRef(Sprite *spr, int nr);
+ void snSetX(Sprite *spr, int x);
+ void snSetX0(int scene, int x0);
+ void snSetXY(Sprite *spr, uint16 xy);
+ void snSetY(Sprite *spr, int y);
+ void snSetY0(int scene, int y0);
+ void snSetZ(Sprite *spr, int z);
+ void snSlave(Sprite *spr, int ref);
+ void snSound(Sprite *spr, int wav);
+ void snSwap(Sprite *spr, int xref);
+ void snTNext(Sprite *spr, int p);
+ void snTrans(Sprite *spr, int trans);
+ void snUncover(Sprite *spr, Sprite *xspr);
+ void snWalk(Sprite *spr, int x, int y);
+ void snZTrim(Sprite *spr);
+protected:
+ int _recentStep;
+
+private:
+ CGEConsole *_console;
+ void init();
+ void deinit();
+};
+
+// Example console class
+class Console : public GUI::Debugger {
+public:
+ Console(CGEEngine *vm) {}
+ virtual ~Console() {}
+};
+
+} // End of namespace CGE
+
+#endif
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
new file mode 100644
index 0000000000..51cf3bb621
--- /dev/null
+++ b/engines/cge/cge_main.cpp
@@ -0,0 +1,1570 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#include "common/scummsys.h"
+#include "common/endian.h"
+#include "common/memstream.h"
+#include "common/savefile.h"
+#include "common/serializer.h"
+#include "common/str.h"
+#include "graphics/palette.h"
+#include "graphics/scaler.h"
+#include "graphics/thumbnail.h"
+#include "cge/vga13h.h"
+#include "cge/cge.h"
+#include "cge/cge_main.h"
+#include "cge/general.h"
+#include "cge/sound.h"
+#include "cge/snail.h"
+#include "cge/text.h"
+#include "cge/game.h"
+#include "cge/events.h"
+#include "cge/talk.h"
+#include "cge/vmenu.h"
+#include "cge/walk.h"
+#include "cge/sound.h"
+
+namespace CGE {
+
+const char *savegameStr = "SCUMMVM_CGE";
+
+//--------------------------------------------------------------------------
+
+const Dac g_stdPal[] = {// R G B
+ { 0, 60, 0}, // 198
+ { 0, 104, 0}, // 199
+ { 20, 172, 0}, // 200
+ { 82, 82, 0}, // 201
+ { 0, 132, 82}, // 202
+ { 132, 173, 82}, // 203
+ { 82, 0, 0}, // 204
+ { 206, 0, 24}, // 205
+ { 255, 33, 33}, // 206
+ { 123, 41, 0}, // 207
+ { 0, 41, 0}, // 208
+ { 0, 0, 82}, // 209
+ { 132, 0, 0}, // 210
+ { 255, 0, 0}, // 211
+ { 255, 66, 66}, // 212
+ { 148, 66, 16}, // 213
+ { 0, 82, 0}, // 214
+ { 0, 0, 132}, // 215
+ { 173, 0, 0}, // 216
+ { 255, 49, 0}, // 217
+ { 255, 99, 99}, // 218
+ { 181, 107, 49}, // 219
+ { 0, 132, 0}, // 220
+ { 0, 0, 255}, // 221
+ { 173, 41, 0}, // 222
+ { 255, 82, 0}, // 223
+ { 255, 132, 132}, // 224
+ { 214, 148, 74}, // 225
+ { 41, 214, 0}, // 226
+ { 0, 82, 173}, // 227
+ { 255, 214, 0}, // 228
+ { 247, 132, 49}, // 229
+ { 255, 165, 165}, // 230
+ { 239, 198, 123}, // 231
+ { 173, 214, 0}, // 232
+ { 0, 132, 214}, // 233
+ { 57, 57, 57}, // 234
+ { 247, 189, 74}, // 235
+ { 255, 198, 198}, // 236
+ { 255, 239, 173}, // 237
+ { 214, 255, 173}, // 238
+ { 82, 173, 255}, // 239
+ { 107, 107, 107}, // 240
+ { 247, 222, 99}, // 241
+ { 255, 0, 255}, // 242
+ { 255, 132, 255}, // 243
+ { 132, 132, 173}, // 244
+ { 148, 247, 255}, // 245
+ { 148, 148, 148}, // 246
+ { 82, 0, 82}, // 247
+ { 112, 68, 112}, // 248
+ { 176, 88, 144}, // 249
+ { 214, 132, 173}, // 250
+ { 206, 247, 255}, // 251
+ { 198, 198, 198}, // 252
+ { 0, 214, 255}, // 253
+ { 96, 224, 96 }, // 254
+ { 255, 255, 255}, // 255
+};
+
+char *CGEEngine::mergeExt(char *buf, const char *name, const char *ext) {
+ strcpy(buf, name);
+ char *dot = strrchr(buf, '.');
+ if (!dot)
+ strcat(buf, ext);
+
+ return buf;
+}
+
+int CGEEngine::takeEnum(const char **tab, const char *text) {
+ const char **e;
+ if (text) {
+ for (e = tab; *e; e++) {
+ if (scumm_stricmp(text, *e) == 0) {
+ return e - tab;
+ }
+ }
+ }
+ return -1;
+}
+
+int CGEEngine::newRandom(int range) {
+ if (!range)
+ return 0;
+
+ return _randomSource.getRandomNumber(range - 1);
+}
+
+void CGEEngine::sndSetVolume() {
+ // USeless for ScummVM
+}
+
+void CGEEngine::syncHeader(Common::Serializer &s) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::syncHeader(s)");
+
+ int i;
+
+ s.syncAsUint16LE(_now);
+ s.syncAsUint16LE(_oldLev);
+ s.syncAsUint16LE(_demoText);
+ for (i = 0; i < 5; i++)
+ s.syncAsUint16LE(_game);
+ s.syncAsSint16LE(i); // unused VGA::Mono variable
+ s.syncAsUint16LE(_music);
+ s.syncBytes(_volume, 2);
+ for (i = 0; i < 4; i++)
+ s.syncAsUint16LE(_flag[i]);
+
+ if (s.isLoading()) {
+ // Reset scene values
+ initSceneValues();
+ }
+
+ for (i = 0; i < kSceneMax; i++) {
+ s.syncAsSint16LE(_heroXY[i].x);
+ s.syncAsUint16LE(_heroXY[i].y);
+ }
+ for (i = 0; i < 1 + kSceneMax; i++) {
+ s.syncAsByte(_barriers[i]._horz);
+ s.syncAsByte(_barriers[i]._vert);
+ }
+ for (i = 0; i < kPocketNX; i++)
+ s.syncAsUint16LE(_pocref[i]);
+
+ if (s.isSaving()) {
+ // Write checksum
+ int checksum = kSavegameCheckSum;
+ s.syncAsUint16LE(checksum);
+ } else {
+ // Read checksum and validate it
+ uint16 checksum;
+ s.syncAsUint16LE(checksum);
+ if (checksum != kSavegameCheckSum)
+ error("%s", _text->getText(kBadSVG));
+ }
+}
+
+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
+ kSavegame0File file = kSavegame0File(this, kSavegame0Name);
+ int size = file.size();
+ byte *dataBuffer = (byte *)malloc(size);
+ file.read(dataBuffer, size);
+ readStream = new Common::MemoryReadStream(dataBuffer, size, DisposeAfterUse::YES);
+
+ } else {
+ // Open up the savgame file
+ Common::String slotName = generateSaveName(slotNumber);
+ Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(slotName);
+
+ // Read the data into a data buffer
+ int size = saveFile->size();
+ byte *dataBuffer = (byte *)malloc(size);
+ saveFile->read(dataBuffer, size);
+ readStream = new Common::MemoryReadStream(dataBuffer, size, DisposeAfterUse::YES);
+ }
+
+ // Check to see if it's a ScummVM savegame or not
+ char buffer[kSavegameStrSize + 1];
+ readStream->read(buffer, kSavegameStrSize + 1);
+
+ if (strncmp(buffer, savegameStr, kSavegameStrSize + 1) != 0) {
+ // It's not, so rewind back to the start
+ readStream->seek(0);
+
+ if (header)
+ // Header wanted where none exists, so return false
+ return false;
+ } else {
+ // Found header
+ if (!readSavegameHeader(readStream, saveHeader)) {
+ delete readStream;
+ return false;
+ }
+
+ if (header) {
+ *header = saveHeader;
+ delete readStream;
+ return true;
+ }
+
+ // Delete the thumbnail
+ saveHeader.thumbnail->free();
+ delete saveHeader.thumbnail;
+ }
+
+ // Get in the savegame
+ syncGame(readStream, NULL, tiny);
+
+ delete readStream;
+ return true;
+}
+
+/**
+ * Returns true if a given savegame exists
+ */
+bool CGEEngine::savegameExists(int slotNumber) {
+ Common::String slotName = generateSaveName(slotNumber);
+
+ Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(slotName);
+ bool result = saveFile != NULL;
+ delete saveFile;
+ return result;
+}
+
+/**
+ * Support method that generates a savegame name
+ * @param slot Slot number
+ */
+Common::String CGEEngine::generateSaveName(int slot) {
+ return Common::String::format("%s.%03d", _targetName.c_str(), slot);
+}
+
+Common::Error CGEEngine::loadGameState(int slot) {
+ // Clear current game activity
+ sceneDown();
+ resetGame();
+
+ // Load the game
+ loadGame(slot, NULL);
+ _commandHandler->addCommand(kCmdLevel, -1, _oldLev, &_sceneLight);
+ _sceneLight->gotoxy(kSceneX + ((_now - 1) % kSceneNx) * kSceneDx + kSceneSX,
+ kSceneY + ((_now - 1) / kSceneNx) * kSceneDy + kSceneSY);
+ sceneUp();
+
+ return Common::kNoError;
+}
+
+void CGEEngine::resetGame() {
+ _vga->_spareQ->clear();
+}
+
+Common::Error CGEEngine::saveGameState(int slot, const Common::String &desc) {
+ sceneDown();
+ _oldLev = _lev;
+
+ // Write out the user's progress
+ saveGame(slot, desc);
+
+ // Reload the scene
+ sceneUp();
+
+ return Common::kNoError;
+}
+
+void CGEEngine::saveGame(int slotNumber, const Common::String &desc) {
+ // Set up the serializer
+ Common::String slotName = generateSaveName(slotNumber);
+ Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(slotName);
+
+ // Write out the ScummVM savegame header
+ SavegameHeader header;
+ header.saveName = desc;
+ header.version = kSavegameVersion;
+ writeSavegameHeader(saveFile, header);
+
+ // Write out the data of the savegame
+ syncGame(NULL, saveFile, false);
+
+ // Finish writing out game data
+ saveFile->finalize();
+ delete saveFile;
+}
+
+void CGEEngine::writeSavegameHeader(Common::OutSaveFile *out, SavegameHeader &header) {
+ // Write out a savegame header
+ out->write(savegameStr, kSavegameStrSize + 1);
+
+ out->writeByte(kSavegameVersion);
+
+ // Write savegame name
+ out->write(header.saveName.c_str(), header.saveName.size() + 1);
+
+ // Get the active palette
+ uint8 thumbPalette[256 * 3];
+ g_system->getPaletteManager()->grabPalette(thumbPalette, 0, 256);
+
+ // Create a thumbnail and save it
+ Graphics::Surface *thumb = new Graphics::Surface();
+ Graphics::Surface *s = _vga->_page[0];
+ ::createThumbnail(thumb, (const byte *)s->pixels, kScrWidth, kScrHeight, thumbPalette);
+ Graphics::saveThumbnail(*out, *thumb);
+ thumb->free();
+ delete thumb;
+
+ // Write out the save date/time
+ TimeDate td;
+ g_system->getTimeAndDate(td);
+ out->writeSint16LE(td.tm_year + 1900);
+ out->writeSint16LE(td.tm_mon + 1);
+ out->writeSint16LE(td.tm_mday);
+ out->writeSint16LE(td.tm_hour);
+ out->writeSint16LE(td.tm_min);
+}
+
+void CGEEngine::syncGame(Common::SeekableReadStream *readStream, Common::WriteStream *writeStream, bool tiny) {
+ Common::Serializer s(readStream, writeStream);
+
+ if (s.isSaving()) {
+ for (int i = 0; i < kPocketNX; i++) {
+ register Sprite *pocSpr = _pocket[i];
+ _pocref[i] = (pocSpr) ? pocSpr->_ref : -1;
+ }
+
+ // Skip Digital and Midi volumes, useless under ScummVM
+ _volume[0] = 0;
+ _volume[1] = 0;
+ }
+
+ // Synchronise header data
+ syncHeader(s);
+
+ if (s.isSaving()) {
+ // Loop through saving the sprite data
+ for (Sprite *spr = _vga->_spareQ->first(); spr; spr = spr->_next) {
+ if (!s.err())
+ spr->sync(s);
+ }
+ } else {
+ // Loading game
+ if (_soundOk == 1 && _mode == 0) {
+ // Skip Digital and Midi volumes, useless under ScummVM
+ sndSetVolume();
+ }
+
+ if (!tiny) { // load sprites & pocket
+ while (readStream->pos() < readStream->size()) {
+ Sprite S(this, NULL);
+ S.sync(s);
+
+ S._prev = S._next = NULL;
+ Sprite *spr = (scumm_stricmp(S._file + 2, "MUCHA") == 0) ? new Fly(this, NULL)
+ : new Sprite(this, NULL);
+ assert(spr != NULL);
+ *spr = S;
+ _vga->_spareQ->append(spr);
+ }
+
+ for (int i = 0; i < kPocketNX; i++) {
+ register int r = _pocref[i];
+ _pocket[i] = (r < 0) ? NULL : _vga->_spareQ->locate(r);
+ }
+ }
+ }
+}
+
+bool CGEEngine::readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header) {
+ header.thumbnail = NULL;
+
+ // Get the savegame version
+ header.version = in->readByte();
+ if (header.version > kSavegameVersion)
+ return false;
+
+ // Read in the string
+ header.saveName.clear();
+ char ch;
+ while ((ch = (char)in->readByte()) != '\0')
+ header.saveName += ch;
+
+ // Get the thumbnail
+ header.thumbnail = Graphics::loadThumbnail(*in);
+ if (!header.thumbnail) {
+ delete header.thumbnail;
+ header.thumbnail = NULL;
+ 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();
+
+ return true;
+}
+
+void CGEEngine::heroCover(int cvr) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::heroCover(%d)", cvr);
+
+ _commandHandler->addCommand(kCmdCover, 1, cvr, NULL);
+}
+
+void CGEEngine::trouble(int seq, int text) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::trouble(%d, %d)", seq, text);
+
+ _hero->park();
+ _commandHandler->addCommand(kCmdWait, -1, -1, _hero);
+ _commandHandler->addCommand(kCmdSeq, -1, seq, _hero);
+ _commandHandler->addCommand(kCmdSound, -1, 2, _hero);
+ _commandHandler->addCommand(kCmdWait, -1, -1, _hero);
+ _commandHandler->addCommand(kCmdSay, 1, text, _hero);
+}
+
+void CGEEngine::offUse() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::offUse()");
+
+ trouble(kSeqOffUse, kOffUse + newRandom(_offUseCount));
+}
+
+void CGEEngine::tooFar() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::tooFar()");
+
+ trouble(kSeqTooFar, kTooFar);
+}
+
+void CGEEngine::loadHeroXY() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::loadHeroXY()");
+
+ EncryptedStream cf(this, "CGE.HXY");
+ uint16 x, y;
+
+ memset(_heroXY, 0, sizeof(_heroXY));
+ if (!cf.err()) {
+ for (int i = 0; i < kSceneMax; ++i) {
+ cf.read((byte *)&x, 2);
+ cf.read((byte *)&y, 2);
+
+ _heroXY[i].x = (int16)FROM_LE_16(x);
+ _heroXY[i].y = (int16)FROM_LE_16(y);
+ }
+ }
+}
+
+void CGEEngine::loadMapping() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::loadMapping()");
+
+ if (_now <= kSceneMax) {
+ EncryptedStream cf(this, "CGE.TAB");
+ if (!cf.err()) {
+ // Move to the data for the given room
+ cf.seek((_now - 1) * kMapArrSize);
+
+ // Read in the data
+ for (int z = 0; z < kMapZCnt; ++z) {
+ cf.read(&_clusterMap[z][0], kMapXCnt);
+ }
+ }
+ }
+}
+
+Square::Square(CGEEngine *vm) : Sprite(vm, NULL), _vm(vm) {
+ _flags._kill = true;
+ _flags._bDel = false;
+
+ BitmapPtr *MB = new BitmapPtr[2];
+ MB[0] = new Bitmap(_vm, "BRICK");
+ MB[1] = NULL;
+ setShapeList(MB);
+}
+
+void Square::touch(uint16 mask, int x, int y) {
+ Sprite::touch(mask, x, y);
+ if (mask & kMouseLeftUp) {
+ _vm->XZ(_x + x, _y + y).cell() = 0;
+ _vm->_commandHandlerTurbo->addCommand(kCmdKill, -1, 0, this);
+ }
+}
+
+void CGEEngine::setMapBrick(int x, int z) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::setMapBrick(%d, %d)", x, z);
+
+ Square *s = new Square(this);
+ if (s) {
+ char n[6];
+ s->gotoxy(x * kMapGridX, kMapTop + z * kMapGridZ);
+ sprintf(n, "%02d:%02d", x, z);
+ _clusterMap[z][x] = 1;
+ s->setName(n);
+ _vga->_showQ->insert(s, _vga->_showQ->first());
+ }
+}
+
+void CGEEngine::keyClick() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::keyClick()");
+
+ _commandHandlerTurbo->addCommand(kCmdSound, -1, 5, NULL);
+}
+
+void CGEEngine::resetQSwitch() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::resetQSwitch()");
+
+ _commandHandlerTurbo->addCommand(kCmdSeq, 123, 0, NULL);
+ keyClick();
+}
+
+void CGEEngine::quit() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::quit()");
+
+ static Choice QuitMenu[] = {
+ { NULL, &CGEEngine::startCountDown },
+ { NULL, &CGEEngine::resetQSwitch },
+ { NULL, &CGEEngine::dummy }
+ };
+
+ if (_commandHandler->idle() && !_hero->_flags._hide) {
+ if (Vmenu::_addr) {
+ _commandHandlerTurbo->addCommand(kCmdKill, -1, 0, Vmenu::_addr);
+ resetQSwitch();
+ } else {
+ QuitMenu[0]._text = _text->getText(kQuit);
+ QuitMenu[1]._text = _text->getText(kNoQuit);
+ (new Vmenu(this, QuitMenu, -1, -1))->setName(_text->getText(kQuitTitle));
+ _commandHandlerTurbo->addCommand(kCmdSeq, 123, 1, NULL);
+ keyClick();
+ }
+ }
+}
+
+void CGEEngine::miniStep(int stp) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::miniStep(%d)", stp);
+
+ if (stp < 0) {
+ _miniScene->_flags._hide = true;
+ } else {
+ *_miniShp[0] = *_miniShpList[stp];
+ _miniScene->_flags._hide = false;
+ }
+}
+
+void CGEEngine::postMiniStep(int step) {
+ debugC(6, kCGEDebugEngine, "CGEEngine::postMiniStep(%d)", step);
+
+ if (_miniScene && step != _recentStep)
+ _commandHandlerTurbo->addCallback(kCmdExec, -1, _recentStep = step, kMiniStep);
+}
+
+void CGEEngine::showBak(int ref) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::showBack(%d)", ref);
+
+ Sprite *spr = _vga->_spareQ->locate(ref);
+ if (!spr)
+ return;
+
+ _bitmapPalette = _vga->_sysPal;
+ spr->expand();
+ _bitmapPalette = NULL;
+ spr->show(2);
+ _vga->copyPage(1, 2);
+ _sys->setPal();
+ spr->contract();
+}
+
+void CGEEngine::sceneUp() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::sceneUp()");
+
+ const int BakRef = 1000 * _now;
+ if (_music)
+ _midiPlayer->loadMidi(_now);
+
+ showBak(BakRef);
+ loadMapping();
+ Sprite *spr = _vga->_spareQ->first();
+ while (spr) {
+ Sprite *n = spr->_next;
+ if (spr->_scene == _now || spr->_scene == 0)
+ if (spr->_ref != BakRef) {
+ if (spr->_flags._back)
+ spr->backShow();
+ else
+ expandSprite(spr);
+ }
+ spr = n;
+ }
+
+ _sound->stop();
+ _fx->clear();
+ _fx->preload(0);
+ _fx->preload(BakRef);
+
+ if (_hero) {
+ _hero->gotoxy(_heroXY[_now - 1].x, _heroXY[_now - 1].y);
+ // following 2 lines trims Hero's Z position!
+ _hero->tick();
+ _hero->_time = 1;
+ _hero->_flags._hide = false;
+ }
+
+ if (!_dark)
+ _vga->sunset();
+
+ _vga->copyPage(0, 1);
+ selectPocket(-1);
+ if (_hero)
+ _vga->_showQ->insert(_vga->_showQ->remove(_hero));
+
+ if (_shadow) {
+ _vga->_showQ->remove(_shadow);
+ _shadow->makeXlat(_vga->glass(_vga->_sysPal, 204, 204, 204));
+ _vga->_showQ->insert(_shadow, _hero);
+ _shadow->_z = _hero->_z;
+ }
+ feedSnail(_vga->_showQ->locate(BakRef + 999), kTake);
+ _vga->show();
+ _vga->copyPage(1, 0);
+ _vga->show();
+ _vga->sunrise(_vga->_sysPal);
+ _dark = false;
+ if (!_startupMode)
+ _mouse->on();
+}
+
+void CGEEngine::sceneDown() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::sceneDown()");
+
+ if (_horzLine && !_horzLine->_flags._hide)
+ switchMapping();
+
+ for (Sprite *spr = _vga->_showQ->first(); spr;) {
+ Sprite *n = spr->_next;
+ if (spr->_ref >= 1000 /*&& spr->_scene*/) {
+ if (spr->_ref % 1000 == 999)
+ feedSnail(spr, kTake);
+ _vga->_spareQ->append(_vga->_showQ->remove(spr));
+ }
+ spr = n;
+ }
+}
+
+void CGEEngine::xScene() {
+ debugC(6, kCGEDebugEngine, "CGEEngine::xScene()");
+
+ sceneDown();
+ sceneUp();
+}
+
+void CGEEngine::qGame() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::qGame()");
+
+ sceneDown();
+ _oldLev = _lev;
+
+ // Write out the user's progress
+ saveGame(0, Common::String("Automatic Savegame"));
+
+ _vga->sunset();
+ _finis = true;
+}
+
+void CGEEngine::switchScene(int newScene) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::switchScene(%d)", newScene);
+
+ if (newScene == _now)
+ return;
+
+ if (newScene < 0) {
+ _commandHandler->addCommand(kCmdLabel, -1, 0, NULL); // wait for repaint
+ _commandHandler->addCallback(kCmdExec, -1, 0, kQGame); // quit game
+ } else {
+ _now = newScene;
+ _mouse->off();
+ if (_hero) {
+ _hero->park();
+ _hero->step(0);
+ _vga->_spareQ->_show = 0;
+ }
+ _sceneLight->gotoxy(kSceneX + ((_now - 1) % kSceneNx) * kSceneDx + kSceneSX,
+ kSceneY + ((_now - 1) / kSceneNx) * kSceneDy + kSceneSY);
+ killText();
+ if (!_startupMode)
+ keyClick();
+ _commandHandler->addCommand(kCmdLabel, -1, 0, NULL); // wait for repaint
+ _commandHandler->addCallback(kCmdExec, 0, 0, kXScene); // switch scene
+ }
+}
+
+System::System(CGEEngine *vm) : Sprite(vm, NULL), _vm(vm) {
+ _funDel = kHeroFun0;
+ setPal();
+ tick();
+}
+
+void System::setPal() {
+ Dac *p = _vm->_vga->_sysPal + 256 - ARRAYSIZE(g_stdPal);
+ for (uint i = 0; i < ARRAYSIZE(g_stdPal); i++) {
+ p[i]._r = g_stdPal[i]._r >> 2;
+ p[i]._g = g_stdPal[i]._g >> 2;
+ p[i]._b = g_stdPal[i]._b >> 2;
+ }
+}
+
+void System::funTouch() {
+ uint16 n = (_vm->_flag[0]) ? kHeroFun1 : kHeroFun0; // PAIN flag
+ if (_vm->_talk == NULL || n > _funDel)
+ _funDel = n;
+}
+
+void System::touch(uint16 mask, int x, int y) {
+ funTouch();
+
+ if (mask & kEventKeyb) {
+ _vm->keyClick();
+ _vm->killText();
+ if (_vm->_startupMode == 1) {
+ _vm->_commandHandler->addCommand(kCmdClear, -1, 0, NULL);
+ return;
+ }
+ switch (x) {
+ case 'X':
+ if (_vm->_keyboard->_key[kKeyAlt])
+ _vm->quit();
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ if (_vm->_keyboard->_key[kKeyAlt]) {
+ _vm->_commandHandler->addCommand(kCmdLevel, -1, x - '0', NULL);
+ break;
+ }
+ break;
+ }
+ } else {
+ if (_vm->_startupMode)
+ return;
+ int selectedScene = 0;
+ _vm->_infoLine->update(NULL);
+ if (y >= kWorldHeight ) {
+ if (x < kButtonX) { // select scene?
+ if (y >= kSceneY && y < kSceneY + kSceneNy * kSceneDy &&
+ x >= kSceneX && x < kSceneX + kSceneNx * kSceneDx && !_vm->_game) {
+ selectedScene = ((y - kSceneY) / kSceneDy) * kSceneNx + (x - kSceneX) / kSceneDx + 1;
+ if (selectedScene > _vm->_maxScene)
+ selectedScene = 0;
+ } else {
+ selectedScene = 0;
+ }
+ } else if (mask & kMouseLeftUp) {
+ if (y >= kPocketY && y < kPocketY + kPocketNY * kPocketDY &&
+ x >= kPocketX && x < kPocketX + kPocketNX * kPocketDX) {
+ int n = ((y - kPocketY) / kPocketDY) * kPocketNX + (x - kPocketX) / kPocketDX;
+ _vm->selectPocket(n);
+ }
+ }
+ }
+
+ _vm->postMiniStep(selectedScene - 1);
+
+ if (mask & kMouseLeftUp) {
+ if (selectedScene && _vm->_commandHandler->idle() && _vm->_hero->_tracePtr < 0)
+ _vm->switchScene(selectedScene);
+
+ if (_vm->_horzLine && !_vm->_horzLine->_flags._hide) {
+ if (y >= kMapTop && y < kMapTop + kMapHig) {
+ Cluster tmpCluster = _vm->XZ(x, y);
+ int16 x1 = tmpCluster._pt.x;
+ int16 z1 = tmpCluster._pt.y;
+ _vm->_clusterMap[z1][x1] = 1;
+ _vm->setMapBrick(x1, z1);
+ }
+ } else {
+ if (!_vm->_talk && _vm->_commandHandler->idle() && _vm->_hero
+ && y >= kMapTop && y < kMapTop + kMapHig && !_vm->_game) {
+ _vm->_hero->findWay(_vm->XZ(x, y));
+ }
+ }
+ }
+ }
+}
+
+void System::tick() {
+ if (!_vm->_startupMode)
+ if (--_funDel == 0) {
+ _vm->killText();
+ if (_vm->_commandHandler->idle()) {
+ if (_vm->_flag[0]) // Pain flag
+ _vm->heroCover(9);
+ else { // CHECKME: Before, was: if (Startup::_core >= CORE_MID) {
+ int n = _vm->newRandom(100);
+ if (n > 96)
+ _vm->heroCover(6 + (_vm->_hero->_x + _vm->_hero->_w / 2 < kScrWidth / 2));
+ else if (n > 90)
+ _vm->heroCover(5);
+ else if (n > 60)
+ _vm->heroCover(4);
+ else
+ _vm->heroCover(3);
+ }
+ }
+ funTouch();
+ }
+ _time = kSystemRate;
+}
+
+void CGEEngine::switchColorMode() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::switchColorMode()");
+
+ _commandHandlerTurbo->addCommand(kCmdSeq, 121, _vga->_mono = !_vga->_mono, NULL);
+ keyClick();
+ _vga->setColors(_vga->_sysPal, 64);
+}
+
+void CGEEngine::switchMusic() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::switchMusic()");
+
+ _commandHandlerTurbo->addCommand(kCmdSeq, 122, (_music = !_music), NULL);
+ keyClick();
+
+ if (_music)
+ _midiPlayer->loadMidi(_now);
+ else
+ _midiPlayer->killMidi();
+}
+
+void CGEEngine::startCountDown() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::startCountDown()");
+
+ switchScene(-1);
+}
+
+void CGEEngine::switchMapping() {
+ assert(_horzLine);
+ debugC(1, kCGEDebugEngine, "CGEEngine::switchMapping()");
+
+ if (_horzLine && _horzLine->_flags._hide) {
+ for (int i = 0; i < kMapZCnt; i++) {
+ for (int j = 0; j < kMapXCnt; j++) {
+ if (_clusterMap[i][j])
+ setMapBrick(j, i);
+ }
+ }
+ } else {
+ for (Sprite *s = _vga->_showQ->first(); s; s = s->_next)
+ if (s->_w == kMapGridX && s->_h == kMapGridZ)
+ _commandHandlerTurbo->addCommand(kCmdKill, -1, 0, s);
+ }
+ _horzLine->_flags._hide = !_horzLine->_flags._hide;
+}
+
+void CGEEngine::killSprite() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::killSprite()");
+
+ _sprite->_flags._kill = true;
+ _sprite->_flags._bDel = true;
+ _commandHandlerTurbo->addCommand(kCmdKill, -1, 0, _sprite);
+ _sprite = NULL;
+}
+
+void CGEEngine::optionTouch(int opt, uint16 mask) {
+ switch (opt) {
+ case 1:
+ if (mask & kMouseLeftUp)
+ switchColorMode();
+ break;
+ case 2:
+ if (mask & kMouseLeftUp)
+ switchMusic();
+ else if (mask & kMouseRightUp)
+ warning("TODO: Use ScummVM sound dialog");
+ break;
+ case 3:
+ if (mask & kMouseLeftUp)
+ quit();
+ break;
+ }
+}
+
+#pragma argsused
+void Sprite::touch(uint16 mask, int x, int y) {
+ _vm->_sys->funTouch();
+
+ if ((mask & kEventAttn) != 0)
+ return;
+
+ _vm->_infoLine->update(name());
+
+ if (mask & (kMouseRightDown | kMouseLeftDown))
+ _vm->_sprite = this;
+
+ if (_ref / 10 == 12) {
+ _vm->optionTouch(_ref % 10, mask);
+ return;
+ }
+
+ if (_flags._syst)
+ return; // cannot access system sprites
+
+ if (_vm->_game)
+ if (mask & kMouseLeftUp) {
+ mask &= ~kMouseLeftUp;
+ mask |= kMouseRightUp;
+ }
+
+ if ((mask & kMouseRightUp) && _vm->_commandHandler->idle()) {
+ Sprite *ps = (_vm->_pocLight->_seqPtr) ? _vm->_pocket[_vm->_pocPtr] : NULL;
+ if (ps) {
+ if (_flags._kept || _vm->_hero->distance(this) < kDistMax) {
+ if (works(ps)) {
+ _vm->feedSnail(ps, kTake);
+ } else
+ _vm->offUse();
+ _vm->selectPocket(-1);
+ } else
+ _vm->tooFar();
+ } else {
+ if (_flags._kept) {
+ mask |= kMouseLeftUp;
+ } else {
+ if (_vm->_hero->distance(this) < kDistMax) {
+ if (_flags._port) {
+ if (_vm->findPocket(NULL) < 0) {
+ _vm->pocFul();
+ } else {
+ _vm->_commandHandler->addCommand(kCmdReach, -1, -1, this);
+ _vm->_commandHandler->addCommand(kCmdKeep, -1, -1, this);
+ _flags._port = false;
+ }
+ } else {
+ if (_takePtr != kNoPtr) {
+ if (snList(kTake)[_takePtr]._commandType == kCmdNext)
+ _vm->offUse();
+ else
+ _vm->feedSnail(this, kTake);
+ } else {
+ _vm->offUse();
+ }
+ }
+ } else {
+ _vm->tooFar();
+ }
+ }
+ }
+ }
+
+ if ((mask & kMouseLeftUp) && _vm->_commandHandler->idle()) {
+ if (_flags._kept) {
+ for (int n = 0; n < kPocketNX; n++) {
+ if (_vm->_pocket[n] == this) {
+ _vm->selectPocket(n);
+ break;
+ }
+ }
+ } else {
+ _vm->_commandHandler->addCommand(kCmdWalk, -1, -1, this); // Hero->FindWay(this);
+ }
+ }
+}
+
+void CGEEngine::loadSprite(const char *fname, int ref, int scene, int col = 0, int row = 0, int pos = 0) {
+ static const char *Comd[] = { "Name", "Type", "Phase", "East",
+ "Left", "Right", "Top", "Bottom",
+ "Seq", "Near", "Take",
+ "Portable", "Transparent",
+ NULL
+ };
+ static const char *Type[] = { "DEAD", "AUTO", "WALK", "NEWTON", "LISSAJOUS",
+ "FLY", NULL
+ };
+
+ int shpcnt = 0;
+ int type = 0; // DEAD
+ bool east = false;
+ bool port = false;
+ bool tran = false;
+ int i, lcnt = 0;
+
+ char tmpStr[kLineMax + 1];
+ Common::String line;
+ mergeExt(tmpStr, fname, kSprExt);
+
+ if (_resman->exist(tmpStr)) { // sprite description file exist
+ EncryptedStream sprf(this, tmpStr);
+ if (sprf.err())
+ error("Bad SPR [%s]", tmpStr);
+
+ uint16 len;
+ for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()) {
+ len = line.size();
+ lcnt++;
+ strcpy(tmpStr, line.c_str());
+ if (len == 0 || *tmpStr == '.')
+ continue;
+
+ if ((i = takeEnum(Comd, strtok(tmpStr, " =\t"))) < 0)
+ error("Bad line %d [%s]", lcnt, fname);
+
+
+ switch (i) {
+ case 0 : // Name - will be taken in Expand routine
+ break;
+ case 1 : // Type
+ if ((type = takeEnum(Type, strtok(NULL, " \t,;/"))) < 0)
+ error("Bad line %d [%s]", lcnt, fname);
+ break;
+ case 2 : // Phase
+ shpcnt++;
+ break;
+ case 3 : // East
+ east = (atoi(strtok(NULL, " \t,;/")) != 0);
+ break;
+ case 11 : // Portable
+ port = (atoi(strtok(NULL, " \t,;/")) != 0);
+ break;
+ case 12 : // Transparent
+ tran = (atoi(strtok(NULL, " \t,;/")) != 0);
+ break;
+ }
+ }
+ if (! shpcnt)
+ error("No shapes [%s]", fname);
+ } else {
+ // no sprite description: mono-shaped sprite with only .BMP file
+ ++shpcnt;
+ }
+
+ // make sprite of choosen type
+ switch (type) {
+ case 1:
+ // AUTO
+ _sprite = new Sprite(this, NULL);
+ if (_sprite) {
+ _sprite->gotoxy(col, row);
+ }
+ break;
+ case 2:
+ { // WALK
+ Walk *w = new Walk(this, NULL);
+ if (w && ref == 1) {
+ w->gotoxy(col, row);
+ if (_hero)
+ error("2nd HERO [%s]", fname);
+ _hero = w;
+ }
+ _sprite = w;
+ break;
+ }
+ case 3: // NEWTON
+ case 4: // LISSAJOUS
+ error("Bad type [%s]", fname);
+ break;
+ case 5:
+ { // FLY
+ Fly *f = new Fly(this, NULL);
+ _sprite = f;
+ break;
+ }
+ default:
+ // DEAD
+ _sprite = new Sprite(this, NULL);
+ if (_sprite)
+ _sprite->gotoxy(col, row);
+ break;
+ }
+
+ if (_sprite) {
+ _sprite->_ref = ref;
+ _sprite->_scene = scene;
+ _sprite->_z = pos;
+ _sprite->_flags._east = east;
+ _sprite->_flags._port = port;
+ _sprite->_flags._tran = tran;
+ _sprite->_flags._kill = true;
+ _sprite->_flags._bDel = true;
+
+ // Extract the filename, without the extension
+ strcpy(_sprite->_file, fname);
+ char *p = strchr(_sprite->_file, '.');
+ if (p)
+ *p = '\0';
+
+ _sprite->_shpCnt = shpcnt;
+ _vga->_spareQ->append(_sprite);
+ }
+}
+
+void CGEEngine::loadScript(const char *fname) {
+ EncryptedStream scrf(this, fname);
+
+ if (scrf.err())
+ return;
+
+ bool ok = true;
+ int lcnt = 0;
+
+ char tmpStr[kLineMax+1];
+ Common::String line;
+
+ for (line = scrf.readLine(); !scrf.eos(); line = scrf.readLine()) {
+ char *p;
+
+ lcnt++;
+ strcpy(tmpStr, line.c_str());
+ if ((line.size() == 0) || (*tmpStr == '.'))
+ continue;
+
+ ok = false; // not OK if break
+
+ // sprite ident number
+ if ((p = strtok(tmpStr, " \t\n")) == NULL)
+ break;
+ int SpI = atoi(p);
+
+ // sprite file name
+ char *SpN;
+ if ((SpN = strtok(NULL, " ,;/\t\n")) == NULL)
+ break;
+
+ // sprite scene
+ if ((p = strtok(NULL, " ,;/\t\n")) == NULL)
+ break;
+ int SpA = atoi(p);
+
+ // sprite column
+ if ((p = strtok(NULL, " ,;/\t\n")) == NULL)
+ break;
+ int SpX = atoi(p);
+
+ // sprite row
+ if ((p = strtok(NULL, " ,;/\t\n")) == NULL)
+ break;
+ int SpY = atoi(p);
+
+ // sprite Z pos
+ if ((p = strtok(NULL, " ,;/\t\n")) == NULL)
+ break;
+ int SpZ = atoi(p);
+
+ // sprite life
+ if ((p = strtok(NULL, " ,;/\t\n")) == NULL)
+ break;
+ bool BkG = atoi(p) == 0;
+
+ ok = true; // no break: OK
+
+ _sprite = NULL;
+ loadSprite(SpN, SpI, SpA, SpX, SpY, SpZ);
+ if (_sprite && BkG)
+ _sprite->_flags._back = true;
+ }
+
+ if (!ok)
+ error("Bad INI line %d [%s]", lcnt, fname);
+}
+
+Sprite *CGEEngine::locate(int ref) {
+ Sprite *spr = _vga->_showQ->locate(ref);
+ return (spr) ? spr : _vga->_spareQ->locate(ref);
+}
+
+Sprite *CGEEngine::spriteAt(int x, int y) {
+ Sprite *spr = NULL, * tail = _vga->_showQ->last();
+ if (tail) {
+ for (spr = tail->_prev; spr; spr = spr->_prev) {
+ if (! spr->_flags._hide && ! spr->_flags._tran) {
+ if (spr->shp()->solidAt(x - spr->_x, y - spr->_y))
+ break;
+ }
+ }
+ }
+ return spr;
+}
+
+Cluster CGEEngine::XZ(int16 x, int16 y) {
+ if (y < kMapTop)
+ y = kMapTop;
+
+ if (y > kMapTop + kMapHig - kMapGridZ)
+ y = kMapTop + kMapHig - kMapGridZ;
+
+ return Cluster(this, x / kMapGridX, (y - kMapTop) / kMapGridZ);
+}
+
+void CGEEngine::killText() {
+ if (!_talk)
+ return;
+
+ _commandHandlerTurbo->addCommand(kCmdKill, -1, 0, _talk);
+ _talk = NULL;
+}
+
+void CGEEngine::mainLoop() {
+ _vga->show();
+ _commandHandlerTurbo->runCommand();
+ _commandHandler->runCommand();
+
+ // Handle a delay between game frames
+ handleFrame();
+
+ // Handle any pending events
+ _eventManager->poll();
+}
+
+void CGEEngine::handleFrame() {
+ // Game frame delay
+ uint32 millis = g_system->getMillis();
+ while (!_eventManager->_quitFlag && (millis < (_lastFrame + kGameFrameDelay))) {
+ // Handle any pending events
+ _eventManager->poll();
+
+ if (millis >= (_lastTick + kGameTickDelay)) {
+ // Dispatch the tick to any active objects
+ tick();
+ _lastTick = millis;
+ }
+
+ // Slight delay
+ g_system->delayMillis(5);
+ millis = g_system->getMillis();
+ }
+ _lastFrame = millis;
+
+ if (millis >= (_lastTick + kGameTickDelay)) {
+ // Dispatch the tick to any active objects
+ tick();
+ _lastTick = millis;
+ }
+}
+
+void CGEEngine::tick() {
+ for (Sprite *spr = _vga->_showQ->first(); spr; spr = spr->_next) {
+ if (spr->_time) {
+ if (!spr->_flags._hide) {
+ if (--spr->_time == 0)
+ spr->tick();
+ }
+ }
+ }
+}
+
+void CGEEngine::loadUser() {
+ // set scene
+ if (_mode == 0) {
+ // user .SVG file found - load it from slot 0
+ loadGame(0, NULL);
+ } else if (_mode == 1) {
+ // Load either initial game state savegame or launcher specified savegame
+ loadGame(_startGameSlot, NULL);
+ } else {
+ error("Creating setup savegames not supported");
+ }
+ loadScript("CGE.IN0");
+}
+
+void CGEEngine::runGame() {
+ if (_eventManager->_quitFlag)
+ return;
+
+ loadHeroXY();
+
+ _sceneLight->_flags._tran = true;
+ _vga->_showQ->append(_sceneLight);
+ _sceneLight->_flags._hide = true;
+
+ const Seq pocSeq[] = {
+ { 0, 0, 0, 0, 20 },
+ { 1, 2, 0, 0, 4 },
+ { 2, 3, 0, 0, 4 },
+ { 3, 4, 0, 0, 16 },
+ { 2, 5, 0, 0, 4 },
+ { 1, 6, 0, 0, 4 },
+ { 0, 1, 0, 0, 16 },
+ };
+ Seq *seq = (Seq *)malloc(7 * sizeof(Seq));
+ Common::copy(pocSeq, pocSeq + 7, seq);
+ _pocLight->setSeq(seq);
+
+ _pocLight->_flags._tran = true;
+ _pocLight->_time = 1;
+ _pocLight->_z = 120;
+ _vga->_showQ->append(_pocLight);
+ selectPocket(-1);
+
+ _vga->_showQ->append(_mouse);
+
+// ___________
+ loadUser();
+// ~~~~~~~~~~~
+
+ if ((_sprite = _vga->_spareQ->locate(121)) != NULL)
+ _commandHandlerTurbo->addCommand(kCmdSeq, -1, _vga->_mono, _sprite);
+ if ((_sprite = _vga->_spareQ->locate(122)) != NULL)
+ _sprite->step(_music);
+ _commandHandlerTurbo->addCommand(kCmdSeq, -1, _music, _sprite);
+ if (!_music)
+ _midiPlayer->killMidi();
+
+ if (_resman->exist("MINI.SPR")) {
+ _miniShp = new BitmapPtr[2];
+ _miniShp[0] = _miniShp[1] = NULL;
+
+ loadSprite("MINI", -1, 0, kMiniX, kMiniY);
+ expandSprite(_miniScene = _sprite); // NULL is ok
+ if (_miniScene) {
+ _miniScene->_flags._kill = false;
+ _miniScene->_flags._hide = true;
+ _miniShp[0] = new Bitmap(this, *_miniScene->shp());
+ _miniShpList = _miniScene->setShapeList(_miniShp);
+ postMiniStep(-1);
+ }
+ }
+
+ if (_hero) {
+ expandSprite(_hero);
+ _hero->gotoxy(_heroXY[_now - 1].x, _heroXY[_now - 1].y);
+ if (_resman->exist("00SHADOW.SPR")) {
+ loadSprite("00SHADOW", -1, 0, _hero->_x + 14, _hero->_y + 51);
+ delete _shadow;
+ if ((_shadow = _sprite) != NULL) {
+ _shadow->_ref = 2;
+ _shadow->_flags._tran = true;
+ _shadow->_flags._kill = false;
+ _hero->_flags._shad = true;
+ _vga->_showQ->insert(_vga->_spareQ->remove(_shadow), _hero);
+ }
+ }
+ }
+
+ _infoLine->gotoxy(kInfoX, kInfoY);
+ _infoLine->_flags._tran = true;
+ _infoLine->update(NULL);
+ _vga->_showQ->insert(_infoLine);
+
+ _debugLine->_z = 126;
+ _vga->_showQ->insert(_debugLine);
+
+ if (_horzLine) {
+ _horzLine->_y = kMapTop - (kMapTop > 0);
+ _horzLine->_z = 126;
+ _vga->_showQ->insert(_horzLine);
+ }
+
+ _mouse->_busy = _vga->_spareQ->locate(kBusyRef);
+ if (_mouse->_busy)
+ expandSprite(_mouse->_busy);
+
+ _startupMode = 0;
+
+ _commandHandler->addCommand(kCmdLevel, -1, _oldLev, &_sceneLight);
+ _sceneLight->gotoxy(kSceneX + ((_now - 1) % kSceneNx) * kSceneDx + kSceneSX,
+ kSceneY + ((_now - 1) / kSceneNx) * kSceneDy + kSceneSY);
+ sceneUp();
+
+ _keyboard->setClient(_sys);
+ // main loop
+ while (!_finis && !_eventManager->_quitFlag) {
+ if (_flag[3])
+ _commandHandler->addCallback(kCmdExec, -1, 0, kQGame);
+ mainLoop();
+ }
+
+ // If finishing game due to closing ScummVM window, explicitly save the game
+ if (!_finis && canSaveGameStateCurrently())
+ qGame();
+
+ _keyboard->setClient(NULL);
+ _commandHandler->addCommand(kCmdClear, -1, 0, NULL);
+ _commandHandlerTurbo->addCommand(kCmdClear, -1, 0, NULL);
+ _mouse->off();
+ _vga->_showQ->clear();
+ _vga->_spareQ->clear();
+ _hero = NULL;
+ _shadow = NULL;
+}
+
+void CGEEngine::movie(const char *ext) {
+ assert(ext);
+
+ if (_eventManager->_quitFlag)
+ return;
+
+ char fn[12];
+ sprintf(fn, "CGE.%s", (*ext == '.') ? ext +1 : ext);
+
+ if (_resman->exist(fn)) {
+ loadScript(fn);
+ expandSprite(_vga->_spareQ->locate(999));
+ feedSnail(_vga->_showQ->locate(999), kTake);
+ _vga->_showQ->append(_mouse);
+ _keyboard->setClient(_sys);
+ while (!_commandHandler->idle() && !_eventManager->_quitFlag)
+ mainLoop();
+
+ _keyboard->setClient(NULL);
+ _commandHandler->addCommand(kCmdClear, -1, 0, NULL);
+ _commandHandlerTurbo->addCommand(kCmdClear, -1, 0, NULL);
+ _vga->_showQ->clear();
+ _vga->_spareQ->clear();
+ }
+}
+
+bool CGEEngine::showTitle(const char *name) {
+ if (_eventManager->_quitFlag)
+ return false;
+
+ _bitmapPalette = _vga->_sysPal;
+ BitmapPtr *LB = new BitmapPtr[2];
+ LB[0] = new Bitmap(this, name);
+ LB[1] = NULL;
+ _bitmapPalette = NULL;
+
+ Sprite D(this, LB);
+ D._flags._kill = true;
+ D._flags._bDel = true;
+ D.center();
+ D.show(2);
+
+ if (_mode == 2) {
+ inf(kSavegame0Name);
+ _talk->show(2);
+ }
+
+ _vga->sunset();
+ _vga->copyPage(1, 2);
+ _vga->copyPage(0, 1);
+ 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 (_eventManager->_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
+ movie(kPaylistExt); // paylist
+ _vga->copyPage(1, 2);
+ _vga->copyPage(0, 1);
+ _vga->_showQ->append(_mouse);
+ // In the original game, the user had to enter his name
+ // As it was only used to name savegames, it has been removed
+ _vga->_showQ->clear();
+ _vga->copyPage(0, 2);
+
+ if (_mode == 0) {
+// The auto-load of savegame #0 is currently disabled
+#if 0
+ if (savegameExists(0)) {
+ // Load the savegame
+ loadGame(0, NULL, true); // only system vars
+ _vga->setColors(_vga->_sysPal, 64);
+ _vga->update();
+ if (_flag[3]) { //flag FINIS
+ _mode++;
+ _flag[3] = false;
+ }
+ } else
+#endif
+ _mode++;
+ }
+ }
+
+ if (_mode < 2)
+ movie(kWinkExt);
+
+ _vga->copyPage(0, 2);
+
+ return true;
+}
+
+void CGEEngine::cge_main() {
+ memset(_barriers, 0xFF, sizeof(_barriers));
+
+ if (!_mouse->_exist)
+ error("%s", _text->getText(kTextNoMouse));
+
+ if (!_resman->exist(kSavegame0Name))
+ _mode = 2;
+
+ _debugLine->_flags._hide = true;
+ if (_horzLine)
+ _horzLine->_flags._hide = true;
+
+ if (_music && _soundOk)
+ _midiPlayer->loadMidi(0);
+
+ if (_startGameSlot != -1) {
+ // Starting up a savegame from the launcher
+ _mode++;
+ runGame();
+
+ _startupMode = 2;
+ if (_flag[3]) // Flag FINIS
+ movie(kEndgExt);
+ } else {
+ if (_mode < 2)
+ movie(kLgoExt);
+
+ if (showTitle("WELCOME")) {
+ if (_mode == 1)
+ movie(kIntroExt);
+ runGame();
+ _startupMode = 2;
+ if (_flag[3]) // Flag FINIS
+ movie(kEndgExt);
+ } else
+ _vga->sunset();
+ }
+}
+
+} // End of namespace CGE
diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h
new file mode 100644
index 0000000000..bdb3121d63
--- /dev/null
+++ b/engines/cge/cge_main.h
@@ -0,0 +1,114 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#ifndef CGE_CGEMAIN_H
+#define CGE_CGEMAIN_H
+
+#include "cge/events.h"
+
+namespace CGE {
+
+#define kSceneX 4
+#define kSceneY 166
+#define kSceneSX 0
+#define kSceneSY 0
+#define kInfoX 177
+#define kInfoY 164
+#define kInfoW 140
+#define kButtonX 151
+#define kButtonY 164
+#define kMiniX 86
+#define kMiniY 162
+#define kLineMax 512
+#define kDistMax 3
+#define kLgoExt ".LGO"
+#define kSvgExt ".SVG"
+#define kPaylistExt ".X00"
+#define kWinkExt ".X01"
+#define kIntroExt ".X02"
+#define kEndgExt ".X03"
+#define kWalkSide 10
+#define kBusyRef 500
+#define kSystemRate 6 // 12 Hz
+#define kHeroFun0 (40 * 12)
+#define kHeroFun1 ( 2 * 12)
+#define kGetNamePrompt 50
+#define kGetNameTitle 51
+#define kTSeq 96
+#define kNoMusic 98
+#define kBadSVG 99
+#define kSeqHTalk (kTSeq + 4)
+#define kSeqTooFar (kTSeq + 5)
+#define kSeqNoWay (kTSeq + 5)
+#define kSeqPocketFull (kTSeq + 5)
+#define kSeqOffUse (kTSeq + 6)
+#define kQuitTitle 200
+#define kQuit 201
+#define kNoQuit 202
+#define kDemo 300
+#define kOffUseCount 600
+#define kOffUse 601
+#define kNoWay 671
+#define kTooFar 681
+#define kPocketFull 691
+#define kPanHeight 40
+#define kScrWidth 320
+#define kScrHeight 200
+#define kWorldHeight (kScrHeight - kPanHeight)
+#define kStackSize 2048
+#define kSavegameCheckSum (1956 + _now + _oldLev + _game + _music + _demoText)
+#define kSavegame0Name ("{{INIT}}" kSvgExt)
+#define kSavegame0File EncryptedStream
+#define kSavegameStrSize 11
+#define kGameFrameDelay (1000 / 50)
+#define kGameTickDelay (1000 / 62)
+
+class System : public Sprite {
+public:
+ int _funDel;
+
+ System(CGEEngine *vm);
+
+ void setPal();
+ void funTouch();
+ virtual void touch(uint16 mask, int x, int y);
+ void tick();
+private:
+ CGEEngine *_vm;
+};
+
+class Square : public Sprite {
+public:
+ Square(CGEEngine *vm);
+ virtual void touch(uint16 mask, int x, int y);
+private:
+ CGEEngine *_vm;
+};
+
+} // End of namespace CGE
+
+#endif
diff --git a/engines/cge/console.cpp b/engines/cge/console.cpp
new file mode 100644
index 0000000000..71eedf34ea
--- /dev/null
+++ b/engines/cge/console.cpp
@@ -0,0 +1,34 @@
+/* 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 "cge/console.h"
+#include "cge/cge.h"
+
+namespace CGE {
+
+CGEConsole::CGEConsole(CGEEngine *vm) : GUI::Debugger(), _vm(vm) {
+}
+
+CGEConsole::~CGEConsole() {
+}
+
+} // End of namespace CGE
diff --git a/engines/cge/console.h b/engines/cge/console.h
new file mode 100644
index 0000000000..25a1a4fae3
--- /dev/null
+++ b/engines/cge/console.h
@@ -0,0 +1,43 @@
+/* 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.
+ *
+ */
+
+#ifndef CGE_CONSOLE_H
+#define CGE_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace CGE {
+
+class CGEEngine;
+
+class CGEConsole : public GUI::Debugger {
+public:
+ CGEConsole(CGEEngine *vm);
+ virtual ~CGEConsole();
+
+private:
+ CGEEngine *_vm;
+};
+
+} // End of namespace CGE
+
+#endif
diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp
new file mode 100644
index 0000000000..8b90bd1483
--- /dev/null
+++ b/engines/cge/detection.cpp
@@ -0,0 +1,240 @@
+/* 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 "common/config-manager.h"
+#include "engines/advancedDetector.h"
+#include "common/savefile.h"
+#include "common/system.h"
+#include "base/plugins.h"
+#include "graphics/thumbnail.h"
+#include "cge/cge.h"
+
+static const PlainGameDescriptor CGEGames[] = {
+ { "soltys", "Soltys" },
+ { 0, 0 }
+};
+
+namespace CGE {
+
+using Common::GUIO_NONE;
+
+static const ADGameDescription gameDescriptions[] = {
+
+ {
+ "soltys", "",
+ {
+ {"vol.cat", 0, "0c33e2c304821a2444d297fc5e2d67c6", 50176},
+ {"vol.dat", 0, "f9ae2e7f8f7cac91378cdafca43faf1e", 8437572},
+ AD_LISTEND
+ },
+ Common::PL_POL, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO_NONE
+ },
+ {
+ "soltys", "Soltys Freeware",
+ {
+ {"vol.cat", 0, "0c33e2c304821a2444d297fc5e2d67c6", 50176},
+ {"vol.dat", 0, "f9ae2e7f8f7cac91378cdafca43faf1e", 8437676},
+ AD_LISTEND
+ },
+ Common::PL_POL, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO_NONE
+ },
+ // English ScummVM version
+ {
+ "soltys", "",
+ {
+ {"vol.cat", 0, "bd08969b5f1acea0f92d195f750c17d5", 50176},
+ {"vol.dat", 0, "f9ae2e7f8f7cac91378cdafca43faf1e", 8428832},
+ AD_LISTEND
+ },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO_NONE
+ },
+ {
+ "soltys", "Soltys Demo (not supported)",
+ {
+ {"vol.cat", 0, "1e077c8ff58109a187f07ac54b0c873a", 18788},
+ {"vol.dat", 0, "75d385a6074c58b69f7730481f256051", 1796710},
+ AD_LISTEND
+ },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO , GUIO_NONE
+ },
+ {
+ "soltys", "Soltys Demo (not supported)",
+ {
+ {"vol.cat", 0, "f17987487fab1ebddd781d8d02fedecc", 7168},
+ {"vol.dat", 0, "c5d9b15863cab61dc125551576dece04", 1075272},
+ AD_LISTEND
+ },
+ Common::PL_POL, Common::kPlatformPC, ADGF_DEMO , GUIO_NONE
+ },
+ AD_TABLE_END_MARKER
+};
+
+static const ADFileBasedFallback fileBasedFallback[] = {
+ { &gameDescriptions[0], { "vol.cat", "vol.dat", 0 } },
+ { 0, { 0 } }
+};
+
+} // End of namespace CGE
+
+class CGEMetaEngine : public AdvancedMetaEngine {
+public:
+ CGEMetaEngine() : AdvancedMetaEngine(CGE::gameDescriptions, sizeof(ADGameDescription), CGEGames) {
+ _singleid = "Soltys";
+ }
+
+ virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
+ return detectGameFilebased(allFiles, CGE::fileBasedFallback);
+ }
+
+ virtual const char *getName() const {
+ return "CGE";
+ }
+
+ virtual const char *getOriginalCopyright() const {
+ return "Soltys (c) 1994-1996 L.K. Avalon";
+ }
+
+
+
+ virtual bool hasFeature(MetaEngineFeature f) const;
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+ virtual int getMaximumSaveSlot() const;
+ virtual SaveStateList listSaves(const char *target) const;
+ SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
+ virtual void removeSaveState(const char *target, int slot) const;
+};
+
+bool CGEMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return
+ (f == kSupportsListSaves) ||
+ (f == kSupportsLoadingDuringStartup) ||
+ (f == kSupportsDeleteSave) ||
+ (f == kSavesSupportMetaInfo) ||
+ (f == kSavesSupportThumbnail) ||
+ (f == kSavesSupportCreationDate);
+}
+
+void CGEMetaEngine::removeSaveState(const char *target, int slot) const {
+ Common::String fileName = Common::String::format("%s.%03d", target, slot);
+ g_system->getSavefileManager()->removeSavefile(fileName);
+}
+
+int CGEMetaEngine::getMaximumSaveSlot() const {
+ return 99;
+}
+
+SaveStateList CGEMetaEngine::listSaves(const char *target) const {
+ Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+ Common::StringArray filenames;
+ Common::String pattern = target;
+ pattern += ".???";
+
+ filenames = saveFileMan->listSavefiles(pattern);
+ sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
+
+ SaveStateList saveList;
+ int slotNum = 0;
+ for (Common::StringArray::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename) {
+ // Obtain the last 3 digits of the filename, since they correspond to the save slot
+ slotNum = atoi(filename->c_str() + filename->size() - 3);
+
+ if (slotNum >= 0 && slotNum <= 99) {
+
+ Common::InSaveFile *file = saveFileMan->openForLoading(*filename);
+ if (file) {
+ CGE::SavegameHeader header;
+
+ // Check to see if it's a ScummVM savegame or not
+ char buffer[kSavegameStrSize + 1];
+ file->read(buffer, kSavegameStrSize + 1);
+
+ if (!strncmp(buffer, CGE::savegameStr, kSavegameStrSize + 1)) {
+ // Valid savegame
+ if (CGE::CGEEngine::readSavegameHeader(file, header)) {
+ saveList.push_back(SaveStateDescriptor(slotNum, header.saveName));
+ delete header.thumbnail;
+ }
+ } else {
+ // Must be an original format savegame
+ saveList.push_back(SaveStateDescriptor(slotNum, "Unknown"));
+ }
+
+ delete file;
+ }
+ }
+ }
+
+ return saveList;
+}
+
+SaveStateDescriptor CGEMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+ Common::String fileName = Common::String::format("%s.%03d", target, slot);
+ Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName);
+
+ if (f) {
+ CGE::SavegameHeader header;
+
+ // Check to see if it's a ScummVM savegame or not
+ char buffer[kSavegameStrSize + 1];
+ f->read(buffer, kSavegameStrSize + 1);
+
+ bool hasHeader = !strncmp(buffer, CGE::savegameStr, kSavegameStrSize + 1) &&
+ CGE::CGEEngine::readSavegameHeader(f, header);
+ delete f;
+
+ if (!hasHeader) {
+ // Original savegame perhaps?
+ SaveStateDescriptor desc(slot, "Unknown");
+ return desc;
+ } else {
+ // Create the return descriptor
+ SaveStateDescriptor desc(slot, header.saveName);
+ desc.setDeletableFlag(true);
+ desc.setWriteProtectedFlag(false);
+ desc.setThumbnail(header.thumbnail);
+ desc.setSaveDate(header.saveYear, header.saveMonth, header.saveDay);
+ desc.setSaveTime(header.saveHour, header.saveMinutes);
+
+ // Slot 0 is used for the 'automatic save on exit' save in Soltys, thus
+ // we prevent it from being deleted or overwritten by accident.
+ desc.setDeletableFlag(slot != 0);
+ desc.setWriteProtectedFlag(slot == 0);
+
+ return desc;
+ }
+ }
+
+ return SaveStateDescriptor();
+}
+
+bool CGEMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ if (desc) {
+ *engine = new CGE::CGEEngine(syst, desc);
+ }
+ return desc != 0;
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(CGE)
+REGISTER_PLUGIN_DYNAMIC(CGE, PLUGIN_TYPE_ENGINE, CGEMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(CGE, PLUGIN_TYPE_ENGINE, CGEMetaEngine);
+#endif
diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp
new file mode 100644
index 0000000000..cc22d9075a
--- /dev/null
+++ b/engines/cge/events.cpp
@@ -0,0 +1,378 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#include "gui/saveload.h"
+#include "gui/about.h"
+#include "gui/message.h"
+#include "common/config-manager.h"
+#include "common/events.h"
+#include "cge/events.h"
+#include "cge/events.h"
+#include "cge/text.h"
+#include "cge/cge_main.h"
+
+namespace CGE {
+
+/*----------------- KEYBOARD interface -----------------*/
+
+const uint16 Keyboard::_code[0x60] = {
+ 0, Esc, '1', '2', '3',
+ '4', '5', '6', '7', '8',
+ '9', '0', '-', '+', BSp,
+ Tab, 'Q', 'W', 'E', 'R',
+ 'T', 'Y', 'U', 'I', 'O',
+ 'P', '[', ']', Enter, 0/*Ctrl*/,
+ 'A', 'S', 'D', 'F', 'G',
+ 'H', 'J', 'K', 'L', ';',
+ '\'', '`', 0/*LShift*/, '\\', 'Z',
+ 'X', 'C', 'V', 'B', 'N',
+ 'M', ',', '.', '/', 0/*RShift*/,
+ '*', 0/*Alt*/, ' ', 0/*Caps*/, F1,
+ F2, F3, F4, F5, F6,
+ F7, F8, F9, F10, 0/*NumLock*/,
+ 0/*ScrollLock*/, Home, Up, PgUp, '-',
+ Left, Ctr, Right, '+', End,
+ Down, PgDn, Ins, Del, 0 * 0x54,
+ 0 * 0x55, 0 * 0x56, F11, F12, 0 * 0x59,
+ 0 * 0x5A, 0 * 0x5B, 0 * 0x5C, 0 * 0x5D, 0 * 0x5E,
+ 0 * 0x5F
+};
+
+const uint16 Keyboard::_scummVmCodes[0x60] = {
+ 0, Common::KEYCODE_ESCAPE, Common::KEYCODE_1, Common::KEYCODE_2, Common::KEYCODE_3,
+ Common::KEYCODE_4, Common::KEYCODE_5, Common::KEYCODE_6, Common::KEYCODE_7, Common::KEYCODE_8,
+ Common::KEYCODE_9, Common::KEYCODE_0, Common::KEYCODE_MINUS, Common::KEYCODE_PLUS, Common::KEYCODE_BACKSPACE,
+ Common::KEYCODE_TAB, Common::KEYCODE_q, Common::KEYCODE_w, Common::KEYCODE_e, Common::KEYCODE_r,
+ Common::KEYCODE_t, Common::KEYCODE_y, Common::KEYCODE_u, Common::KEYCODE_i, Common::KEYCODE_o,
+ Common::KEYCODE_p, Common::KEYCODE_LEFTBRACKET, Common::KEYCODE_RIGHTBRACKET, Common::KEYCODE_RETURN, 0/*Ctrl*/,
+ Common::KEYCODE_a, Common::KEYCODE_s, Common::KEYCODE_d, Common::KEYCODE_f, Common::KEYCODE_g,
+ Common::KEYCODE_h, Common::KEYCODE_j, Common::KEYCODE_k, Common::KEYCODE_l, Common::KEYCODE_SEMICOLON,
+ Common::KEYCODE_BACKSLASH, Common::KEYCODE_TILDE, Common::KEYCODE_LSHIFT, Common::KEYCODE_BACKSLASH, Common::KEYCODE_z,
+ Common::KEYCODE_x, Common::KEYCODE_c, Common::KEYCODE_v, Common::KEYCODE_b, Common::KEYCODE_n,
+ Common::KEYCODE_m, Common::KEYCODE_COMMA, Common::KEYCODE_PERIOD, Common::KEYCODE_SLASH, Common::KEYCODE_RSHIFT,
+ Common::KEYCODE_KP_MULTIPLY, 0 /*Alt*/, Common::KEYCODE_SPACE, Common::KEYCODE_CAPSLOCK, Common::KEYCODE_F1,
+ Common::KEYCODE_F2, Common::KEYCODE_F3, Common::KEYCODE_F4, Common::KEYCODE_F5, Common::KEYCODE_F6,
+ Common::KEYCODE_F7, Common::KEYCODE_F8, Common::KEYCODE_F9, Common::KEYCODE_F10, Common::KEYCODE_NUMLOCK,
+ Common::KEYCODE_SCROLLOCK, Common::KEYCODE_KP7, Common::KEYCODE_KP8, Common::KEYCODE_KP9, Common::KEYCODE_KP_MINUS,
+ Common::KEYCODE_KP4, Common::KEYCODE_KP5, Common::KEYCODE_KP6, Common::KEYCODE_KP_PLUS, Common::KEYCODE_KP1,
+ Common::KEYCODE_KP2, Common::KEYCODE_KP3, Common::KEYCODE_KP0, Common::KEYCODE_KP_PERIOD, 0,
+ 0, 0, Common::KEYCODE_F11, Common::KEYCODE_F12, 0,
+ 0, 0, 0, 0, 0,
+ 0
+};
+
+Keyboard::Keyboard(CGEEngine *vm) : _client(NULL), _vm(vm) {
+ Common::set_to(&_key[0], &_key[0x60], false);
+ _current = 0;
+}
+
+Keyboard::~Keyboard() {
+}
+
+Sprite *Keyboard::setClient(Sprite *spr) {
+ SWAP(_client, spr);
+ return spr;
+}
+
+bool Keyboard::getKey(Common::Event &event, int &cgeCode) {
+ Common::KeyCode keycode = event.kbd.keycode;
+ if ((keycode == Common::KEYCODE_LCTRL) || (keycode == Common::KEYCODE_RCTRL)) {
+ cgeCode = kKeyCtrl;
+ return true;
+ }
+ if ((keycode == Common::KEYCODE_LALT) || (keycode == Common::KEYCODE_RALT)) {
+ cgeCode = kKeyAlt;
+ return true;
+ }
+ if (keycode == Common::KEYCODE_KP_ENTER) {
+ cgeCode = 28;
+ return true;
+ }
+ if (keycode == Common::KEYCODE_F5) {
+ warning("keycode %d", event.kbd.ascii);
+ if (_vm->canSaveGameStateCurrently()) {
+ const EnginePlugin *plugin = NULL;
+ EngineMan.findGame(_vm->_gameDescription->gameid, &plugin);
+
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save");
+ dialog->setSaveMode(true);
+ int16 savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ Common::String savegameDescription = dialog->getResultString();
+ delete dialog;
+ _vm->saveGameState(savegameId, savegameDescription);
+ }
+ return false;
+ } else if (keycode == Common::KEYCODE_F7) {
+ if (_vm->canLoadGameStateCurrently()) {
+ const EnginePlugin *plugin = NULL;
+ EngineMan.findGame(_vm->_gameDescription->gameid, &plugin);
+
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore");
+ dialog->setSaveMode(false);
+ int16 savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ delete dialog;
+ _vm->loadGameState(savegameId);
+ }
+ return false;
+ }
+
+ // Scan through the ScummVM mapping list
+ for (int idx = 0; idx < 0x60; idx++) {
+ if (_scummVmCodes[idx] == event.kbd.ascii) {
+ cgeCode = idx;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void Keyboard::newKeyboard(Common::Event &event) {
+ int keycode;
+ if (!getKey(event, keycode))
+ return;
+
+ if (event.type == Common::EVENT_KEYUP) {
+ // Key release
+ _key[keycode] = false;
+ } else if (event.type == Common::EVENT_KEYDOWN) {
+ // Key press
+ _key[keycode] = true;
+ _current = Keyboard::_code[keycode];
+
+ if (_client) {
+ CGEEvent &evt = _vm->_eventManager->getNextEvent();
+ evt._x = _current; // Keycode
+ evt._mask = kEventKeyb; // Event mask
+ evt._spritePtr = _client; // Sprite pointer
+ }
+ }
+}
+
+uint16 Keyboard::lastKey() {
+ uint16 cur = _current;
+ _current = 0;
+ return cur;
+}
+
+/*----------------- MOUSE interface -----------------*/
+
+Mouse::Mouse(CGEEngine *vm) : Sprite(vm, NULL), _busy(NULL), _hold(NULL), _hx(0), _vm(vm) {
+ _hold = NULL;
+ _hx = 0;
+ _hy = 0;
+ _exist = true;
+ _buttons = 0;
+ _busy = NULL;
+ _active = false;
+ _flags._kill = false;
+
+ const Seq ms[] = {
+ { 0, 0, 0, 0, 1 },
+ { 1, 1, 0, 0, 1 }
+ };
+ Seq *seq = (Seq *)malloc(2 * sizeof(Seq));
+ Common::copy(ms, ms + 2, seq);
+ setSeq(seq);
+
+ BitmapPtr *MC = new BitmapPtr[3];
+ MC[0] = new Bitmap(_vm, "MOUSE");
+ MC[1] = new Bitmap(_vm, "DUMMY");
+ MC[2] = NULL;
+ setShapeList(MC);
+
+ gotoxy(kScrWidth / 2, kScrHeight / 2);
+ _z = 127;
+ step(1);
+}
+
+Mouse::~Mouse() {
+ off();
+}
+
+void Mouse::on() {
+ if (_seqPtr && _exist) {
+ _active = true;
+ step(0);
+ if (_busy)
+ _busy->step(0);
+ }
+}
+
+void Mouse::off() {
+ if (_seqPtr == 0) {
+ if (_exist) {
+ _active = false;
+ }
+
+ step(1);
+ if (_busy)
+ _busy->step(1);
+ }
+}
+
+void Mouse::newMouse(Common::Event &event) {
+ if (!_active)
+ return;
+
+ CGEEvent &evt = _vm->_eventManager->getNextEvent();
+ evt._x = event.mouse.x;
+ evt._y = event.mouse.y;
+ evt._spritePtr = _vm->spriteAt(evt._x, evt._y);
+
+ switch (event.type) {
+ case Common::EVENT_MOUSEMOVE:
+ evt._mask = kMouseRoll;
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ evt._mask = kMouseLeftDown;
+ _buttons |= 1;
+ break;
+ case Common::EVENT_LBUTTONUP:
+ evt._mask = kMouseLeftUp;
+ _buttons &= ~1;
+ break;
+ case Common::EVENT_RBUTTONDOWN:
+ evt._mask = kMouseRightDown;
+ _buttons |= 2;
+ break;
+ case Common::EVENT_RBUTTONUP:
+ evt._mask = kMouseRightUp;
+ _buttons &= ~2;
+ break;
+ default:
+ break;
+ }
+}
+
+/*----------------- EventManager interface -----------------*/
+
+EventManager::EventManager(CGEEngine *vm) : _vm(vm){
+ _quitFlag = false;
+ _eventQueueHead = 0;
+ _eventQueueTail = 0;
+ memset(&_eventQueue, 0, kEventMax * sizeof(CGEEvent));
+ memset(&_event, 0, sizeof(Common::Event));
+}
+
+void EventManager::poll() {
+ while (g_system->getEventManager()->pollEvent(_event)) {
+ switch (_event.type) {
+ case Common::EVENT_QUIT:
+ // Signal to quit
+ _quitFlag = true;
+ return;
+ case Common::EVENT_KEYDOWN:
+ case Common::EVENT_KEYUP:
+ // Handle keyboard events
+ _vm->_keyboard->newKeyboard(_event);
+ handleEvents();
+ break;
+ case Common::EVENT_MOUSEMOVE:
+ case Common::EVENT_LBUTTONDOWN:
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONDOWN:
+ case Common::EVENT_RBUTTONUP:
+ // Handle mouse events
+ _vm->_mouse->newMouse(_event);
+ handleEvents();
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+void EventManager::handleEvents() {
+ while (_eventQueueTail != _eventQueueHead) {
+ CGEEvent e = _eventQueue[_eventQueueTail];
+ if (e._mask) {
+ if (_vm->_mouse->_hold && e._spritePtr != _vm->_mouse->_hold)
+ _vm->_mouse->_hold->touch(e._mask | kEventAttn, e._x - _vm->_mouse->_hold->_x, e._y - _vm->_mouse->_hold->_y);
+
+ // update mouse cursor position
+ if (e._mask & kMouseRoll)
+ _vm->_mouse->gotoxy(e._x, e._y);
+
+ // activate current touched SPRITE
+ if (e._spritePtr) {
+ if (e._mask & kEventKeyb)
+ e._spritePtr->touch(e._mask, e._x, e._y);
+ else
+ e._spritePtr->touch(e._mask, e._x - e._spritePtr->_x, e._y - e._spritePtr->_y);
+ } else if (_vm->_sys)
+ _vm->_sys->touch(e._mask, e._x, e._y);
+
+ if (e._mask & kMouseLeftDown) {
+ _vm->_mouse->_hold = e._spritePtr;
+ if (_vm->_mouse->_hold) {
+ _vm->_mouse->_hold->_flags._hold = true;
+
+ if (_vm->_mouse->_hold->_flags._drag) {
+ _vm->_mouse->_hx = e._x - _vm->_mouse->_hold->_x;
+ _vm->_mouse->_hy = e._y - _vm->_mouse->_hold->_y;
+ }
+ }
+ }
+
+ if (e._mask & kMouseLeftUp) {
+ if (_vm->_mouse->_hold) {
+ _vm->_mouse->_hold->_flags._hold = false;
+ _vm->_mouse->_hold = NULL;
+ }
+ }
+ ///Touched = e.Ptr;
+
+ // discard Text if button released
+ if (e._mask & (kMouseLeftUp | kMouseRightUp))
+ _vm->killText();
+ }
+ _eventQueueTail = (_eventQueueTail + 1) % kEventMax;
+ }
+ if (_vm->_mouse->_hold) {
+ if (_vm->_mouse->_hold->_flags._drag)
+ _vm->_mouse->_hold->gotoxy(_vm->_mouse->_x - _vm->_mouse->_hx, _vm->_mouse->_y - _vm->_mouse->_hy);
+ }
+}
+
+void EventManager::clearEvent(Sprite *spr) {
+ if (spr) {
+ for (uint16 e = _eventQueueTail; e != _eventQueueHead; e = (e + 1) % kEventMax)
+ if (_eventQueue[e]._spritePtr == spr)
+ _eventQueue[e]._mask = 0;
+ } else
+ _eventQueueTail = _eventQueueHead;
+}
+
+CGEEvent &EventManager::getNextEvent() {
+ CGEEvent &evt = _eventQueue[_eventQueueHead];
+ _eventQueueHead = (_eventQueueHead + 1) % kEventMax;
+
+ return evt;
+}
+
+} // End of namespace CGE
diff --git a/engines/cge/events.h b/engines/cge/events.h
new file mode 100644
index 0000000000..a4cdfed793
--- /dev/null
+++ b/engines/cge/events.h
@@ -0,0 +1,154 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#ifndef CGE_EVENTS_H
+#define CGE_EVENTS_H
+
+#include "common/events.h"
+#include "cge/game.h"
+#include "cge/talk.h"
+#include "cge/vga13h.h"
+
+namespace CGE {
+
+/*----------------- KEYBOARD interface -----------------*/
+
+#define kKeyCtrl 29
+#define kKeyAlt 56
+#define kEventMax 256
+
+enum EventMask {
+ kMouseRoll = 1 << 0,
+ kMouseLeftDown = 1 << 1,
+ kMouseLeftUp = 1 << 2,
+ kMouseRightDown = 1 << 3,
+ kMouseRightUp = 1 << 4,
+ kEventAttn = 1 << 5,
+ kEventKeyb = 1 << 7
+};
+
+enum Keys {
+ NoKey = 0, CtrlA, CtrlB, CtrlC, CtrlD, CtrlE, CtrlF, CtrlG, CtrlH,
+ CtrlI, CtrlJ, CtrlK, CtrlL, CtrlM, CtrlN, CtrlO, CtrlP,
+ CtrlQ, CtrlR, CtrlS, CtrlT, CtrlU, CtrlV, CtrlW, CtrlX,
+ CtrlY, CtrlZ,
+ BSp = 8, Tab,
+ Enter = 13,
+ Eof = 26, Esc,
+ AltQ = 256 + 16, AltW, AltE, AltR, AltT, AltY, AltU, AltI, AltO, AltP,
+ AltA = 256 + 30, AltS, AltD, AltF, AltG, AltH, AltJ, AltK, AltL,
+ AltZ = 256 + 44, AltX, AltC, AltV, AltB, AltN, AltM,
+ F11 = 256 + 87, F12,
+ F1 = 256 + 59, F2, F3, F4, F5, F6, F7, F8, F9, F10,
+ ShiftTab = 256 + 15,
+ ShiftF1 = 256 + 84, ShiftF2, ShiftF3, ShiftF4, ShiftF5,
+ ShiftF6, ShiftF7, ShiftF8, ShiftF9, ShiftF10,
+ CtrlF1 = 256 + 94, CtrlF2, CtrlF3, CtrlF4, CtrlF5,
+ CtrlF6, CtrlF7, CtrlF8, CtrlF9, CtrlF10,
+ AltF1 = 256 + 104, AltF2, AltF3, AltF4, AltF5,
+ AltF6, AltF7, AltF8, AltF9, AltF10,
+ Home = 256 + 71, Up, PgUp,
+ Left = 256 + 75, Ctr, Right,
+ End = 256 + 79, Down, PgDn, Ins, Del,
+ CtrlLeft = 256 + 115, CtrlRight, CtrlEnd, CtrlPgDn, CtrlHome,
+ CtrlPgUp = 256 + 132,
+ MouseLeft = 512 + 1, MouseRight,
+ TwiceLeft = 512 + 256 + 1, TwiceRight
+};
+
+class Keyboard {
+private:
+ bool getKey(Common::Event &event, int &cgeCode);
+ uint16 _current;
+ CGEEngine *_vm;
+public:
+ static const uint16 _code[0x60];
+ static const uint16 _scummVmCodes[0x60];
+
+ Sprite *_client;
+ bool _key[0x60];
+
+ void newKeyboard(Common::Event &event);
+ uint16 lastKey();
+ Sprite *setClient(Sprite *spr);
+
+ Keyboard(CGEEngine *vm);
+ ~Keyboard();
+};
+
+/*----------------- MOUSE interface -----------------*/
+
+struct CGEEvent {
+ uint16 _mask;
+ uint16 _x;
+ uint16 _y;
+ Sprite *_spritePtr;
+};
+
+class Mouse : public Sprite {
+public:
+ Sprite *_hold;
+ bool _active;
+ int _hx;
+ int _hy;
+ bool _exist;
+ int _buttons;
+ Sprite *_busy;
+ //Sprite *Touched;
+ Mouse(CGEEngine *vm);
+ ~Mouse();
+ void on();
+ void off();
+ void newMouse(Common::Event &event);
+private:
+ CGEEngine *_vm;
+};
+
+/*----------------- EventManager interface -----------------*/
+
+class EventManager {
+private:
+ CGEEngine *_vm;
+ Common::Event _event;
+ CGEEvent _eventQueue[kEventMax];
+ uint16 _eventQueueHead;
+ uint16 _eventQueueTail;
+
+ void handleEvents();
+public:
+ bool _quitFlag;
+
+ EventManager(CGEEngine *vm);
+ void poll();
+ void clearEvent(Sprite *spr);
+
+ CGEEvent &getNextEvent();
+};
+
+} // End of namespace CGE
+
+#endif
diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp
new file mode 100644
index 0000000000..6db0818287
--- /dev/null
+++ b/engines/cge/fileio.cpp
@@ -0,0 +1,240 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#include "common/system.h"
+#include "common/str.h"
+#include "common/debug.h"
+#include "common/debug-channels.h"
+#include "common/memstream.h"
+#include "cge/cge.h"
+#include "cge/fileio.h"
+
+namespace CGE {
+
+/*-----------------------------------------------------------------------
+ * BtPage
+ *-----------------------------------------------------------------------*/
+void BtPage::readBTree(Common::ReadStream &s) {
+ _header._count = s.readUint16LE();
+ _header._down = s.readUint16LE();
+
+ if (_header._down == kBtValNone) {
+ // Leaf list
+ for (int i = 0; i < kBtLeafCount; ++i) {
+ s.read(_leaf[i]._key, kBtKeySize);
+ _leaf[i]._pos = s.readUint32LE();
+ _leaf[i]._size = s.readUint16LE();
+ }
+ } else {
+ // Root index
+ for (int i = 0; i < kBtInnerCount; ++i) {
+ s.read(_inner[i]._key, kBtKeySize);
+ _inner[i]._down = s.readUint16LE();
+ }
+ }
+}
+
+/*-----------------------------------------------------------------------
+ * ResourceManager
+ *-----------------------------------------------------------------------*/
+ResourceManager::ResourceManager() {
+ debugC(1, kCGEDebugFile, "ResourceManager::ResourceManager()");
+
+ _datFile = new Common::File();
+ _datFile->open(kDatName);
+
+ _catFile = new Common::File();
+ _catFile->open(kCatName);
+
+ if ((!_datFile) || (!_catFile))
+ error("Unable to open data files");
+
+ for (int i = 0; i < kBtLevel; i++) {
+ _buff[i]._page = new BtPage;
+ _buff[i]._pageNo = kBtValNone;
+ _buff[i]._index = -1;
+ assert(_buff[i]._page != NULL);
+ }
+}
+
+ResourceManager::~ResourceManager() {
+ debugC(1, kCGEDebugFile, "ResourceManager::~ResourceManager()");
+ _datFile->close();
+ delete _datFile;
+
+ _catFile->close();
+ delete _catFile;
+
+ for (int i = 0; i < kBtLevel; i++)
+ delete _buff[i]._page;
+}
+
+uint16 ResourceManager::XCrypt(void *buf, uint16 length) {
+ byte *b = static_cast<byte *>(buf);
+
+ for (uint16 i = 0; i < length; i++)
+ *b++ ^= kCryptSeed;
+
+ return kCryptSeed;
+}
+
+bool ResourceManager::seek(int32 offs, int whence) {
+ return _datFile->seek(offs, whence);
+}
+
+uint16 ResourceManager::read(void *buf, uint16 length) {
+ if (!_datFile->isOpen())
+ return 0;
+
+ uint16 bytesRead = _datFile->read(buf, length);
+ if (!bytesRead)
+ error("Read %s - %d bytes", _datFile->getName(), length);
+ XCrypt(buf, length);
+ return bytesRead;
+}
+
+BtPage *ResourceManager::getPage(int level, uint16 pageId) {
+ debugC(1, kCGEDebugFile, "IoHand::getPage(%d, %d)", level, pageId);
+
+ if (_buff[level]._pageNo != pageId) {
+ int32 pos = pageId * kBtSize;
+ _buff[level]._pageNo = pageId;
+ assert(_catFile->size() > pos);
+ // In the original, there was a check verifying if the
+ // purpose was to write a new file. This should only be
+ // to create a new file, thus it was removed.
+ _catFile->seek(pageId * kBtSize, SEEK_SET);
+
+ // Read in the page
+ byte buffer[kBtSize];
+ int bytesRead = catRead(buffer, kBtSize);
+
+ // Unpack it into the page structure
+ Common::MemoryReadStream stream(buffer, bytesRead, DisposeAfterUse::NO);
+ _buff[level]._page->readBTree(stream);
+ _buff[level]._index = -1;
+ }
+ return _buff[level]._page;
+}
+
+BtKeypack *ResourceManager::find(const char *key) {
+ debugC(1, kCGEDebugFile, "IoHand::find(%s)", key);
+
+ int lev = 0;
+ uint16 nxt = kBtValRoot;
+ while (!_catFile->eos()) {
+ BtPage *pg = getPage(lev, nxt);
+ // search
+ if (pg->_header._down != kBtValNone) {
+ int i;
+ for (i = 0; i < pg->_header._count; i++) {
+ // Does this work, or does it have to compare the entire buffer?
+ if (scumm_strnicmp((const char *)key, (const char*)pg->_inner[i]._key, kBtKeySize) < 0)
+ break;
+ }
+ nxt = (i) ? pg->_inner[i - 1]._down : pg->_header._down;
+ _buff[lev]._index = i - 1;
+ lev++;
+ } else {
+ int i;
+ for (i = 0; i < pg->_header._count - 1; i++) {
+ if (scumm_stricmp((const char *)key, (const char *)pg->_leaf[i]._key) <= 0)
+ break;
+ }
+ _buff[lev]._index = i;
+ return &pg->_leaf[i];
+ }
+ }
+ return NULL;
+}
+
+bool ResourceManager::exist(const char *name) {
+ debugC(1, kCGEDebugFile, "ResourceManager::exist(%s)", name);
+
+ return scumm_stricmp(find(name)->_key, name) == 0;
+}
+
+uint16 ResourceManager::catRead(void *buf, uint16 length) {
+ if (!_catFile->isOpen())
+ return 0;
+
+ uint16 bytesRead = _catFile->read(buf, length);
+ if (!bytesRead)
+ error("Read %s - %d bytes", _catFile->getName(), length);
+ XCrypt(buf, length);
+ return bytesRead;
+}
+
+/*-----------------------------------------------------------------------
+ * EncryptedStream
+ *-----------------------------------------------------------------------*/
+EncryptedStream::EncryptedStream(CGEEngine *vm, const char *name) : _vm(vm) {
+ debugC(3, kCGEDebugFile, "EncryptedStream::EncryptedStream(%s)", name);
+
+ _error = false;
+ BtKeypack *kp = _vm->_resman->find(name);
+ if (scumm_stricmp(kp->_key, name) != 0)
+ _error = true;
+
+ _vm->_resman->seek(kp->_pos);
+ byte *dataBuffer = (byte *)malloc(kp->_size);
+ _vm->_resman->read(dataBuffer, kp->_size);
+ _readStream = new Common::MemoryReadStream(dataBuffer, kp->_size, DisposeAfterUse::YES);
+}
+
+uint32 EncryptedStream::read(void *dataPtr, uint32 dataSize) {
+ return _readStream->read(dataPtr, dataSize);
+}
+
+bool EncryptedStream::err() {
+ return (_error & _readStream->err());
+}
+
+bool EncryptedStream::eos() {
+ return _readStream->eos();
+}
+
+bool EncryptedStream::seek(int32 offset) {
+ return _readStream->seek(offset);
+}
+
+Common::String EncryptedStream::readLine() {
+ return _readStream->readLine();
+}
+
+int32 EncryptedStream::size() {
+ return _readStream->size();
+}
+
+int32 EncryptedStream::pos() {
+ return _readStream->pos();
+}
+
+EncryptedStream::~EncryptedStream() {
+}
+
+} // End of namespace CGE
diff --git a/engines/cge/fileio.h b/engines/cge/fileio.h
new file mode 100644
index 0000000000..cee1fa79ef
--- /dev/null
+++ b/engines/cge/fileio.h
@@ -0,0 +1,120 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#ifndef CGE_FILEIO_H
+#define CGE_FILEIO_H
+
+#include "cge/general.h"
+#include "common/stream.h"
+
+namespace CGE {
+
+class CGEEngine;
+
+#define kBtSize 1024
+#define kBtKeySize 13
+#define kBtLevel 2
+#define kBtInnerCount ((kBtSize - 4 /*sizeof(Hea) */) / (kBtKeySize + 2 /*sizeof(Inner) */))
+#define kBtLeafCount ((kBtSize - 4 /*sizeof(Hea) */) / (kBtKeySize + 4 + 2 /*sizeof(BtKeypack) */))
+#define kBtValNone 0xFFFF
+#define kBtValRoot 0
+#define kCatName "VOL.CAT"
+#define kDatName "VOL.DAT"
+
+struct BtKeypack {
+ char _key[kBtKeySize];
+ uint32 _pos;
+ uint16 _size;
+};
+
+struct Inner {
+ uint8 _key[kBtKeySize];
+ uint16 _down;
+};
+
+struct Header {
+ uint16 _count;
+ uint16 _down;
+};
+
+struct BtPage {
+ Header _header;
+ union {
+ // dummy filler to make proper size of union
+ uint8 _data[kBtSize - 4]; /* 4 is the size of struct Header */
+ // inner version of data: key + word-sized page link
+ Inner _inner[kBtInnerCount];
+ // leaf version of data: key + all user data
+ BtKeypack _leaf[kBtLeafCount];
+ };
+
+ void readBTree(Common::ReadStream &s);
+};
+
+class ResourceManager {
+ struct {
+ BtPage *_page;
+ uint16 _pageNo;
+ int _index;
+ } _buff[kBtLevel];
+
+ BtPage *getPage(int level, uint16 pageId);
+ uint16 catRead(void *buf, uint16 length);
+ Common::File *_catFile;
+ Common::File *_datFile;
+ uint16 XCrypt(void *buf, uint16 length);
+public:
+
+ ResourceManager();
+ ~ResourceManager();
+ uint16 read(void *buf, uint16 length);
+ bool seek(int32 offs, int whence = 0);
+
+ BtKeypack *find(const char *key);
+ bool exist(const char *name);
+};
+
+class EncryptedStream {
+private:
+ CGEEngine *_vm;
+ Common::SeekableReadStream *_readStream;
+ bool _error;
+public:
+ EncryptedStream(CGEEngine *vm, const char *name);
+ ~EncryptedStream();
+ bool err();
+ bool eos();
+ bool seek(int32 offset);
+ int32 pos();
+ int32 size();
+ uint32 read(void *dataPtr, uint32 dataSize);
+ Common::String readLine();
+};
+
+} // End of namespace CGE
+
+#endif
diff --git a/engines/cge/game.cpp b/engines/cge/game.cpp
new file mode 100644
index 0000000000..851f6c59fb
--- /dev/null
+++ b/engines/cge/game.cpp
@@ -0,0 +1,54 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#include "cge/game.h"
+#include "cge/events.h"
+
+namespace CGE {
+
+Fly::Fly(CGEEngine *vm, Bitmap **shpl)
+ : Sprite(vm, shpl), _tx(0), _ty(0), _vm(vm) {
+ step(_vm->newRandom(2));
+ gotoxy(kFlyL + _vm->newRandom(kFlyR - kFlyL - _w), kFlyT + _vm->newRandom(kFlyB - kFlyT - _h));
+}
+
+void Fly::tick() {
+ step();
+ if (_flags._kept)
+ return;
+ if (_vm->newRandom(10) < 1) {
+ _tx = _vm->newRandom(3) - 1;
+ _ty = _vm->newRandom(3) - 1;
+ }
+ if (_x + _tx < kFlyL || _x + _tx + _w > kFlyR)
+ _tx = -_tx;
+ if (_y + _ty < kFlyT || _y + _ty + _h > kFlyB)
+ _ty = -_ty;
+ gotoxy(_x + _tx, _y + _ty);
+}
+
+} // End of namespace CGE
diff --git a/engines/cge/game.h b/engines/cge/game.h
new file mode 100644
index 0000000000..4d5acf7371
--- /dev/null
+++ b/engines/cge/game.h
@@ -0,0 +1,53 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#ifndef CGE_GAME_H
+#define CGE_GAME_H
+
+#include "cge/vga13h.h"
+
+namespace CGE {
+
+enum {
+ kFlyL = 20,
+ kFlyT = 40,
+ kFlyR = 110,
+ kFlyB = 100
+};
+
+class Fly : public Sprite {
+private:
+ CGEEngine *_vm;
+public:
+ int _tx, _ty;
+ Fly(CGEEngine *vm, Bitmap **shpl);
+ void tick();
+};
+
+} // End of namespace CGE
+
+#endif
diff --git a/engines/cge/general.h b/engines/cge/general.h
new file mode 100644
index 0000000000..9e3fc7f249
--- /dev/null
+++ b/engines/cge/general.h
@@ -0,0 +1,43 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#ifndef CGE_GENERAL_H
+#define CGE_GENERAL_H
+
+#include "common/file.h"
+
+namespace CGE {
+
+struct Dac {
+ uint8 _r;
+ uint8 _g;
+ uint8 _b;
+};
+
+} // End of namespace CGE
+
+#endif
diff --git a/engines/cge/module.mk b/engines/cge/module.mk
new file mode 100644
index 0000000000..5745aa5d48
--- /dev/null
+++ b/engines/cge/module.mk
@@ -0,0 +1,30 @@
+MODULE := engines/cge
+
+MODULE_OBJS := \
+ bitmap.o \
+ cge.o \
+ cge_main.o \
+ console.o \
+ detection.o \
+ events.o \
+ fileio.o \
+ game.o \
+ snail.o \
+ sound.o \
+ talk.o \
+ text.o \
+ vga13h.o \
+ vmenu.o \
+ walk.o
+
+MODULE_DIRS += \
+ engines/cge
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_CGE), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
+
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
new file mode 100644
index 0000000000..34adeb3a8e
--- /dev/null
+++ b/engines/cge/snail.cpp
@@ -0,0 +1,1222 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#include "cge/general.h"
+#include "cge/sound.h"
+#include "cge/snail.h"
+#include "cge/vga13h.h"
+#include "cge/text.h"
+#include "cge/cge_main.h"
+#include "cge/events.h"
+#include "cge/walk.h"
+
+namespace CGE {
+
+const char *CommandHandler::_commandText[] = {
+ "LABEL", "PAUSE", "WAIT", "LEVEL", "HIDE",
+ "SAY", "INF", "TIME", "CAVE", "KILL",
+ "RSEQ", "SEQ", "SEND", "SWAP", "KEEP",
+ "GIVE", "IF", "GAME", "SETX0", "SETY0",
+ "SLAVE", "SETXY", "RELX", "RELY", "RELZ",
+ "SETX", "SETY", "SETZ", "TRANS", "PORT",
+ "NEXT", "NNEXT", "TNEXT", "RNNEXT", "RTNEXT",
+ "RMNEAR", "RMTAKE", "FLAG", "SETREF", "BACKPT",
+ "FLASH", "LIGHT", "SETHB", "SETVB", "WALK",
+ "REACH", "COVER", "UNCOVER", "CLEAR", "TALK",
+ "MOUSE", "SOUND", "COUNT", NULL
+};
+
+CommandHandler::CommandHandler(CGEEngine *vm, bool turbo)
+ : _turbo(turbo), _busy(false), _textDelay(false),
+ _timerExpiry(0), _talkEnable(true),
+ _head(0), _tail(0), _commandList((Command *)malloc(sizeof(Command) * 256)), _vm(vm) {
+}
+
+CommandHandler::~CommandHandler() {
+ free(_commandList);
+}
+
+/**
+ * Add a Command on the head of _commandList
+ * @param com Command
+ * @param ref Reference
+ * @param val Value
+ * @param ptr Sprite pointer
+ */
+void CommandHandler::addCommand(CommandType com, int ref, int val, void *ptr) {
+ Command *headCmd = &_commandList[_head++];
+ headCmd->_commandType = com;
+ headCmd->_ref = ref;
+ headCmd->_val = val;
+ headCmd->_spritePtr = ptr;
+ headCmd->_cbType = kNullCB;
+ if (headCmd->_commandType == kCmdClear) {
+ _tail = _head;
+ _vm->killText();
+ _timerExpiry = 0;
+ }
+}
+
+/**
+ * Add a Callback on the head of _commandList
+ * @param com Command
+ * @param ref Reference
+ * @param val Value
+ * @param CallbackType Callback type
+ */
+void CommandHandler::addCallback(CommandType com, int ref, int val, CallbackType cbType) {
+ Command *headCmd = &_commandList[_head++];
+ headCmd->_commandType = com;
+ headCmd->_ref = ref;
+ headCmd->_val = val;
+ headCmd->_spritePtr = NULL;
+ headCmd->_cbType = cbType;
+ if (headCmd->_commandType == kCmdClear) {
+ _tail = _head;
+ _vm->killText();
+ _timerExpiry = 0;
+ }
+}
+
+/**
+ * Add a Command on the tail of _commandList
+ * @param com Command
+ * @param ref Reference
+ * @param val Value
+ * @param ptr Sprite pointer
+ */
+void CommandHandler::insertCommand(CommandType com, int ref, int val, void *ptr) {
+ Command *tailCmd;
+
+ if (_busy) {
+ _commandList[(_tail - 1) & 0xFF] = _commandList[_tail];
+ tailCmd = &_commandList[_tail];
+ } else
+ tailCmd = &_commandList[(_tail - 1) & 0xFF];
+ _tail--;
+ tailCmd->_commandType = com;
+ tailCmd->_ref = ref;
+ tailCmd->_val = val;
+ tailCmd->_spritePtr = ptr;
+ tailCmd->_cbType = kNullCB;
+ if (tailCmd->_commandType == kCmdClear) {
+ _tail = _head;
+ _vm->killText();
+ _timerExpiry = 0;
+ }
+}
+
+void CommandHandler::runCommand() {
+ if (_busy)
+ return;
+
+ _busy = true;
+ uint8 tmpHead = _head;
+ while (_tail != tmpHead) {
+ Command *tailCmd = &_commandList[_tail];
+
+ if (!_turbo) { // only for the slower one
+ if (_timerExpiry) {
+ // Delay in progress
+ if (_timerExpiry > g_system->getMillis())
+ // Delay not yet ended
+ break;
+
+ // Delay is finished
+ _timerExpiry = 0;
+ } else {
+ if (_textDelay) {
+ _vm->killText();
+ _textDelay = false;
+ }
+ }
+ if (_vm->_talk && tailCmd->_commandType != kCmdPause)
+ break;
+ }
+
+ Sprite *spr = ((tailCmd->_ref >= 0) ? _vm->locate(tailCmd->_ref) : ((Sprite *) tailCmd->_spritePtr));
+ switch (tailCmd->_commandType) {
+ case kCmdLabel:
+ break;
+ case kCmdPause:
+ _timerExpiry = g_system->getMillis() + tailCmd->_val * kCommandFrameDelay;
+ if (_vm->_talk)
+ _textDelay = true;
+ break;
+ case kCmdWait:
+ if (spr) {
+ if (spr->seqTest(tailCmd->_val) &&
+ (tailCmd->_val >= 0 || spr != _vm->_hero || _vm->_hero->_tracePtr < 0)) {
+ _timerExpiry = g_system->getMillis() + spr->_time * kCommandFrameDelay;
+ } else {
+ _busy = false;
+ return;
+ }
+ }
+ break;
+ case kCmdLevel:
+ _vm->snLevel(spr, tailCmd->_val);
+ break;
+ case kCmdHide:
+ _vm->snHide(spr, tailCmd->_val);
+ break;
+ case kCmdSay:
+ if (spr && _talkEnable) {
+ if (spr == _vm->_hero && spr->seqTest(-1))
+ spr->step(kSeqHTalk);
+ _vm->_text->say(_vm->_text->getText(tailCmd->_val), spr);
+ _vm->_sys->_funDel = kHeroFun0;
+ }
+ break;
+ case kCmdInf:
+ if (_talkEnable) {
+ _vm->inf(_vm->_text->getText(tailCmd->_val));
+ _vm->_sys->_funDel = kHeroFun0;
+ }
+ break;
+ case kCmdTime:
+ if (spr && _talkEnable) {
+ if (spr == _vm->_hero && spr->seqTest(-1))
+ spr->step(kSeqHTalk);
+ _vm->_text->sayTime(spr);
+ }
+ break;
+ case kCmdCave:
+ _vm->switchScene(tailCmd->_val);
+ break;
+ case kCmdKill:
+ _vm->snKill(spr);
+ break;
+ case kCmdSeq:
+ _vm->snSeq(spr, tailCmd->_val);
+ break;
+ case kCmdRSeq:
+ _vm->snRSeq(spr, tailCmd->_val);
+ break;
+ case kCmdSend:
+ _vm->snSend(spr, tailCmd->_val);
+ break;
+ case kCmdSwap:
+ _vm->snSwap(spr, tailCmd->_val);
+ break;
+ case kCmdCover:
+ _vm->snCover(spr, tailCmd->_val);
+ break;
+ case kCmdUncover:
+ _vm->snUncover(spr, (tailCmd->_val >= 0) ? _vm->locate(tailCmd->_val) : ((Sprite *) tailCmd->_spritePtr));
+ break;
+ case kCmdKeep:
+ _vm->snKeep(spr, tailCmd->_val);
+ break;
+ case kCmdGive:
+ _vm->snGive(spr, tailCmd->_val);
+ break;
+ case kCmdGame:
+ _vm->snGame(spr, tailCmd->_val);
+ break;
+ case kCmdSetX0:
+ _vm->snSetX0(tailCmd->_ref, tailCmd->_val);
+ break;
+ case kCmdSetY0:
+ _vm->snSetY0(tailCmd->_ref, tailCmd->_val);
+ break;
+ case kCmdSetXY:
+ _vm->snSetXY(spr, tailCmd->_val);
+ break;
+ case kCmdRelX:
+ _vm->snRelX(spr, tailCmd->_val);
+ break;
+ case kCmdRelY:
+ _vm->snRelY(spr, tailCmd->_val);
+ break;
+ case kCmdRelZ:
+ _vm->snRelZ(spr, tailCmd->_val);
+ break;
+ case kCmdSetX:
+ _vm->snSetX(spr, tailCmd->_val);
+ break;
+ case kCmdSetY:
+ _vm->snSetY(spr, tailCmd->_val);
+ break;
+ case kCmdSetZ:
+ _vm->snSetZ(spr, tailCmd->_val);
+ break;
+ case kCmdSlave:
+ _vm->snSlave(spr, tailCmd->_val);
+ break;
+ case kCmdTrans:
+ _vm->snTrans(spr, tailCmd->_val);
+ break;
+ case kCmdPort:
+ _vm->snPort(spr, tailCmd->_val);
+ break;
+ case kCmdNext:
+ case kCmdIf:
+ case kCmdTalk:
+ break;
+ case kCmdMouse:
+ _vm->snMouse(tailCmd->_val != 0);
+ break;
+ case kCmdNNext:
+ _vm->snNNext(spr, tailCmd->_val);
+ break;
+ case kCmdTNext:
+ _vm->snTNext(spr, tailCmd->_val);
+ break;
+ case kCmdRNNext:
+ _vm->snRNNext(spr, tailCmd->_val);
+ break;
+ case kCmdRTNext:
+ _vm->snRTNext(spr, tailCmd->_val);
+ break;
+ case kCmdRMNear:
+ _vm->snRmNear(spr);
+ break;
+ case kCmdRmTake:
+ _vm->snRmTake(spr);
+ break;
+ case kCmdFlag:
+ _vm->snFlag(tailCmd->_ref & 3, tailCmd->_val != 0);
+ break;
+ case kCmdSetRef:
+ _vm->snSetRef(spr, tailCmd->_val);
+ break;
+ case kCmdBackPt:
+ _vm->snBackPt(spr, tailCmd->_val);
+ break;
+ case kCmdFlash:
+ _vm->snFlash(tailCmd->_val != 0);
+ break;
+ case kCmdLight:
+ _vm->snLight(tailCmd->_val != 0);
+ break;
+ case kCmdSetHBarrier:
+ _vm->snHBarrier(tailCmd->_ref, tailCmd->_val);
+ break;
+ case kCmdSetVBarrier:
+ _vm->snVBarrier(tailCmd->_ref, tailCmd->_val);
+ break;
+ case kCmdWalk:
+ _vm->snWalk(spr, tailCmd->_ref, tailCmd->_val);
+ break;
+ case kCmdReach:
+ _vm->snReach(spr, tailCmd->_val);
+ break;
+ case kCmdSound:
+ _vm->snSound(spr, tailCmd->_val);
+ break;
+ case kCmdCount:
+ _vm->_sound->setRepeat(tailCmd->_val);
+ break;
+ case kCmdExec:
+ switch (tailCmd->_cbType) {
+ case kQGame:
+ _vm->qGame();
+ break;
+ case kMiniStep:
+ _vm->miniStep(tailCmd->_val);
+ break;
+ case kXScene:
+ _vm->xScene();
+ break;
+ case kSoundSetVolume:
+ _vm->sndSetVolume();
+ break;
+ default:
+ error("Unknown Callback Type in SNEXEC");
+ }
+ break;
+ case kCmdStep:
+ spr->step();
+ break;
+ case kCmdZTrim:
+ _vm->snZTrim(spr);
+ break;
+ case kCmdGhost:
+ _vm->snGhost((Bitmap *) tailCmd->_spritePtr);
+ break;
+ default:
+ warning("Unhandled snc->_com in SNMouse(bool)");
+ break;
+ }
+ _tail++;
+ if (!_turbo)
+ break;
+ }
+
+ _busy = false;
+}
+
+bool CommandHandler::idle() {
+ return (_head == _tail);
+}
+
+/**
+ * Handles mini-Games logic
+ * @param com Command
+ * @param num mini game number
+ */
+void CGEEngine::snGame(Sprite *spr, int num) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snGame(spr, %d)", num);
+
+ switch (num) {
+ case 1: {
+ static Sprite *dup[3] = { NULL, NULL, NULL };
+ int buref = 0;
+ int Stage = 0;
+
+ for (dup[0] = _vga->_showQ->first(); dup[0]; dup[0] = dup[0]->_next) {
+ buref = dup[0]->_ref;
+ if (buref / 1000 == 16 && buref % 100 == 6) {
+ Stage = (buref / 100) % 10;
+ break;
+ }
+ }
+ if (dup[1] == NULL) {
+ dup[1] = _vga->_showQ->locate(16003); // pan
+ dup[2] = _vga->_showQ->locate(16004); // pani
+ }
+
+ if (_game) { // continue game
+ int i = newRandom(3), hand = (dup[0]->_shpCnt == 6);
+ Stage++;
+ if (hand && Stage > kDressed)
+ ++hand;
+ if (i >= 0 || (dup[i] == spr && newRandom(3) == 0)) {
+ _commandHandler->addCommand(kCmdSeq, -1, 3, dup[0]); // Yes
+ _commandHandler->addCommand(kCmdSeq, -1, 3, dup[1]); // Yes
+ _commandHandler->addCommand(kCmdSeq, -1, 3, dup[2]); // Yes
+ _commandHandler->addCommand(kCmdTNext, -1, 0, dup[0]); // Reset Take
+ _commandHandler->addCommand(kCmdTNext, -1, 0, dup[1]); // Reset Take
+ _commandHandler->addCommand(kCmdTNext, -1, 0, dup[2]); // Reset Take
+ _commandHandler->addCommand(kCmdNNext, -1, 0, dup[0]); // Reset Near
+ _commandHandler->addCommand(kCmdPause, -1, 72, NULL); // Pause the game for 72/80 second
+ _commandHandler->addCommand(kCmdSay, 1, 16009, NULL); // Say "I win.."
+ _commandHandler->addCommand(kCmdSay, buref, 16010, NULL); // Say "Go Sit..."
+ _commandHandler->addCommand(kCmdSay, 1, 16011, NULL); // Say "I prefer not"
+
+ if (hand) {
+ _commandHandler->addCommand(kCmdSend, 16060 + hand, 16, NULL); // Give hand
+ _commandHandler->addCommand(kCmdSeq, buref, 4, NULL); // Take off
+ _commandHandler->addCommand(kCmdSeq, 16060 + hand, 1, NULL); // start one of the Bartender animations
+ _commandHandler->addCommand(kCmdSound, 16060 + hand, 16002, NULL); // Play tear sound
+ _commandHandler->addCommand(kCmdWait, 16060 + hand, 3, NULL); // Take up
+ _commandHandler->addCommand(kCmdSwap, buref, buref + 100, NULL); // Open hand
+ _commandHandler->addCommand(kCmdSeq, 16016, Stage, NULL); // Start Belongings animation
+ _commandHandler->addCommand(kCmdSend, 16060 + hand, -1, NULL); // Hide hand
+ _commandHandler->addCommand(kCmdWait, 16060 + hand, -1, NULL); // Stop moving hand
+ } else {
+ _commandHandler->addCommand(kCmdSeq, buref, 4, NULL); // Take off
+ _commandHandler->addCommand(kCmdSound, 16060 + hand, 16002, NULL); // Play tear sound
+ _commandHandler->addCommand(kCmdWait, buref, -1, NULL); // Will take off
+ _commandHandler->addCommand(kCmdSwap, buref, buref + 100, NULL); // Open hand
+ _commandHandler->addCommand(kCmdSeq, 16016, Stage, NULL); // Start Belongings animation
+ }
+ _commandHandler->addCommand(kCmdPause, -1, 72, NULL); // Pause the game for 72/80 second
+ _commandHandler->addCommand(kCmdSeq, -1, 0, dup[1]); // Get away (Him)
+ _commandHandler->addCommand(kCmdSetXY, -1, 203 + kScrWidth * 49, dup[1]);
+ _commandHandler->addCommand(kCmdSetZ, -1, 7, dup[1]);
+ _commandHandler->addCommand(kCmdSeq, -1, 0, dup[2]); // Get Away (Her)
+ _commandHandler->addCommand(kCmdSetXY, -1, 182 + kScrWidth * 62, dup[2]);
+ _commandHandler->addCommand(kCmdSetZ, -1, 9, dup[2]);
+ _game = 0;
+ return;
+ } else {
+ _commandHandler->addCommand(kCmdSeq, -1, 2, dup[0]); // reset animation sequence
+ _commandHandler->addCommand(kCmdSeq, -1, 2, dup[1]); // reset animation sequence
+ _commandHandler->addCommand(kCmdSeq, -1, 2, dup[2]); // reset animation sequence
+ _commandHandler->addCommand(kCmdPause, -1, 72, NULL); // Pause the game for 72/80 second
+ }
+ }
+ _commandHandler->addCommand(kCmdWalk, 198, 134, NULL); // Go to place
+ _commandHandler->addCommand(kCmdWait, 1, -1, NULL); // Stop moving
+ _commandHandler->addCommand(kCmdCover, 1, 16101, NULL); // Man to beat
+ _commandHandler->addCommand(kCmdSeq, 16101, 1, NULL); // Start Chief animation (16dupnia)
+ _commandHandler->addCommand(kCmdWait, 16101, 5, NULL); // wait
+ _commandHandler->addCommand(kCmdPause, 16101, 24, NULL); // Pause the game for 24/80 second
+ _commandHandler->addCommand(kCmdSeq, 16040, 1, NULL); // Start Slap animation (16plask)
+ _commandHandler->addCommand(kCmdSound, 16101, 16001, NULL); // Play "Slap" sound
+ _commandHandler->addCommand(kCmdPause, 16101, 24, NULL); // Pause the game for 24/80 second
+ _commandHandler->addCommand(kCmdSeq, 16040, 0, NULL); // Reset animation sequence
+ _commandHandler->addCommand(kCmdWait, 16101, -1, NULL); // stay
+ _commandHandler->addCommand(kCmdUncover, 1, 16101, NULL); // SDS
+ if (!_game) {
+ _commandHandler->addCommand(kCmdSay, buref, 16008, NULL); // say "Guess!"
+ _game = true;
+ }
+ }
+ break;
+ case 2:
+ if (_sprTv == NULL) {
+ _sprTv = _vga->_showQ->locate(20700);
+ _sprK1 = _vga->_showQ->locate(20701);
+ _sprK2 = _vga->_showQ->locate(20702);
+ _sprK3 = _vga->_showQ->locate(20703);
+ }
+
+ if (!_game) { // init
+ _commandHandler->addCommand(kCmdGame, 20002, 2, NULL);
+ _game = true;
+ break;
+ }
+
+ // cont
+ _sprK1->step(newRandom(6));
+ _sprK2->step(newRandom(6));
+ _sprK3->step(newRandom(6));
+
+ if (spr->_ref == 1 && _keyboard->_key[kKeyAlt]) {
+ _sprK1->step(5);
+ _sprK2->step(5);
+ _sprK3->step(5);
+ }
+
+ _commandHandler->addCommand(kCmdSetZ, 20700, 0, NULL);
+ bool hit = (_sprK1->_seqPtr + _sprK2->_seqPtr + _sprK3->_seqPtr == 15);
+ if (hit) {
+ if (spr->_ref == 1) {
+ _commandHandler->addCommand(kCmdSay, 1, 20003, NULL); // hurray!
+ _commandHandler->addCommand(kCmdSeq, 20011, 2, NULL); // Camera away
+ _commandHandler->addCommand(kCmdSend, 20701, -1, NULL); // move dice1 to scene -1
+ _commandHandler->addCommand(kCmdSend, 20702, -1, NULL); // move dice2 to scene -1
+ _commandHandler->addCommand(kCmdSend, 20703, -1, NULL); // move dice3 to scene -1
+ _commandHandler->addCommand(kCmdSend, 20700, -1, NULL); // move TV to scene -1
+ _commandHandler->addCommand(kCmdKeep, 20007, 0, NULL); // to pocket
+ _commandHandler->addCommand(kCmdSend, 20006, 20, NULL); // Move Coin to scene 20
+ _commandHandler->addCommand(kCmdSound, 20006, 20002, NULL); // Play Coin sound
+ _commandHandler->addCommand(kCmdSay, 20002, 20004, NULL); // Say "Luck guy..."
+ _commandHandler->addCommand(kCmdSend, 20010, 20, NULL); // Move Paper to scene 20
+ _commandHandler->addCommand(kCmdSound, 20010, 20003, NULL); // Play "ksh" sound! (fx20003.wav)
+ _commandHandler->addCommand(kCmdSay, 20001, 20005, NULL); // Say "Congratulations"
+ _game = false;
+ return;
+ } else
+ _sprK3->step(newRandom(5));
+ }
+
+ if (_gameCase2Cpt < 100) {
+ switch (_gameCase2Cpt) {
+ case 15:
+ // Give hint about ALTered dice
+ _commandHandler->addCommand(kCmdSay, 20003, 20021, NULL);
+ break;
+ case 30:
+ case 45:
+ case 60:
+ case 75:
+ // Tell to use ALT key
+ _commandHandler->addCommand(kCmdSay, 20003, 20022, NULL);
+ break;
+ }
+ _gameCase2Cpt++;
+ }
+
+ switch (spr->_ref) {
+ case 1:
+ _commandHandler->addCommand(kCmdSay, 20001, 20011, NULL); // Say "It'a my turn"
+ _commandHandler->addCommand(kCmdSeq, 20001, 1, NULL); // Throw dice
+ _commandHandler->addCommand(kCmdWait, 20001, 1, NULL); // wait
+ _commandHandler->addCommand(kCmdSetZ, 20700, 2, NULL); // hide dice
+ _commandHandler->addCommand(kCmdHide, 20007, 1, NULL); // hide dice
+ _commandHandler->addCommand(kCmdWait, 20001, 16, NULL); // wait
+ _commandHandler->addCommand(kCmdSeq, 20007, 1, NULL); // Start dice animation (20kosci)
+ _commandHandler->addCommand(kCmdHide, 20007, 0, NULL); // unhide
+ _commandHandler->addCommand(kCmdSound, 20007, 20001, NULL); // Play Dice sound
+ _commandHandler->addCommand(kCmdWait, 20007, -1, NULL); // the end
+ _commandHandler->addCommand(kCmdGame, 20001, 2, NULL); // again!
+ break;
+
+ case 20001:
+ _commandHandler->addCommand(kCmdSay, 20002, 20012, NULL); // Say "Now it's mine"
+ _commandHandler->addCommand(kCmdSeq, 20002, 1, NULL); // Throw dice
+ _commandHandler->addCommand(kCmdWait, 20002, 3, NULL); // wait
+ _commandHandler->addCommand(kCmdSetZ, 20700, 2, NULL); // hide dice
+ _commandHandler->addCommand(kCmdHide, 20007, 1, NULL); // hide dice
+ _commandHandler->addCommand(kCmdWait, 20002, 10, NULL); // wait
+ _commandHandler->addCommand(kCmdSeq, 20007, 2, NULL); // Start dice animation (20kosci)
+ _commandHandler->addCommand(kCmdHide, 20007, 0, NULL); // unhide
+ _commandHandler->addCommand(kCmdSound, 20007, 20001, NULL); // Play Dice sound
+ _commandHandler->addCommand(kCmdWait, 20007, -1, NULL); // the end
+ _commandHandler->addCommand(kCmdGame, 20002, 2, NULL); // again!
+ break;
+
+ case 20002:
+ _commandHandler->addCommand(kCmdSay, 20002, 20010, NULL); // "Roll the bones!"
+ _commandHandler->addCommand(kCmdWalk, 20005, -1, NULL); // Walk to table
+ _commandHandler->addCommand(kCmdWait, 1, -1, NULL); // Wait
+ _commandHandler->addCommand(kCmdCover, 1, 20101, NULL); // grasol ??
+ _commandHandler->addCommand(kCmdSeq, 20101, 1, NULL); // Start Chief animation (20solgra)
+ _commandHandler->addCommand(kCmdWait, 20101, 5, NULL); // Wait
+ _commandHandler->addCommand(kCmdSetZ, 20700, 2, NULL); // Hide dice
+ _commandHandler->addCommand(kCmdHide, 20007, 1, NULL); // Hide dice
+ _commandHandler->addCommand(kCmdWait, 20101, 15, NULL); // wait
+ _commandHandler->addCommand(kCmdSeq, 20007, 1, NULL); // Start dice animation (20kosci)
+ _commandHandler->addCommand(kCmdHide, 20007, 0, NULL); // Unhide
+ _commandHandler->addCommand(kCmdSound, 20007, 20001, NULL); // Play Dice sound
+ _commandHandler->addCommand(kCmdWait, 20101, -1, NULL); // the end
+ _commandHandler->addCommand(kCmdUncover, 1, 20101, NULL); // SDS ??
+ _commandHandler->addCommand(kCmdGame, 1, 2, NULL); // again!
+ break;
+ }
+ }
+}
+
+void CGEEngine::expandSprite(Sprite *spr) {
+ debugC(5, kCGEDebugEngine, "CGEEngine::expandSprite(spr)");
+
+ if (spr)
+ _vga->_showQ->insert(_vga->_spareQ->remove(spr));
+}
+
+void CGEEngine::contractSprite(Sprite *spr) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::contractSprite(spr)");
+
+ if (spr)
+ _vga->_spareQ->append(_vga->_showQ->remove(spr));
+}
+
+/**
+ * Check if an item is in the inventory, and returns its position
+ * @param spr Sprite pointer
+ * @return -1 if not found, else index.
+ */
+int CGEEngine::findPocket(Sprite *spr) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::findPocket(spr)");
+
+ for (int i = 0; i < kPocketNX; i++)
+ if (_pocket[i] == spr)
+ return i;
+ return -1;
+}
+
+void CGEEngine::selectPocket(int n) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::selectPocket(%d)", n);
+
+ if (n < 0 || (_pocLight->_seqPtr && _pocPtr == n)) {
+ _pocLight->step(0);
+ n = findPocket(NULL);
+ if (n >= 0)
+ _pocPtr = n;
+ } else {
+ if (_pocket[n] != NULL) {
+ _pocPtr = n;
+ _pocLight->step(1);
+ }
+ }
+ _pocLight->gotoxy(kPocketX + _pocPtr * kPocketDX + kPocketSX, kPocketY + kPocketSY);
+}
+
+void CGEEngine::pocFul() {
+ debugC(1, kCGEDebugEngine, "CGEEngine::pocFul()");
+
+ _hero->park();
+ _commandHandler->addCommand(kCmdWait, -1, -1, _hero);
+ _commandHandler->addCommand(kCmdSeq, -1, kSeqPocketFull, _hero);
+ _commandHandler->addCommand(kCmdSound, -1, 2, _hero);
+ _commandHandler->addCommand(kCmdWait, -1, -1, _hero);
+ _commandHandler->addCommand(kCmdSay, 1, kPocketFull, _hero);
+}
+
+void CGEEngine::hide1(Sprite *spr) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::hide1(spr)");
+
+ _commandHandlerTurbo->addCommand(kCmdGhost, -1, 0, spr->ghost());
+}
+
+void CGEEngine::snGhost(Bitmap *bmp) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snGhost(bmp)");
+
+ bmp->hide(bmp->_map & 0xFFFF, bmp->_map >> 16);
+ bmp->_m = NULL;
+ bmp->_map = 0;
+ delete bmp;
+}
+
+void CGEEngine::feedSnail(Sprite *spr, SnList snq) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::feedSnail(spr, snq)");
+
+ if (!spr || !spr->active())
+ return;
+
+ uint8 ptr = (snq == kTake) ? spr->_takePtr : spr->_nearPtr;
+
+ if (ptr == kNoPtr)
+ return;
+
+ CommandHandler::Command *comtab = spr->snList(snq);
+ CommandHandler::Command *c = comtab + ptr;
+
+ if (findPocket(NULL) < 0) { // no empty pockets?
+ CommandHandler::Command *p;
+ for (p = c; p->_commandType != kCmdNext; p++) { // find KEEP command
+ if (p->_commandType == kCmdKeep) {
+ pocFul();
+ return;
+ }
+ if (p->_spritePtr)
+ break;
+ }
+ }
+ while (true) {
+ if (c->_commandType == kCmdTalk) {
+ if ((_commandHandler->_talkEnable = (c->_val != 0)) == false)
+ killText();
+ }
+ if (c->_commandType == kCmdNext) {
+ Sprite *s = (c->_ref < 0) ? spr : locate(c->_ref);
+ if (s) {
+ uint8 *idx = (snq == kTake) ? &s->_takePtr : &s->_nearPtr;
+ if (*idx != kNoPtr) {
+ int v;
+ switch (c->_val) {
+ case -1 :
+ v = c - comtab + 1;
+ break;
+ case -2 :
+ v = c - comtab;
+ break;
+ case -3 :
+ v = -1;
+ break;
+ default :
+ v = c->_val;
+ break;
+ }
+ if (v >= 0)
+ *idx = v;
+ }
+ }
+ if (s == spr)
+ break;
+ }
+ if (c->_commandType == kCmdIf) {
+ Sprite *s = (c->_ref < 0) ? spr : locate(c->_ref);
+ if (s) { // sprite extsts
+ if (! s->seqTest(-1))
+ c = comtab + c->_val; // not parked
+ else
+ ++c;
+ } else
+ ++c;
+ } else {
+ _commandHandler->addCommand(c->_commandType, c->_ref, c->_val, spr);
+ if (c->_spritePtr)
+ break;
+ else
+ c++;
+ }
+ }
+}
+
+void CGEEngine::snNNext(Sprite *spr, int p) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snNNext(spr, %d)", p);
+
+ if (spr)
+ if (spr->_nearPtr != kNoPtr)
+ spr->_nearPtr = p;
+}
+
+void CGEEngine::snTNext(Sprite *spr, int p) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snTNext(spr, %d)", p);
+
+ if (spr)
+ if (spr->_takePtr != kNoPtr)
+ spr->_takePtr = p;
+}
+
+void CGEEngine::snRNNext(Sprite *spr, int p) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snRNNext(spr, %d)", p);
+
+ if (spr)
+ if (spr->_nearPtr != kNoPtr)
+ spr->_nearPtr += p;
+}
+
+
+void CGEEngine::snRTNext(Sprite *spr, int p) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snRTNext(spr, %d)", p);
+
+ if (spr)
+ if (spr->_takePtr != kNoPtr)
+ spr->_takePtr += p;
+}
+
+void CGEEngine::snZTrim(Sprite *spr) {
+ debugC(4, kCGEDebugEngine, "CGEEngine::snZTrim(spr)");
+
+ if (!spr || !spr->active())
+ return;
+
+ Sprite *s = (spr->_flags._shad) ? spr->_prev : NULL;
+ _vga->_showQ->insert(_vga->_showQ->remove(spr));
+ if (s) {
+ s->_z = spr->_z;
+ _vga->_showQ->insert(_vga->_showQ->remove(s), spr);
+ }
+}
+
+void CGEEngine::snHide(Sprite *spr, int val) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snHide(spr, %d)", val);
+
+ if (spr) {
+ spr->_flags._hide = (val >= 0) ? (val != 0) : (!spr->_flags._hide);
+ if (spr->_flags._shad)
+ spr->_prev->_flags._hide = spr->_flags._hide;
+ }
+}
+
+void CGEEngine::snRmNear(Sprite *spr) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snRmNear(spr)");
+
+ if (spr)
+ spr->_nearPtr = kNoPtr;
+}
+
+void CGEEngine::snRmTake(Sprite *spr) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snRmTake(spr)");
+
+ if (spr)
+ spr->_takePtr = kNoPtr;
+}
+
+void CGEEngine::snSeq(Sprite *spr, int val) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snSeq(spr, %d)", val);
+
+ if (spr) {
+ if (spr == _hero && val == 0)
+ _hero->park();
+ else
+ spr->step(val);
+ }
+}
+
+void CGEEngine::snRSeq(Sprite *spr, int val) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snRSeq(spr, %d)", val);
+
+ if (spr)
+ snSeq(spr, spr->_seqPtr + val);
+}
+
+void CGEEngine::snSend(Sprite *spr, int val) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snSend(spr, %d)", val);
+
+ if (!spr)
+ return;
+
+ int was = spr->_scene;
+ bool was1 = (was == 0 || was == _now);
+ bool val1 = (val == 0 || val == _now);
+ spr->_scene = val;
+ if (val1 != was1) {
+ if (was1) {
+ if (spr->_flags._kept) {
+ int n = findPocket(spr);
+ if (n >= 0)
+ _pocket[n] = NULL;
+ }
+ hide1(spr);
+ contractSprite(spr);
+ spr->_flags._slav = false;
+ } else {
+ if (spr->_ref % 1000 == 0)
+ _bitmapPalette = _vga->_sysPal;
+ if (spr->_flags._back)
+ spr->backShow(true);
+ else
+ expandSprite(spr);
+ _bitmapPalette = NULL;
+ }
+ }
+}
+
+void CGEEngine::snSwap(Sprite *spr, int xref) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snSwap(spr, %d)", xref);
+
+ Sprite *xspr = locate(xref);
+ if (!spr || !xspr)
+ return;
+
+ int was = spr->_scene;
+ int xwas = xspr->_scene;
+ bool was1 = (was == 0 || was == _now);
+ bool xwas1 = (xwas == 0 || xwas == _now);
+
+ SWAP(spr->_scene, xspr->_scene);
+ SWAP(spr->_x, xspr->_x);
+ SWAP(spr->_y, xspr->_y);
+ SWAP(spr->_z, xspr->_z);
+ if (spr->_flags._kept) {
+ int n = findPocket(spr);
+ if (n >= 0)
+ _pocket[n] = xspr;
+ xspr->_flags._kept = true;
+ xspr->_flags._port = false;
+ }
+ if (xwas1 != was1) {
+ if (was1) {
+ hide1(spr);
+ contractSprite(spr);
+ } else
+ expandSprite(spr);
+ if (xwas1) {
+ hide1(xspr);
+ contractSprite(xspr);
+ } else
+ expandSprite(xspr);
+ }
+}
+
+void CGEEngine::snCover(Sprite *spr, int xref) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snCover(spr, %d)", xref);
+
+ Sprite *xspr = locate(xref);
+ if (!spr || !xspr)
+ return;
+
+ spr->_flags._hide = true;
+ xspr->_z = spr->_z;
+ xspr->_scene = spr->_scene;
+ xspr->gotoxy(spr->_x, spr->_y);
+ expandSprite(xspr);
+ if ((xspr->_flags._shad = spr->_flags._shad) == 1) {
+ _vga->_showQ->insert(_vga->_showQ->remove(spr->_prev), xspr);
+ spr->_flags._shad = false;
+ }
+ feedSnail(xspr, kNear);
+}
+
+void CGEEngine::snUncover(Sprite *spr, Sprite *xspr) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snUncover(spr, xspr)");
+
+ if (!spr || !xspr)
+ return;
+
+ spr->_flags._hide = false;
+ spr->_scene = xspr->_scene;
+ spr->gotoxy(xspr->_x, xspr->_y);
+ if ((spr->_flags._shad = xspr->_flags._shad) == 1) {
+ _vga->_showQ->insert(_vga->_showQ->remove(xspr->_prev), spr);
+ xspr->_flags._shad = false;
+ }
+ spr->_z = xspr->_z;
+ snSend(xspr, -1);
+ if (spr->_time == 0)
+ spr->_time++;
+}
+
+void CGEEngine::snSetX0(int scene, int x0) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snSetX0(%d, %d)", scene, x0);
+
+ _heroXY[scene - 1].x = x0;
+}
+
+void CGEEngine::snSetY0(int scene, int y0) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snSetY0(%d, %d)", scene, y0);
+
+ _heroXY[scene - 1].y = y0;
+}
+
+void CGEEngine::snSetXY(Sprite *spr, uint16 xy) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snSetXY(spr, %d)", xy);
+
+ if (spr)
+ spr->gotoxy(xy % kScrWidth, xy / kScrWidth);
+}
+
+void CGEEngine::snRelX(Sprite *spr, int x) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snRelX(spr, %d)", x);
+
+ if (spr && _hero)
+ spr->gotoxy(_hero->_x + x, spr->_y);
+}
+
+void CGEEngine::snRelY(Sprite *spr, int y) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snRelY(spr, %d)", y);
+
+ if (spr && _hero)
+ spr->gotoxy(spr->_x, _hero->_y + y);
+}
+
+void CGEEngine::snRelZ(Sprite *spr, int z) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snRelZ(spr, %d)", z);
+
+ if (spr && _hero) {
+ spr->_z = _hero->_z + z;
+ snZTrim(spr);
+ }
+}
+
+void CGEEngine::snSetX(Sprite *spr, int x) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snSetX(spr, %d)", x);
+
+ if (spr)
+ spr->gotoxy(x, spr->_y);
+}
+
+void CGEEngine::snSetY(Sprite *spr, int y) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snSetY(spr, %d)", y);
+
+ if (spr)
+ spr->gotoxy(spr->_x, y);
+}
+
+void CGEEngine::snSetZ(Sprite *spr, int z) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snSetZ(spr, %d)", z);
+
+ if (spr) {
+ spr->_z = z;
+ //SNPOST_(SNZTRIM, -1, 0, spr);
+ snZTrim(spr);
+ }
+}
+
+void CGEEngine::snSlave(Sprite *spr, int ref) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snSlave(spr, %d)", ref);
+
+ Sprite *slv = locate(ref);
+ if (spr && slv) {
+ if (spr->active()) {
+ snSend(slv, spr->_scene);
+ slv->_flags._slav = true;
+ slv->_z = spr->_z;
+ _vga->_showQ->insert(_vga->_showQ->remove(slv), spr->_next);
+ }
+ }
+}
+
+void CGEEngine::snTrans(Sprite *spr, int trans) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snTrans(spr, %d)", trans);
+
+ if (spr)
+ spr->_flags._tran = (trans < 0) ? !spr->_flags._tran : (trans != 0);
+}
+
+void CGEEngine::snPort(Sprite *spr, int port) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snPort(spr, %d)", port);
+
+ if (spr)
+ spr->_flags._port = (port < 0) ? !spr->_flags._port : (port != 0);
+}
+
+void CGEEngine::snKill(Sprite *spr) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snKill(spr)");
+
+ if (!spr)
+ return;
+
+ if (spr->_flags._kept) {
+ int n = findPocket(spr);
+ if (n >= 0)
+ _pocket[n] = NULL;
+ }
+ Sprite *nx = spr->_next;
+ hide1(spr);
+ _vga->_showQ->remove(spr);
+ _eventManager->clearEvent(spr);
+ if (spr->_flags._kill) {
+ delete spr;
+ } else {
+ spr->_scene = -1;
+ _vga->_spareQ->append(spr);
+ }
+ if (nx) {
+ if (nx->_flags._slav)
+ snKill(nx);
+ }
+}
+
+/**
+ * Play a FX sound
+ * @param spr Sprite pointer
+ * @param wav FX index
+ */
+void CGEEngine::snSound(Sprite *spr, int wav) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snSound(spr, %d)", wav);
+
+ if (wav == -1)
+ _sound->stop();
+ else
+ _sound->play((*_fx)[wav], (spr) ? ((spr->_x + spr->_w / 2) / (kScrWidth / 16)) : 8);
+
+ _sound->setRepeat(1);
+}
+
+void CGEEngine::snKeep(Sprite *spr, int stp) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snKeep(spr, %d)", stp);
+
+ selectPocket(-1);
+ if (spr && ! spr->_flags._kept && _pocket[_pocPtr] == NULL) {
+ int16 oldRepeat = _sound->getRepeat();
+ _sound->setRepeat(1);
+ snSound(spr, 3);
+ _sound->setRepeat(oldRepeat);
+ _pocket[_pocPtr] = spr;
+ spr->_scene = 0;
+ spr->_flags._kept = true;
+ spr->gotoxy(kPocketX + kPocketDX * _pocPtr + kPocketDX / 2 - spr->_w / 2,
+ kPocketY + kPocketDY / 2 - spr->_h / 2);
+ if (stp >= 0)
+ spr->step(stp);
+ }
+ selectPocket(-1);
+}
+
+void CGEEngine::snGive(Sprite *spr, int stp) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snGive(spr, %d)", stp);
+
+ if (spr) {
+ int p = findPocket(spr);
+ if (p >= 0) {
+ _pocket[p] = NULL;
+ spr->_scene = _now;
+ spr->_flags._kept = false;
+ if (stp >= 0)
+ spr->step(stp);
+ }
+ }
+ selectPocket(-1);
+}
+
+void CGEEngine::snBackPt(Sprite *spr, int stp) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snBackPt(spr, %d)", stp);
+
+ if (spr) {
+ if (stp >= 0)
+ spr->step(stp);
+ spr->backShow(true);
+ }
+}
+
+void CGEEngine::snLevel(Sprite *spr, int lev) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snLevel(spr, %d)", lev);
+
+ assert((lev >= 0) && (lev < 5));
+
+ for (int i = 0; i < 5; i++) {
+ spr = _vga->_spareQ->locate(100 + i);
+ if (spr) {
+ if (i <= lev) {
+ spr->backShow(true);
+ spr->_scene = 0;
+ spr->_flags._hide = false;
+ } else {
+ spr->_flags._hide = true;
+ spr->_scene = -1;
+ }
+ } else {
+ warning("SPR not found! ref: %d", 100 + i);
+ }
+ }
+
+ _lev = lev;
+ _maxScene = _maxSceneArr[_lev];
+}
+
+void CGEEngine::snFlag(int indx, bool v) {
+ _flag[indx] = v;
+}
+
+void CGEEngine::snSetRef(Sprite *spr, int nr) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snSetRef(spr, %d)", nr);
+
+ if (spr)
+ spr->_ref = nr;
+}
+
+void CGEEngine::snFlash(bool on) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snFlash(%s)", on ? "true" : "false");
+
+ if (on) {
+ Dac *pal = (Dac *)malloc(sizeof(Dac) * kPalCount);
+ if (pal) {
+ memcpy(pal, _vga->_sysPal, kPalSize);
+ for (int i = 0; i < kPalCount; i++) {
+ register int c;
+ c = pal[i]._r << 1;
+ pal[i]._r = (c < 64) ? c : 63;
+ c = pal[i]._g << 1;
+ pal[i]._g = (c < 64) ? c : 63;
+ c = pal[i]._b << 1;
+ pal[i]._b = (c < 64) ? c : 63;
+ }
+ _vga->setColors(pal, 64);
+ }
+ } else
+ _vga->setColors(_vga->_sysPal, 64);
+ _dark = false;
+}
+
+void CGEEngine::snLight(bool in) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snLight(%s)", in ? "true" : "false");
+
+ if (in)
+ _vga->sunrise(_vga->_sysPal);
+ else
+ _vga->sunset();
+ _dark = !in;
+}
+
+void CGEEngine::snHBarrier(const int scene, const int barX) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snHBarrier(%d, %d)", scene, barX);
+
+ _barriers[(scene > 0) ? scene : _now]._horz = barX;
+}
+
+void CGEEngine::snVBarrier(const int scene, const int barY) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snVBarrier(%d, %d)", scene, barY);
+
+ _barriers[(scene > 0) ? scene : _now]._vert = barY;
+}
+
+void CGEEngine::snWalk(Sprite *spr, int x, int y) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snWalk(spr, %d, %d)", x, y);
+
+ if (_hero) {
+ if (spr && y < 0)
+ _hero->findWay(spr);
+ else
+ _hero->findWay(XZ(x, y));
+ }
+}
+
+void CGEEngine::snReach(Sprite *spr, int mode) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snReach(spr, %d)", mode);
+
+ if (_hero)
+ _hero->reach(spr, mode);
+}
+
+void CGEEngine::snMouse(bool on) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::snMouse(%s)", on ? "true" : "false");
+
+ if (on)
+ _mouse->on();
+ else
+ _mouse->off();
+}
+
+} // End of namespace CGE
diff --git a/engines/cge/snail.h b/engines/cge/snail.h
new file mode 100644
index 0000000000..3acbbd0e5f
--- /dev/null
+++ b/engines/cge/snail.h
@@ -0,0 +1,85 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#ifndef CGE_COMMANDHANDLER_H
+#define CGE_COMMANDHANDLER_H
+
+#include "cge/cge.h"
+
+namespace CGE {
+
+#define kCommandFrameRate 80
+#define kCommandFrameDelay (1000 / kCommandFrameRate)
+#define kDressed 3
+
+enum CommandType {
+ kCmdLabel, kCmdPause, kCmdWait, kCmdLevel, kCmdHide,
+ kCmdSay, kCmdInf, kCmdTime, kCmdCave, kCmdKill,
+ kCmdRSeq, kCmdSeq, kCmdSend, kCmdSwap, kCmdKeep,
+ kCmdGive, kCmdIf, kCmdGame, kCmdSetX0, kCmdSetY0,
+ kCmdSlave, kCmdSetXY, kCmdRelX, kCmdRelY, kCmdRelZ,
+ kCmdSetX, kCmdSetY, kCmdSetZ, kCmdTrans, kCmdPort,
+ kCmdNext, kCmdNNext, kCmdTNext, kCmdRNNext, kCmdRTNext,
+ kCmdRMNear, kCmdRmTake, kCmdFlag, kCmdSetRef, kCmdBackPt,
+ kCmdFlash, kCmdLight, kCmdSetHBarrier, kCmdSetVBarrier, kCmdWalk,
+ kCmdReach, kCmdCover, kCmdUncover, kCmdClear, kCmdTalk,
+ kCmdMouse, kCmdSound, kCmdCount, kCmdExec, kCmdStep,
+ kCmdZTrim, kCmdGhost
+};
+
+class CommandHandler {
+public:
+ struct Command {
+ CommandType _commandType;
+ int _ref;
+ int _val;
+ void *_spritePtr;
+ CallbackType _cbType;
+ } *_commandList;
+ static const char *_commandText[];
+ bool _talkEnable;
+
+ CommandHandler(CGEEngine *vm, bool turbo);
+ ~CommandHandler();
+ void runCommand();
+ void addCommand(CommandType com, int ref, int val, void *ptr);
+ void addCallback(CommandType com, int ref, int val, CallbackType cbType);
+ void insertCommand(CommandType com, int ref, int val, void *ptr);
+ bool idle();
+private:
+ CGEEngine *_vm;
+ bool _turbo;
+ uint8 _head;
+ uint8 _tail;
+ bool _busy;
+ bool _textDelay;
+ uint32 _timerExpiry;
+};
+
+} // End of namespace CGE
+
+#endif
diff --git a/engines/cge/sound.cpp b/engines/cge/sound.cpp
new file mode 100644
index 0000000000..646689e99e
--- /dev/null
+++ b/engines/cge/sound.cpp
@@ -0,0 +1,290 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#include "cge/sound.h"
+#include "cge/text.h"
+#include "cge/cge_main.h"
+#include "common/config-manager.h"
+#include "common/memstream.h"
+#include "audio/decoders/raw.h"
+#include "audio/audiostream.h"
+
+namespace CGE {
+
+DataCk::DataCk(byte *buf, int bufSize) {
+ _buf = buf;
+ _ckSize = bufSize;
+}
+
+DataCk::~DataCk() {
+ free(_buf);
+}
+
+Sound::Sound(CGEEngine *vm) : _vm(vm) {
+ _audioStream = NULL;
+ _soundRepeatCount = 1;
+ open();
+}
+
+Sound::~Sound() {
+ close();
+}
+
+void Sound::close() {
+ _vm->_midiPlayer->killMidi();
+}
+
+void Sound::open() {
+ setRepeat(1);
+ play((*_vm->_fx)[30000], 8);
+}
+
+void Sound::setRepeat(int16 count) {
+ _soundRepeatCount = count;
+}
+
+int16 Sound::getRepeat() {
+ return _soundRepeatCount;
+}
+
+void Sound::play(DataCk *wav, int pan) {
+ if (wav) {
+ stop();
+ _smpinf._saddr = &*(wav->addr());
+ _smpinf._slen = (uint16)wav->size();
+ _smpinf._span = pan;
+ _smpinf._counter = getRepeat();
+ sndDigiStart(&_smpinf);
+ }
+}
+
+void Sound::sndDigiStart(SmpInfo *PSmpInfo) {
+ // Create an audio stream wrapper for sound
+ Common::MemoryReadStream *stream = new Common::MemoryReadStream(PSmpInfo->_saddr,
+ PSmpInfo->_slen, DisposeAfterUse::NO);
+ _audioStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
+
+ // Start the new sound
+ _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle,
+ Audio::makeLoopingAudioStream(_audioStream, (uint)PSmpInfo->_counter));
+}
+
+void Sound::stop() {
+ sndDigiStop(&_smpinf);
+}
+
+void Sound::sndDigiStop(SmpInfo *PSmpInfo) {
+ if (_vm->_mixer->isSoundHandleActive(_soundHandle))
+ _vm->_mixer->stopHandle(_soundHandle);
+ _audioStream = NULL;
+}
+
+Fx::Fx(CGEEngine *vm, int size) : _current(NULL), _vm(vm) {
+ _cache = new Handler[size];
+ for (_size = 0; _size < size; _size++) {
+ _cache[_size]._ref = 0;
+ _cache[_size]._wav = NULL;
+ }
+}
+
+Fx::~Fx() {
+ clear();
+ delete[] _cache;
+}
+
+void Fx::clear() {
+ for (Handler *p = _cache, *q = p + _size; p < q; p++) {
+ if (p->_ref) {
+ p->_ref = 0;
+ delete p->_wav;
+ p->_wav = NULL;
+ }
+ }
+ _current = NULL;
+}
+
+int Fx::find(int ref) {
+ int i = 0;
+ for (Handler *p = _cache, *q = p + _size; p < q; p++) {
+ if (p->_ref == ref)
+ break;
+ else
+ ++i;
+ }
+ return i;
+}
+
+void Fx::preload(int ref0) {
+ Handler *cacheLim = _cache + _size;
+ char filename[12];
+
+ for (int ref = ref0; ref < ref0 + 10; ref++) {
+ sprintf(filename, "FX%05d.WAV", ref);
+ EncryptedStream file(_vm, filename);
+ DataCk *wav = loadWave(&file);
+ if (wav) {
+ Handler *p = &_cache[find(0)];
+ if (p >= cacheLim)
+ break;
+ p->_wav = wav;
+ p->_ref = ref;
+ } else {
+ warning("Unable to load %s", filename);
+ }
+ }
+}
+
+DataCk *Fx::load(int idx, int ref) {
+ char filename[12];
+ sprintf(filename, "FX%05d.WAV", ref);
+
+ EncryptedStream file(_vm, filename);
+ DataCk *wav = loadWave(&file);
+ if (wav) {
+ Handler *p = &_cache[idx];
+ p->_wav = wav;
+ p->_ref = ref;
+ } else {
+ warning("Unable to load %s", filename);
+ }
+ return wav;
+}
+
+DataCk *Fx::loadWave(EncryptedStream *file) {
+ byte *data = (byte *)malloc(file->size());
+ file->read(data, file->size());
+
+ return new DataCk(data, file->size());
+}
+
+DataCk *Fx::operator[](int ref) {
+ int i;
+ if ((i = find(ref)) < _size)
+ _current = _cache[i]._wav;
+ else {
+ if ((i = find(0)) >= _size) {
+ clear();
+ i = 0;
+ }
+ _current = load(i, ref);
+ }
+ return _current;
+}
+
+MusicPlayer::MusicPlayer(CGEEngine *vm) : _vm(vm) {
+ _data = NULL;
+ _isGM = false;
+
+ MidiPlayer::createDriver();
+
+ int ret = _driver->open();
+ if (ret == 0) {
+ if (_nativeMT32)
+ _driver->sendMT32Reset();
+ else
+ _driver->sendGMReset();
+
+ // TODO: Load cmf.ins with the instrument table. It seems that an
+ // interface for such an operation is supported for AdLib. Maybe for
+ // this card, setting instruments is necessary.
+
+ _driver->setTimerCallback(this, &timerCallback);
+ }
+}
+
+MusicPlayer::~MusicPlayer() {
+ killMidi();
+}
+
+void MusicPlayer::killMidi() {
+ Audio::MidiPlayer::stop();
+
+ free(_data);
+ _data = NULL;
+}
+
+void MusicPlayer::loadMidi(int ref) {
+ // Work out the filename and check the given MIDI file exists
+ Common::String filename = Common::String::format("%.2d.MID", ref);
+ if (!_vm->_resman->exist(filename.c_str()))
+ return;
+
+ // Stop any currently playing MIDI file
+ killMidi();
+
+ // Read in the data for the file
+ EncryptedStream mid(_vm, filename.c_str());
+ _dataSize = mid.size();
+ _data = (byte *)malloc(_dataSize);
+ mid.read(_data, _dataSize);
+
+ // Start playing the music
+ sndMidiStart();
+}
+
+void MusicPlayer::sndMidiStart() {
+ _isGM = true;
+
+ MidiParser *parser = MidiParser::createParser_SMF();
+ if (parser->loadMusic(_data, _dataSize)) {
+ parser->setTrack(0);
+ parser->setMidiDriver(this);
+ parser->setTimerRate(_driver->getBaseTempo());
+ parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1);
+
+ _parser = parser;
+
+ syncVolume();
+
+ // Al the tracks are supposed to loop
+ _isLooping = true;
+ _isPlaying = true;
+ }
+}
+
+void MusicPlayer::send(uint32 b) {
+ if ((b & 0xF0) == 0xC0 && !_isGM && !_nativeMT32) {
+ b = (b & 0xFFFF00FF) | MidiDriver::_mt32ToGm[(b >> 8) & 0xFF] << 8;
+ }
+
+ Audio::MidiPlayer::send(b);
+}
+
+void MusicPlayer::sendToChannel(byte channel, uint32 b) {
+ if (!_channelsTable[channel]) {
+ _channelsTable[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();
+ // If a new channel is allocated during the playback, make sure
+ // its volume is correctly initialized.
+ if (_channelsTable[channel])
+ _channelsTable[channel]->volume(_channelsVolume[channel] * _masterVolume / 255);
+ }
+
+ if (_channelsTable[channel])
+ _channelsTable[channel]->send(b);
+}
+
+} // End of namespace CGE
diff --git a/engines/cge/sound.h b/engines/cge/sound.h
new file mode 100644
index 0000000000..a3f4d4d777
--- /dev/null
+++ b/engines/cge/sound.h
@@ -0,0 +1,136 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#ifndef CGE_SOUND_H
+#define CGE_SOUND_H
+
+#include "cge/fileio.h"
+#include "audio/audiostream.h"
+#include "audio/decoders/wave.h"
+#include "audio/fmopl.h"
+#include "audio/mididrv.h"
+#include "audio/midiparser.h"
+#include "audio/midiplayer.h"
+#include "audio/mixer.h"
+#include "common/memstream.h"
+
+namespace CGE {
+
+class CGEEngine;
+
+// sample info
+struct SmpInfo {
+ const uint8 *_saddr; // address
+ uint16 _slen; // length
+ uint16 _span; // left/right pan (0-15)
+ int _counter; // number of time the sample should be played
+};
+
+class DataCk {
+ byte *_buf;
+ int _ckSize;
+public:
+ DataCk(byte *buf, int bufSize);
+ ~DataCk();
+ inline const byte *addr() {
+ return _buf;
+ }
+ inline int size() {
+ return _ckSize;
+ }
+};
+
+class Sound {
+public:
+ SmpInfo _smpinf;
+
+ Sound(CGEEngine *vm);
+ ~Sound();
+ void open();
+ void close();
+ void play(DataCk *wav, int pan);
+ int16 getRepeat();
+ void setRepeat(int16 count);
+ void stop();
+private:
+ int _soundRepeatCount;
+ CGEEngine *_vm;
+ Audio::SoundHandle _soundHandle;
+ Audio::RewindableAudioStream *_audioStream;
+
+ void sndDigiStart(SmpInfo *PSmpInfo);
+ void sndDigiStop(SmpInfo *PSmpInfo);
+};
+
+class Fx {
+ CGEEngine *_vm;
+ struct Handler {
+ int _ref;
+ DataCk *_wav;
+ } *_cache;
+ int _size;
+
+ DataCk *load(int idx, int ref);
+ DataCk *loadWave(EncryptedStream *file);
+ int find(int ref);
+public:
+ DataCk *_current;
+
+ Fx(CGEEngine *vm, int size);
+ ~Fx();
+ void clear();
+ void preload(int ref0);
+ DataCk *operator[](int ref);
+};
+
+class MusicPlayer: public Audio::MidiPlayer {
+private:
+ CGEEngine *_vm;
+ byte *_data;
+ int _dataSize;
+ bool _isGM;
+
+ // Start MIDI File
+ void sndMidiStart();
+
+ // Stop MIDI File
+ void sndMidiStop();
+public:
+ MusicPlayer(CGEEngine *vm);
+ ~MusicPlayer();
+
+ void loadMidi(int ref);
+ void killMidi();
+
+ virtual void send(uint32 b);
+ virtual void sendToChannel(byte channel, uint32 b);
+};
+
+} // End of namespace CGE
+
+#endif
+
diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp
new file mode 100644
index 0000000000..467b39be40
--- /dev/null
+++ b/engines/cge/talk.cpp
@@ -0,0 +1,292 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#include "cge/general.h"
+#include "cge/talk.h"
+#include "cge/game.h"
+#include "cge/events.h"
+#include "cge/cge_main.h"
+
+namespace CGE {
+
+Font::Font(CGEEngine *vm, const char *name) : _vm(vm) {
+ _map = (uint8 *)malloc(kMapSize);
+ _pos = (uint16 *)malloc(kPosSize * sizeof(uint16));
+ _widthArr = (uint8 *)malloc(kWidSize);
+
+ assert((_map != NULL) && (_pos != NULL) && (_widthArr != NULL));
+ _vm->mergeExt(_path, name, kFontExt);
+ load();
+}
+
+Font::~Font() {
+ free(_map);
+ free(_pos);
+ free(_widthArr);
+}
+
+void Font::load() {
+ EncryptedStream f(_vm, _path);
+ assert(!f.err());
+
+ f.read(_widthArr, kWidSize);
+ assert(!f.err());
+
+ uint16 p = 0;
+ for (uint16 i = 0; i < kPosSize; i++) {
+ _pos[i] = p;
+ p += _widthArr[i];
+ }
+ f.read(_map, p);
+}
+
+uint16 Font::width(const char *text) {
+ uint16 w = 0;
+ if (!text)
+ return 0;
+ while (*text)
+ w += _widthArr[(unsigned char)*(text++)];
+ return w;
+}
+
+Talk::Talk(CGEEngine *vm, const char *text, TextBoxStyle mode)
+ : Sprite(vm, NULL), _mode(mode), _vm(vm) {
+ _ts = NULL;
+ _flags._syst = true;
+ update(text);
+}
+
+
+Talk::Talk(CGEEngine *vm)
+ : Sprite(vm, NULL), _mode(kTBPure), _vm(vm) {
+ _ts = NULL;
+ _flags._syst = true;
+}
+
+void Talk::update(const char *text) {
+ const uint16 vmarg = (_mode) ? kTextVMargin : 0;
+ const uint16 hmarg = (_mode) ? kTextHMargin : 0;
+ uint16 mw = 0;
+ uint16 ln = vmarg;
+ uint8 *m;
+
+ if (!_ts) {
+ uint16 k = 2 * hmarg;
+ uint16 mh = 2 * vmarg + kFontHigh;
+ for (const char *p = text; *p; p++) {
+ if (*p == '|' || *p == '\n') {
+ mh += kFontHigh + kTextLineSpace;
+ if (k > mw)
+ mw = k;
+ k = 2 * hmarg;
+ } else
+ k += _vm->_font->_widthArr[(unsigned char)*p];
+ }
+ if (k > mw)
+ mw = k;
+
+ _ts = new BitmapPtr[2];
+ _ts[0] = box(mw, mh);
+ _ts[1] = NULL;
+ }
+
+ m = _ts[0]->_m + ln * mw + hmarg;
+
+ while (*text) {
+ if (*text == '|' || *text == '\n') {
+ m = _ts[0]->_m + (ln += kFontHigh + kTextLineSpace) * mw + hmarg;
+ } else {
+ int cw = _vm->_font->_widthArr[(unsigned char)*text];
+ uint8 *f = _vm->_font->_map + _vm->_font->_pos[(unsigned char)*text];
+ for (int i = 0; i < cw; i++) {
+ uint8 *pp = m;
+ uint16 n;
+ uint16 b = *(f++);
+ for (n = 0; n < kFontHigh; n++) {
+ if (b & 1)
+ *pp = kTextColFG;
+ b >>= 1;
+ pp += mw;
+ }
+ m++;
+ }
+ }
+ text++;
+ }
+ _ts[0]->code();
+ setShapeList(_ts);
+}
+
+Bitmap *Talk::box(uint16 w, uint16 h) {
+ if (w < 8)
+ w = 8;
+ if (h < 8)
+ h = 8;
+ uint16 n = w * h;
+ uint8 *b = (uint8 *)malloc(n);
+ assert(b != NULL);
+ memset(b, kTextColBG, n);
+
+ if (_mode) {
+ uint8 *p = b;
+ uint8 *q = b + n - w;
+ memset(p, kVgaColLightGray, w);
+ memset(q, kVgaColDarkGray, w);
+ while (p < q) {
+ p += w;
+ *(p - 1) = kVgaColDarkGray;
+ *p = kVgaColLightGray;
+ }
+ p = b;
+ const uint16 r = (_mode == kTBRound) ? kTextRoundCorner : 0;
+ for (int i = 0; i < r; i++) {
+ int j;
+ for (j = 0; j < r - i; j++) {
+ p[j] = kPixelTransp;
+ p[w - j - 1] = kPixelTransp;
+ q[j] = kPixelTransp;
+ q[w - j - 1] = kPixelTransp;
+ }
+ p[j] = kVgaColLightGray;
+ p[w - j - 1] = kVgaColDarkGray;
+ q[j] = kVgaColLightGray;
+ q[w - j - 1] = kVgaColDarkGray;
+ p += w;
+ q -= w;
+ }
+ }
+ return new Bitmap(_vm, w, h, b);
+}
+
+void Talk::putLine(int line, const char *text) {
+ // Note: (_ts[0]._w % 4) must be 0
+ uint16 w = _ts[0]->_w;
+ uint16 h = _ts[0]->_h;
+ uint8 *v = _ts[0]->_v;
+ uint16 dsiz = w >> 2; // data size (1 plane line size)
+ uint16 lsiz = 2 + dsiz + 2; // uint16 for line header, uint16 for gap
+ uint16 psiz = h * lsiz; // - last gap, but + plane trailer
+ uint16 size = 4 * psiz; // whole map size
+ uint16 rsiz = kFontHigh * lsiz; // length of whole text row map
+
+ // set desired line pointer
+ v += (kTextVMargin + (kFontHigh + kTextLineSpace) * line) * lsiz;
+ uint8 *p = v; // assume blanked line above text
+
+ // clear whole rectangle
+ assert((rsiz % lsiz) == 0);
+ for (int planeCtr = 0; planeCtr < 4; planeCtr++, p += psiz) {
+ for (byte *pDest = p; pDest < (p + (rsiz - lsiz)); pDest += lsiz)
+ Common::copy(p - lsiz, p, pDest);
+ }
+
+ // paint text line
+ if (!text)
+ return;
+ p = v + 2 + (kTextHMargin / 4) + (kTextHMargin % 4) * psiz;
+ uint8 *q = v + size;
+
+ while (*text) {
+ uint16 cw = _vm->_font->_widthArr[(unsigned char)*text], i;
+ uint8 *fp = _vm->_font->_map + _vm->_font->_pos[(unsigned char)*text];
+
+ for (i = 0; i < cw; i++) {
+ uint16 b = fp[i];
+ uint16 n;
+ for (n = 0; n < kFontHigh; n++) {
+ if (b & 1)
+ *p = kTextColFG;
+ b >>= 1;
+ p += lsiz;
+ }
+ p = p - rsiz + psiz;
+ if (p >= q)
+ p = p - size + 1;
+ }
+ text++;
+ }
+}
+
+InfoLine::InfoLine(CGEEngine *vm, uint16 w) : Talk(vm), _oldText(NULL), _vm(vm) {
+ if (!_ts) {
+ _ts = new BitmapPtr[2];
+ _ts[1] = NULL;
+ }
+
+ _ts[0] = new Bitmap(_vm, w, kFontHigh, kTextColBG);
+ setShapeList(_ts);
+}
+
+void InfoLine::update(const char *text) {
+ if (text == _oldText)
+ return;
+
+ uint16 w = _ts[0]->_w;
+ uint16 h = _ts[0]->_h;
+ uint8 *v = (uint8 *)_ts[0]->_v;
+ uint16 dsiz = w >> 2; // data size (1 plane line size)
+ uint16 lsiz = 2 + dsiz + 2; // uint16 for line header, uint16 for gap
+ uint16 psiz = h * lsiz; // - last gape, but + plane trailer
+ uint16 size = 4 * psiz; // whole map size
+
+ // clear whole rectangle
+ memset(v + 2, kTextColBG, dsiz); // data bytes
+ for (byte *pDest = v + lsiz; pDest < (v + psiz); pDest += lsiz) {
+ Common::copy(v, v + lsiz, pDest);
+ }
+ *(uint16 *)(v + psiz - 2) = TO_LE_16(kBmpEOI); // plane trailer uint16
+ for (byte *pDest = v + psiz; pDest < (v + 4 * psiz); pDest += psiz) {
+ Common::copy(v, v + psiz, pDest);
+ }
+
+ // paint text line
+ if (text) {
+ uint8 *p = v + 2, * q = p + size;
+
+ while (*text) {
+ uint16 cw = _vm->_font->_widthArr[(unsigned char)*text];
+ uint8 *fp = _vm->_font->_map + _vm->_font->_pos[(unsigned char)*text];
+
+ for (uint16 i = 0; i < cw; i++) {
+ uint16 b = fp[i];
+ for (uint16 n = 0; n < kFontHigh; n++) {
+ if (b & 1)
+ *p = kTextColFG;
+ b >>= 1;
+ p += lsiz;
+ }
+ if (p >= q)
+ p = p - size + 1;
+ }
+ text++;
+ }
+ }
+
+ _oldText = text;
+}
+
+} // End of namespace CGE
diff --git a/engines/cge/talk.h b/engines/cge/talk.h
new file mode 100644
index 0000000000..55c529b7ea
--- /dev/null
+++ b/engines/cge/talk.h
@@ -0,0 +1,76 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#ifndef CGE_TALK_H
+#define CGE_TALK_H
+
+#include "cge/general.h"
+#include "cge/vga13h.h"
+
+namespace CGE {
+
+#define kTextColFG kVgaColDark // foreground color
+#define kTextColBG kVgaColGray // background color
+#define kTextHMargin (6&~1) // EVEN horizontal margins!
+#define kTextVMargin 5 // vertical margins
+#define kTextLineSpace 2 // line spacing
+#define kTextRoundCorner 3 // rounded corners
+#define kWidSize 256
+#define kPosSize 256
+#define kMapSize (256*8)
+#define kFontHigh 8
+#define kFontExt ".CFT"
+
+enum TextBoxStyle { kTBPure, kTBRect, kTBRound };
+
+class Talk : public Sprite {
+protected:
+ TextBoxStyle _mode;
+ BitmapPtr *_ts;
+ Bitmap *box(uint16 w, uint16 h);
+public:
+ Talk(CGEEngine *vm, const char *text, TextBoxStyle mode);
+ Talk(CGEEngine *vm);
+
+ virtual void update(const char *text);
+ void putLine(int line, const char *text);
+private:
+ CGEEngine *_vm;
+};
+
+class InfoLine : public Talk {
+ const char *_oldText;
+public:
+ InfoLine(CGEEngine *vm, uint16 wid);
+ void update(const char *text);
+private:
+ CGEEngine *_vm;
+};
+
+} // End of namespace CGE
+
+#endif
diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp
new file mode 100644
index 0000000000..64f9959442
--- /dev/null
+++ b/engines/cge/text.cpp
@@ -0,0 +1,205 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#include "cge/general.h"
+#include "cge/text.h"
+#include "cge/talk.h"
+#include "cge/game.h"
+#include "cge/snail.h"
+#include "cge/cge_main.h"
+#include "common/str.h"
+
+namespace CGE {
+
+Text::Text(CGEEngine *vm, const char *fname) : _vm(vm) {
+ _vm->mergeExt(_fileName, fname, kSayExt);
+ if (!_vm->_resman->exist(_fileName))
+ error("No talk (%s)\n", _fileName);
+ int16 txtCount = count() + 1;
+ if (!txtCount)
+ error("Unable to read dialog file %s", _fileName);
+
+ _cache = new Handler[txtCount];
+ for (_size = 0; _size < txtCount; _size++) {
+ _cache[_size]._ref = 0;
+ _cache[_size]._text = NULL;
+ }
+ load();
+}
+
+Text::~Text() {
+ clear();
+ delete[] _cache;
+}
+
+int16 Text::count() {
+ EncryptedStream tf(_vm, _fileName);
+ if (tf.err())
+ return -1;
+
+ Common::String line;
+ char tmpStr[kLineMax + 1];
+
+ int counter = 0;
+
+ for (line = tf.readLine(); !tf.eos(); line = tf.readLine()) {
+ char *s;
+
+ strcpy(tmpStr, line.c_str());
+ if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
+ continue;
+ if (!isdigit(*s))
+ continue;
+
+ counter++;
+ }
+ return counter;
+}
+
+void Text::clear() {
+ for (Handler *p = _cache, *q = p + _size; p < q; p++) {
+ if (p->_ref) {
+ p->_ref = 0;
+ delete[] p->_text;
+ p->_text = NULL;
+ }
+ }
+}
+
+void Text::load() {
+ EncryptedStream tf(_vm, _fileName);
+ assert(!tf.err());
+
+ Common::String line;
+ char tmpStr[kLineMax + 1];
+ int idx;
+
+ for (idx = 0, line = tf.readLine(); !tf.eos(); line = tf.readLine()) {
+ int n = line.size();
+ char *s;
+
+ strcpy(tmpStr, line.c_str());
+ if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
+ continue;
+ if (!isdigit(*s))
+ continue;
+
+ int r = atoi(s);
+
+ s += strlen(s);
+ if (s < tmpStr + n)
+ ++s;
+
+ _cache[idx]._ref = r;
+ _cache[idx]._text = new char[strlen(s) + 1];
+ strcpy(_cache[idx]._text, s);
+ idx++;
+ }
+}
+
+char *Text::getText(int ref) {
+ int i;
+ for (i = 0; (i < _size) && (_cache[i]._ref != ref); i++)
+ ;
+
+ if (i < _size)
+ return _cache[i]._text;
+
+ warning("getText: Unable to find ref %d", ref);
+ return NULL;
+}
+
+void Text::say(const char *text, Sprite *spr) {
+ _vm->killText();
+ _vm->_talk = new Talk(_vm, text, kTBRound);
+ if (!_vm->_talk)
+ return;
+
+ bool east = spr->_flags._east;
+ int x = (east) ? (spr->_x + spr->_w - 2) : (spr->_x + 2);
+ int y = spr->_y + 2;
+ Speaker *speaker = new Speaker(_vm);
+ uint16 sw = speaker->_w;
+
+ if (east) {
+ if (x + sw + kTextRoundCorner + 5 >= kScrWidth)
+ east = false;
+ } else {
+ if (x <= 5 + kTextRoundCorner + sw)
+ east = true;
+ }
+ x = (east) ? (spr->_x + spr->_w - 2) : (spr->_x + 2 - sw);
+ if (spr->_ref == 1)
+ x += ((east) ? -10 : 10); // Hero
+
+ _vm->_talk->_flags._kill = true;
+ _vm->_talk->_flags._bDel = true;
+ _vm->_talk->setName(_vm->_text->getText(kSayName));
+ _vm->_talk->gotoxy(x - (_vm->_talk->_w - sw) / 2 - 3 + 6 * east, y - speaker->_h - _vm->_talk->_h + 1);
+ _vm->_talk->_z = 125;
+ _vm->_talk->_ref = kSayRef;
+
+ speaker->gotoxy(x, _vm->_talk->_y + _vm->_talk->_h - 1);
+ speaker->_z = 126;
+ speaker->_flags._slav = true;
+ speaker->_flags._kill = true;
+ speaker->setName(_vm->_text->getText(kSayName));
+ speaker->step(east);
+ speaker->_ref = kSayRef;
+
+ _vm->_vga->_showQ->insert(_vm->_talk, _vm->_vga->_showQ->last());
+ _vm->_vga->_showQ->insert(speaker, _vm->_vga->_showQ->last());
+}
+
+void CGEEngine::inf(const char *text) {
+ debugC(1, kCGEDebugEngine, "CGEEngine::inf(%s)", text);
+
+ killText();
+ _talk = new Talk(this, text, kTBRect);
+ if (!_talk)
+ return;
+
+ _talk->_flags._kill = true;
+ _talk->_flags._bDel = true;
+ _talk->setName(_text->getText(kInfName));
+ _talk->center();
+ _talk->gotoxy(_talk->_x, _talk->_y - 20);
+ _talk->_z = 126;
+ _talk->_ref = kInfRef;
+ _vga->_showQ->insert(_talk, _vga->_showQ->last());
+}
+
+void Text::sayTime(Sprite *spr) {
+ TimeDate curTime;
+ _vm->_system->getTimeAndDate(curTime);
+
+ char t[6];
+ sprintf(t, "%d:%02d", curTime.tm_hour, curTime.tm_min);
+ say(t, spr);
+}
+
+} // End of namespace CGE
diff --git a/engines/cge/text.h b/engines/cge/text.h
new file mode 100644
index 0000000000..13ce6bbfbb
--- /dev/null
+++ b/engines/cge/text.h
@@ -0,0 +1,66 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#ifndef CGE_TEXT_H
+#define CGE_TEXT_H
+
+#include "cge/talk.h"
+
+namespace CGE {
+
+#define kSayExt ".SAY"
+#define kSysTextMax 1000
+#define kTextNoMouse 95
+#define kInfName 101
+#define kSayName 102
+#define kInfRef 301
+#define kSayRef 302
+
+
+class Text {
+ struct Handler {
+ int _ref;
+ char *_text;
+ } *_cache;
+ int _size;
+ char _fileName[kPathMax];
+ void load();
+ int16 count();
+public:
+ Text(CGEEngine *vm, const char *fname);
+ ~Text();
+ void clear();
+ char *getText(int ref);
+ void say(const char *text, Sprite *spr);
+ void sayTime(Sprite *spr);
+private:
+ CGEEngine *_vm;
+};
+
+} // End of namespace CGE
+
+#endif
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
new file mode 100644
index 0000000000..49cfcd3084
--- /dev/null
+++ b/engines/cge/vga13h.cpp
@@ -0,0 +1,1009 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#include "common/array.h"
+#include "common/rect.h"
+#include "graphics/palette.h"
+#include "cge/general.h"
+#include "cge/vga13h.h"
+#include "cge/bitmap.h"
+#include "cge/text.h"
+#include "cge/cge_main.h"
+#include "cge/cge.h"
+
+namespace CGE {
+
+Seq *getConstantSeq(bool seqFlag) {
+ const Seq seq1[] = { { 0, 0, 0, 0, 0 } };
+ const Seq seq2[] = { { 0, 1, 0, 0, 0 }, { 1, 0, 0, 0, 0 } };
+
+ Seq *seq;
+ if (seqFlag) {
+ seq = (Seq *)malloc(1 * sizeof(Seq));
+ *seq = seq1[0];
+ } else {
+ seq = (Seq *)malloc(2 * sizeof(Seq));
+ seq[0] = seq2[0];
+ seq[1] = seq2[1];
+ }
+
+ return seq;
+}
+
+Sprite::Sprite(CGEEngine *vm, BitmapPtr *shpP)
+ : _x(0), _y(0), _z(0), _nearPtr(0), _takePtr(0),
+ _next(NULL), _prev(NULL), _seqPtr(kNoSeq), _time(0),
+ _ext(NULL), _ref(-1), _scene(0), _vm(vm) {
+ memset(_file, 0, sizeof(_file));
+ memset(&_flags, 0, sizeof(_flags));
+ _ref = 0;
+ _x = _y = 0;
+ _w = _h = 0;
+ _time = 0;
+ _seqPtr = 0;
+ _shpCnt = 0;
+ _prev = _next = NULL;
+
+ setShapeList(shpP);
+}
+
+Sprite::~Sprite() {
+ if (_vm->_sprite == this)
+ _vm->_sprite = NULL;
+
+ contract();
+}
+
+BitmapPtr Sprite::shp() {
+ SprExt *e = _ext;
+ if (!e || !e->_seq)
+ return NULL;
+
+ int i = e->_seq[_seqPtr]._now;
+ if (i >= _shpCnt)
+ error("Invalid PHASE in SPRITE::Shp() %s", _file);
+ return e->_shpList[i];
+}
+
+BitmapPtr *Sprite::setShapeList(BitmapPtr *shpP) {
+ BitmapPtr *r = (_ext) ? _ext->_shpList : NULL;
+
+ _shpCnt = 0;
+ _w = 0;
+ _h = 0;
+
+ if (shpP) {
+ BitmapPtr *p;
+ for (p = shpP; *p; p++) {
+ BitmapPtr b = (*p); // ->Code();
+ if (b->_w > _w)
+ _w = b->_w;
+ if (b->_h > _h)
+ _h = b->_h;
+ _shpCnt++;
+ }
+ expand();
+ _ext->_shpList = shpP;
+ _flags._bDel = true;
+ if (!_ext->_seq)
+ setSeq(getConstantSeq(_shpCnt < 2));
+ }
+ return r;
+}
+
+void Sprite::moveShapes(uint8 *buf) {
+ BitmapPtr *p;
+ for (p = _ext->_shpList; *p; p++) {
+ buf += (*p)->moveVmap(buf);
+ }
+}
+
+bool Sprite::works(Sprite *spr) {
+ if (!spr || !spr->_ext)
+ return false;
+
+ CommandHandler::Command *c = spr->_ext->_take;
+ if (c != NULL) {
+ c += spr->_takePtr;
+ if (c->_ref == _ref)
+ if (c->_commandType != kCmdLabel || (c->_val == 0 || c->_val == _vm->_now))
+ return true;
+ }
+
+ return false;
+}
+
+Seq *Sprite::setSeq(Seq *seq) {
+ if (_ext) {
+ free(_ext->_seq);
+ _ext->_seq = NULL;
+ }
+
+ expand();
+
+ Seq *s = _ext->_seq;
+ _ext->_seq = seq;
+ if (_seqPtr == kNoSeq)
+ step(0);
+ else if (_time == 0)
+ step(_seqPtr);
+ return s;
+}
+
+bool Sprite::seqTest(int n) {
+ if (n >= 0)
+ return (_seqPtr == n);
+ if (_ext)
+ return (_ext->_seq[_seqPtr]._next == _seqPtr);
+ return true;
+}
+
+CommandHandler::Command *Sprite::snList(SnList type) {
+ SprExt *e = _ext;
+ if (e)
+ return (type == kNear) ? e->_near : e->_take;
+ return NULL;
+}
+
+void Sprite::setName(char *newName) {
+ if (!_ext)
+ return;
+
+ if (_ext->_name) {
+ delete[] _ext->_name;
+ _ext->_name = NULL;
+ }
+ if (newName) {
+ _ext->_name = new char[strlen(newName) + 1];
+ assert(_ext->_name != NULL);
+ strcpy(_ext->_name, newName);
+ }
+}
+
+Sprite *Sprite::expand() {
+ if (_ext)
+ return this;
+
+ _ext = new SprExt;
+ assert(_ext != NULL);
+ if (!*_file)
+ return this;
+
+ static const char *Comd[] = { "Name", "Phase", "Seq", "Near", "Take", NULL };
+ char fname[kPathMax];
+
+ Common::Array<BitmapPtr> shplist;
+ for (int i = 0; i < _shpCnt + 1; ++i)
+ shplist.push_back(NULL);
+
+ Seq *seq = NULL;
+ int shapeCount = 0,
+ seqCount = 0,
+ nearCount = 0,
+ takeCount = 0,
+ maxnow = 0,
+ maxnxt = 0;
+
+ CommandHandler::Command *nearList = NULL;
+ CommandHandler::Command *takeList = NULL;
+ _vm->mergeExt(fname, _file, kSprExt);
+ if (_vm->_resman->exist(fname)) { // sprite description file exist
+ EncryptedStream sprf(_vm, fname);
+ if (sprf.err())
+ error("Bad SPR [%s]", fname);
+ Common::String line;
+ char tmpStr[kLineMax + 1];
+ int len = 0, lcnt = 0;
+
+ for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()) {
+ len = line.size();
+ strcpy(tmpStr, line.c_str());
+ lcnt++;
+ if (len == 0 || *tmpStr == '.')
+ continue;
+
+ CommandHandler::Command *c;
+ switch (_vm->takeEnum(Comd, strtok(tmpStr, " =\t"))) {
+ case 0:
+ // Name
+ setName(strtok(NULL, ""));
+ break;
+ case 1:
+ // Phase
+ // In case the shape index gets too high, increase the array size
+ while ((shapeCount + 1) >= (int)shplist.size()) {
+ shplist.push_back(NULL);
+ ++_shpCnt;
+ }
+ shplist[shapeCount++] = new Bitmap(_vm, strtok(NULL, " \t,;/"));
+ break;
+ case 2:
+ // Seq
+ seq = (Seq *)realloc(seq, (seqCount + 1) * sizeof(*seq));
+ assert(seq != NULL);
+ Seq *s;
+ s = &seq[seqCount++];
+ s->_now = atoi(strtok(NULL, " \t,;/"));
+ if (s->_now > maxnow)
+ maxnow = s->_now;
+ s->_next = atoi(strtok(NULL, " \t,;/"));
+ switch (s->_next) {
+ case 0xFF:
+ s->_next = seqCount;
+ break;
+ case 0xFE:
+ s->_next = seqCount - 1;
+ break;
+ }
+ if (s->_next > maxnxt)
+ maxnxt = s->_next;
+ s->_dx = atoi(strtok(NULL, " \t,;/"));
+ s->_dy = atoi(strtok(NULL, " \t,;/"));
+ s->_dly = atoi(strtok(NULL, " \t,;/"));
+ break;
+ case 3:
+ // Near
+ if (_nearPtr == kNoPtr)
+ break;
+ nearList = (CommandHandler::Command *)realloc(nearList, (nearCount + 1) * sizeof(*nearList));
+ assert(nearList != NULL);
+ c = &nearList[nearCount++];
+ if ((c->_commandType = (CommandType)_vm->takeEnum(CommandHandler::_commandText, strtok(NULL, " \t,;/"))) < 0)
+ error("Bad NEAR in %d [%s]", lcnt, fname);
+ c->_ref = atoi(strtok(NULL, " \t,;/"));
+ c->_val = atoi(strtok(NULL, " \t,;/"));
+ c->_spritePtr = NULL;
+ break;
+ case 4:
+ // Take
+ if (_takePtr == kNoPtr)
+ break;
+ takeList = (CommandHandler::Command *)realloc(takeList, (takeCount + 1) * sizeof(*takeList));
+ assert(takeList != NULL);
+ c = &takeList[takeCount++];
+ if ((c->_commandType = (CommandType)_vm->takeEnum(CommandHandler::_commandText, strtok(NULL, " \t,;/"))) < 0)
+ error("Bad NEAR in %d [%s]", lcnt, fname);
+ c->_ref = atoi(strtok(NULL, " \t,;/"));
+ c->_val = atoi(strtok(NULL, " \t,;/"));
+ c->_spritePtr = NULL;
+ break;
+ }
+ }
+ } else {
+ // no sprite description: try to read immediately from .BMP
+ shplist[shapeCount++] = new Bitmap(_vm, _file);
+ }
+
+ shplist[shapeCount] = NULL;
+ if (seq) {
+ if (maxnow >= shapeCount)
+ error("Bad PHASE in SEQ [%s]", fname);
+ if (maxnxt >= seqCount)
+ error("Bad JUMP in SEQ [%s]", fname);
+ setSeq(seq);
+ } else
+ setSeq(getConstantSeq(_shpCnt == 1));
+
+ // Set the shape list
+ BitmapPtr *shapeList = new BitmapPtr[shplist.size()];
+ for (uint i = 0; i < shplist.size(); ++i)
+ shapeList[i] = shplist[i];
+
+ setShapeList(shapeList);
+
+ if (nearList)
+ nearList[nearCount - 1]._spritePtr = _ext->_near = nearList;
+ else
+ _nearPtr = kNoPtr;
+ if (takeList)
+ takeList[takeCount - 1]._spritePtr = _ext->_take = takeList;
+ else
+ _takePtr = kNoPtr;
+
+ return this;
+}
+
+Sprite *Sprite::contract() {
+ SprExt *e = _ext;
+ if (!e)
+ return this;
+
+ if (e->_name)
+ delete[] e->_name;
+ if (_flags._bDel && e->_shpList) {
+ for (int i = 0; e->_shpList[i]; i++)
+ delete e->_shpList[i];
+ delete[] e->_shpList;
+ }
+
+ free(e->_seq);
+ free(e->_near);
+ free(e->_take);
+
+ delete e;
+ _ext = NULL;
+
+ return this;
+}
+
+Sprite *Sprite::backShow(bool fast) {
+ expand();
+ show(2);
+ show(1);
+ if (fast)
+ show(0);
+ contract();
+ return this;
+}
+
+void Sprite::step(int nr) {
+ if (nr >= 0)
+ _seqPtr = nr;
+ if (_ext) {
+ Seq *seq;
+ if (nr < 0)
+ _seqPtr = _ext->_seq[_seqPtr]._next;
+ seq = _ext->_seq + _seqPtr;
+ if (seq->_dly >= 0) {
+ gotoxy(_x + (seq->_dx), _y + (seq->_dy));
+ _time = seq->_dly;
+ }
+ }
+}
+
+void Sprite::tick() {
+ step();
+}
+
+void Sprite::makeXlat(uint8 *x) {
+ if (!_ext)
+ return;
+
+ if (_flags._xlat)
+ killXlat();
+ for (BitmapPtr *b = _ext->_shpList; *b; b++)
+ (*b)->_m = x;
+ _flags._xlat = true;
+}
+
+void Sprite::killXlat() {
+ if (!_flags._xlat || !_ext)
+ return;
+
+ uint8 *m = (*_ext->_shpList)->_m;
+ free(m);
+
+ for (BitmapPtr *b = _ext->_shpList; *b; b++)
+ (*b)->_m = NULL;
+ _flags._xlat = false;
+}
+
+void Sprite::gotoxy(int x, int y) {
+ int xo = _x, yo = _y;
+ if (_x < kScrWidth) {
+ if (x < 0)
+ x = 0;
+ if (x + _w > kScrWidth)
+ x = (kScrWidth - _w);
+ _x = x;
+ }
+ if (_h < kScrHeight) {
+ if (y < 0)
+ y = 0;
+ if (y + _h > kScrHeight)
+ y = (kScrHeight - _h);
+ _y = y;
+ }
+ if (_next)
+ if (_next->_flags._slav)
+ _next->gotoxy(_next->_x - xo + _x, _next->_y - yo + _y);
+ if (_flags._shad)
+ _prev->gotoxy(_prev->_x - xo + _x, _prev->_y - yo + _y);
+}
+
+void Sprite::center() {
+ gotoxy((kScrWidth - _w) / 2, (kScrHeight - _h) / 2);
+}
+
+void Sprite::show() {
+ SprExt *e;
+ e = _ext;
+ e->_x0 = e->_x1;
+ e->_y0 = e->_y1;
+ e->_b0 = e->_b1;
+ e->_x1 = _x;
+ e->_y1 = _y;
+ e->_b1 = shp();
+ if (!_flags._hide) {
+ if (_flags._xlat)
+ e->_b1->xShow(e->_x1, e->_y1);
+ else
+ e->_b1->show(e->_x1, e->_y1);
+ }
+}
+
+void Sprite::show(uint16 pg) {
+ Graphics::Surface *a = _vm->_vga->_page[1];
+ _vm->_vga->_page[1] = _vm->_vga->_page[pg & 3];
+ shp()->show(_x, _y);
+ _vm->_vga->_page[1] = a;
+}
+
+void Sprite::hide() {
+ SprExt *e = _ext;
+ if (e->_b0)
+ e->_b0->hide(e->_x0, e->_y0);
+}
+
+BitmapPtr Sprite::ghost() {
+ SprExt *e = _ext;
+ if (!e->_b1)
+ return NULL;
+
+ BitmapPtr bmp = new Bitmap(_vm, 0, 0, (uint8 *)NULL);
+ assert(bmp != NULL);
+ bmp->_w = e->_b1->_w;
+ bmp->_h = e->_b1->_h;
+ bmp->_b = new HideDesc[bmp->_h];
+ assert(bmp->_b != NULL);
+ bmp->_v = (uint8 *) memcpy(bmp->_b, e->_b1->_b, sizeof(HideDesc) * bmp->_h);
+ bmp->_map = (e->_y1 << 16) + e->_x1;
+ return bmp;
+}
+
+void Sprite::sync(Common::Serializer &s) {
+ uint16 unused = 0;
+
+ s.syncAsUint16LE(unused);
+ s.syncAsUint16LE(unused); // _ext
+ s.syncAsUint16LE(_ref);
+ s.syncAsByte(_scene);
+
+ // bitfield in-memory storage is unpredictable, so to avoid
+ // any issues, pack/unpack everything manually
+ uint16 flags = 0;
+ if (s.isLoading()) {
+ s.syncAsUint16LE(flags);
+ _flags._hide = flags & 0x0001 ? true : false;
+ _flags._near = flags & 0x0002 ? true : false;
+ _flags._drag = flags & 0x0004 ? true : false;
+ _flags._hold = flags & 0x0008 ? true : false;
+ _flags._____ = flags & 0x0010 ? true : false;
+ _flags._slav = flags & 0x0020 ? true : false;
+ _flags._syst = flags & 0x0040 ? true : false;
+ _flags._kill = flags & 0x0080 ? true : false;
+ _flags._xlat = flags & 0x0100 ? true : false;
+ _flags._port = flags & 0x0200 ? true : false;
+ _flags._kept = flags & 0x0400 ? true : false;
+ _flags._east = flags & 0x0800 ? true : false;
+ _flags._shad = flags & 0x1000 ? true : false;
+ _flags._back = flags & 0x2000 ? true : false;
+ _flags._bDel = flags & 0x4000 ? true : false;
+ _flags._tran = flags & 0x8000 ? true : false;
+ } else {
+ flags = (flags << 1) | _flags._tran;
+ flags = (flags << 1) | _flags._bDel;
+ flags = (flags << 1) | _flags._back;
+ flags = (flags << 1) | _flags._shad;
+ flags = (flags << 1) | _flags._east;
+ flags = (flags << 1) | _flags._kept;
+ flags = (flags << 1) | _flags._port;
+ flags = (flags << 1) | _flags._xlat;
+ flags = (flags << 1) | _flags._kill;
+ flags = (flags << 1) | _flags._syst;
+ flags = (flags << 1) | _flags._slav;
+ flags = (flags << 1) | _flags._____;
+ flags = (flags << 1) | _flags._hold;
+ flags = (flags << 1) | _flags._drag;
+ flags = (flags << 1) | _flags._near;
+ flags = (flags << 1) | _flags._hide;
+ s.syncAsUint16LE(flags);
+ }
+
+ s.syncAsUint16LE(_x);
+ s.syncAsUint16LE(_y);
+ s.syncAsByte(_z);
+ s.syncAsUint16LE(_w);
+ s.syncAsUint16LE(_h);
+ s.syncAsUint16LE(_time);
+ s.syncAsByte(_nearPtr);
+ s.syncAsByte(_takePtr);
+ s.syncAsSint16LE(_seqPtr);
+ s.syncAsUint16LE(_shpCnt);
+ s.syncBytes((byte *)&_file[0], 9);
+ _file[8] = '\0';
+
+ s.syncAsUint16LE(unused); // _prev
+ s.syncAsUint16LE(unused); // _next
+}
+
+Queue::Queue(bool show) : _head(NULL), _tail(NULL), _show(show) {
+}
+
+Queue::~Queue() {
+ clear();
+}
+
+void Queue::clear() {
+ while (_head) {
+ Sprite *s = remove(_head);
+ if (s->_flags._kill)
+ delete s;
+ }
+}
+
+void Queue::append(Sprite *spr) {
+ if (_tail) {
+ spr->_prev = _tail;
+ _tail->_next = spr;
+ } else
+ _head = spr;
+ _tail = spr;
+ if (_show)
+ spr->expand();
+ else
+ spr->contract();
+}
+
+void Queue::insert(Sprite *spr, Sprite *nxt) {
+ if (nxt == _head) {
+ spr->_next = _head;
+ _head = spr;
+ if (!_tail)
+ _tail = spr;
+ } else {
+ assert(nxt);
+ spr->_next = nxt;
+ spr->_prev = nxt->_prev;
+ if (spr->_prev)
+ spr->_prev->_next = spr;
+ }
+ if (spr->_next)
+ spr->_next->_prev = spr;
+ if (_show)
+ spr->expand();
+ else
+ spr->contract();
+}
+
+void Queue::insert(Sprite *spr) {
+ Sprite *s;
+ for (s = _head; s; s = s->_next)
+ if (s->_z > spr->_z)
+ break;
+ if (s)
+ insert(spr, s);
+ else
+ append(spr);
+ if (_show)
+ spr->expand();
+ else
+ spr->contract();
+}
+
+template<typename T>
+inline bool contains(const Common::List<T> &l, const T &v) {
+ return (Common::find(l.begin(), l.end(), v) != l.end());
+}
+
+Sprite *Queue::remove(Sprite *spr) {
+ if (spr == _head)
+ _head = spr->_next;
+ if (spr == _tail)
+ _tail = spr->_prev;
+ if (spr->_next)
+ spr->_next->_prev = spr->_prev;
+ if (spr->_prev)
+ spr->_prev->_next = spr->_next;
+ spr->_prev = NULL;
+ spr->_next = NULL;
+ return spr;
+}
+
+Sprite *Queue::locate(int ref) {
+ for (Sprite *spr = _head; spr; spr = spr->_next) {
+ if (spr->_ref == ref)
+ return spr;
+ }
+ return NULL;
+}
+
+Vga::Vga() : _frmCnt(0), _msg(NULL), _name(NULL), _setPal(false), _mono(0) {
+ _oldColors = NULL;
+ _newColors = NULL;
+ _showQ = new Queue(true);
+ _spareQ = new Queue(false);
+ _sysPal = new Dac[kPalCount];
+
+ for (int idx = 0; idx < 4; idx++) {
+ _page[idx] = new Graphics::Surface();
+ _page[idx]->create(320, 200, Graphics::PixelFormat::createFormatCLUT8());
+ }
+
+#if 0
+ // This part was used to display credits at the beginning of the game
+ for (int i = 10; i < 20; i++) {
+ char *text = _text->getText(i);
+ if (text) {
+ debugN(1, "%s\n", text);
+ }
+ }
+#endif
+ _oldColors = (Dac *)malloc(sizeof(Dac) * kPalCount);
+ _newColors = (Dac *)malloc(sizeof(Dac) * kPalCount);
+ getColors(_oldColors);
+ sunset();
+ setColors();
+ clear(0);
+}
+
+Vga::~Vga() {
+ _mono = 0;
+
+ Common::String buffer = "";
+/*
+ clear(0);
+ setMode(_oldMode);
+ setColors();
+ restoreScreen(_oldScreen);
+ sunrise(_oldColors);
+*/
+ free(_oldColors);
+ free(_newColors);
+ if (_msg)
+ buffer = Common::String(_msg);
+ if (_name)
+ buffer = buffer + " [" + _name + "]";
+
+ debugN("%s", buffer.c_str());
+
+ delete _showQ;
+ delete _spareQ;
+ delete[] _sysPal;
+
+ for (int idx = 0; idx < 4; idx++) {
+ _page[idx]->free();
+ delete _page[idx];
+ }
+}
+
+void Vga::waitVR() {
+ // Since some of the game parts rely on using vertical sync as a delay mechanism,
+ // we're introducing a short delay to simulate it
+ g_system->delayMillis(5);
+}
+
+void Vga::getColors(Dac *tab) {
+ byte palData[kPalSize];
+ g_system->getPaletteManager()->grabPalette(palData, 0, kPalCount);
+ palToDac(palData, tab);
+}
+
+uint8 Vga::closest(Dac *pal, const uint8 colR, const uint8 colG, const uint8 colB) {
+#define f(col, lum) ((((uint16)(col)) << 8) / lum)
+ uint16 i, dif = 0xFFFF, found = 0;
+ uint16 L = colR + colG + colB;
+ if (!L)
+ L++;
+ uint16 R = f(colR, L), G = f(colG, L), B = f(colB, L);
+ for (i = 0; i < 256; i++) {
+ uint16 l = pal[i]._r + pal[i]._g + pal[i]._b;
+ if (!l)
+ l++;
+ int r = f(pal[i]._r, l), g = f(pal[i]._g, l), b = f(pal[i]._b, l);
+ uint16 D = ((r > R) ? (r - R) : (R - r)) +
+ ((g > G) ? (g - G) : (G - g)) +
+ ((b > B) ? (b - B) : (B - b)) +
+ ((l > L) ? (l - L) : (L - l)) * 10 ;
+
+ if (D < dif) {
+ found = i;
+ dif = D;
+ if (D == 0)
+ break; // exact!
+ }
+ }
+ return found;
+#undef f
+}
+
+uint8 *Vga::glass(Dac *pal, const uint8 colR, const uint8 colG, const uint8 colB) {
+ uint8 *x = (uint8 *)malloc(256);
+ if (x) {
+ uint16 i;
+ for (i = 0; i < 256; i++) {
+ x[i] = closest(pal, ((uint16)(pal[i]._r) * colR) / 255,
+ ((uint16)(pal[i]._g) * colG) / 255,
+ ((uint16)(pal[i]._b) * colB) / 255);
+ }
+ }
+ return x;
+}
+
+void Vga::palToDac(const byte *palData, Dac *tab) {
+ const byte *colP = palData;
+ for (int idx = 0; idx < kPalCount; idx++, colP += 3) {
+ tab[idx]._r = *colP >> 2;
+ tab[idx]._g = *(colP + 1) >> 2;
+ tab[idx]._b = *(colP + 2) >> 2;
+ }
+}
+
+void Vga::dacToPal(const Dac *tab, byte *palData) {
+ for (int idx = 0; idx < kPalCount; idx++, palData += 3) {
+ *palData = tab[idx]._r << 2;
+ *(palData + 1) = tab[idx]._g << 2;
+ *(palData + 2) = tab[idx]._b << 2;
+ }
+}
+
+void Vga::setColors(Dac *tab, int lum) {
+ Dac *palP = tab, *destP = _newColors;
+ for (int idx = 0; idx < kPalCount; idx++, palP++, destP++) {
+ destP->_r = (palP->_r * lum) >> 6;
+ destP->_g = (palP->_g * lum) >> 6;
+ destP->_b = (palP->_b * lum) >> 6;
+ }
+
+ if (_mono) {
+ destP = _newColors;
+ for (int idx = 0; idx < kPalCount; idx++, destP++) {
+ // Form a greyscalce colour from 30% R, 59% G, 11% B
+ uint8 intensity = (((int)destP->_r * 77) + ((int)destP->_g * 151) + ((int)destP->_b * 28)) >> 8;
+ destP->_r = intensity;
+ destP->_g = intensity;
+ destP->_b = intensity;
+ }
+ }
+
+ _setPal = true;
+}
+
+void Vga::setColors() {
+ memset(_newColors, 0, kPalSize);
+ updateColors();
+}
+
+void Vga::sunrise(Dac *tab) {
+ for (int i = 0; i <= 64; i += kFadeStep) {
+ setColors(tab, i);
+ waitVR();
+ updateColors();
+ }
+}
+
+void Vga::sunset() {
+ Dac tab[256];
+ getColors(tab);
+ for (int i = 64; i >= 0; i -= kFadeStep) {
+ setColors(tab, i);
+ waitVR();
+ updateColors();
+ }
+}
+
+void Vga::show() {
+ for (Sprite *spr = _showQ->first(); spr; spr = spr->_next)
+ spr->show();
+ update();
+ for (Sprite *spr = _showQ->first(); spr; spr = spr->_next)
+ spr->hide();
+
+ _frmCnt++;
+}
+
+void Vga::updateColors() {
+ byte palData[kPalSize];
+ dacToPal(_newColors, palData);
+ g_system->getPaletteManager()->setPalette(palData, 0, 256);
+}
+
+void Vga::update() {
+ SWAP(Vga::_page[0], Vga::_page[1]);
+
+ if (_setPal) {
+ updateColors();
+ _setPal = false;
+ }
+
+ g_system->copyRectToScreen((const byte *)Vga::_page[0]->getBasePtr(0, 0), kScrWidth, 0, 0, kScrWidth, kScrHeight);
+ g_system->updateScreen();
+}
+
+void Vga::clear(uint8 color) {
+ for (int paneNum = 0; paneNum < 4; paneNum++)
+ _page[paneNum]->fillRect(Common::Rect(0, 0, kScrWidth, kScrHeight), color);
+}
+
+void Vga::copyPage(uint16 d, uint16 s) {
+ _page[d]->copyFrom(*_page[s]);
+}
+
+//--------------------------------------------------------------------------
+
+void Bitmap::xShow(int16 x, int16 y) {
+ debugC(4, kCGEDebugBitmap, "Bitmap::xShow(%d, %d)", x, y);
+
+ const byte *srcP = (const byte *)_v;
+ byte *destEndP = (byte *)_vm->_vga->_page[1]->pixels + (kScrWidth * kScrHeight);
+ byte *lookupTable = _m;
+
+ // Loop through processing data for each plane. The game originally ran in plane mapped mode, where a
+ // given plane holds each fourth pixel sequentially. So to handle an entire picture, each plane's data
+ // must be decompressed and inserted into the surface
+ for (int planeCtr = 0; planeCtr < 4; planeCtr++) {
+ byte *destP = (byte *)_vm->_vga->_page[1]->getBasePtr(x + planeCtr, y);
+
+ for (;;) {
+ uint16 v = READ_LE_UINT16(srcP);
+ srcP += 2;
+ int cmd = v >> 14;
+ int count = v & 0x3FFF;
+
+ if (cmd == 0) {
+ // End of image
+ break;
+ }
+
+ assert(destP < destEndP);
+
+ if (cmd == 2)
+ srcP++;
+ else if (cmd == 3)
+ srcP += count;
+
+ // Handle a set of pixels
+ while (count-- > 0) {
+ // Transfer operation
+ switch (cmd) {
+ case 1:
+ // SKIP
+ break;
+ case 2:
+ case 3:
+ // TINT
+ *destP = lookupTable[*destP];
+ break;
+ }
+
+ // Move to next dest position
+ destP += 4;
+ }
+ }
+ }
+}
+
+
+void Bitmap::show(int16 x, int16 y) {
+ debugC(5, kCGEDebugBitmap, "Bitmap::show(%d, %d)", x, y);
+
+ const byte *srcP = (const byte *)_v;
+ byte *destEndP = (byte *)_vm->_vga->_page[1]->pixels + (kScrWidth * kScrHeight);
+
+ // Loop through processing data for each plane. The game originally ran in plane mapped mode, where a
+ // given plane holds each fourth pixel sequentially. So to handle an entire picture, each plane's data
+ // must be decompressed and inserted into the surface
+ for (int planeCtr = 0; planeCtr < 4; planeCtr++) {
+ byte *destP = (byte *)_vm->_vga->_page[1]->getBasePtr(x + planeCtr, y);
+
+ for (;;) {
+ uint16 v = READ_LE_UINT16(srcP);
+ srcP += 2;
+ int cmd = v >> 14;
+ int count = v & 0x3FFF;
+
+ if (cmd == 0) {
+ // End of image
+ break;
+ }
+
+ assert(destP < destEndP);
+
+ // Handle a set of pixels
+ while (count-- > 0) {
+ // Transfer operation
+ switch (cmd) {
+ case 1:
+ // SKIP
+ break;
+ case 2:
+ // REPEAT
+ *destP = *srcP;
+ break;
+ case 3:
+ // COPY
+ *destP = *srcP++;
+ break;
+ }
+
+ // Move to next dest position
+ destP += 4;
+ }
+
+ if (cmd == 2)
+ srcP++;
+ }
+ }
+}
+
+
+void Bitmap::hide(int16 x, int16 y) {
+ debugC(5, kCGEDebugBitmap, "Bitmap::hide(%d, %d)", x, y);
+
+ for (int yp = y; yp < y + _h; yp++) {
+ const byte *srcP = (const byte *)_vm->_vga->_page[2]->getBasePtr(x, yp);
+ byte *destP = (byte *)_vm->_vga->_page[1]->getBasePtr(x, yp);
+
+ Common::copy(srcP, srcP + _w, destP);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+HorizLine::HorizLine(CGEEngine *vm) : Sprite(vm, NULL), _vm(vm) {
+ // Set the sprite list
+ BitmapPtr *HL = new BitmapPtr[2];
+ HL[0] = new Bitmap(_vm, "HLINE");
+ HL[1] = NULL;
+
+ setShapeList(HL);
+}
+
+SceneLight::SceneLight(CGEEngine *vm) : Sprite(vm, NULL), _vm(vm) {
+ // Set the sprite list
+ BitmapPtr *PR = new BitmapPtr[2];
+ PR[0] = new Bitmap(_vm, "PRESS");
+ PR[1] = NULL;
+
+ setShapeList(PR);
+}
+
+Speaker::Speaker(CGEEngine *vm): Sprite(vm, NULL), _vm(vm) {
+ // Set the sprite list
+ BitmapPtr *SP = new BitmapPtr[3];
+ SP[0] = new Bitmap(_vm, "SPK_L");
+ SP[1] = new Bitmap(_vm, "SPK_R");
+ SP[2] = NULL;
+
+ setShapeList(SP);
+}
+
+PocLight::PocLight(CGEEngine *vm): Sprite(vm, NULL), _vm(vm) {
+ // Set the sprite list
+ BitmapPtr *LI = new BitmapPtr[5];
+ LI[0] = new Bitmap(_vm, "LITE0");
+ LI[1] = new Bitmap(_vm, "LITE1");
+ LI[2] = new Bitmap(_vm, "LITE2");
+ LI[3] = new Bitmap(_vm, "LITE3");
+ LI[4] = NULL;
+
+ setShapeList(LI);
+
+ _flags._kill = false;
+}
+
+} // End of namespace CGE
diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h
new file mode 100644
index 0000000000..0c514c4a66
--- /dev/null
+++ b/engines/cge/vga13h.h
@@ -0,0 +1,243 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#ifndef CGE_VGA13H_H
+#define CGE_VGA13H_H
+
+#include "common/serializer.h"
+#include "graphics/surface.h"
+#include "cge/general.h"
+#include "cge/bitmap.h"
+#include "cge/snail.h"
+#include "cge/cge.h"
+
+namespace CGE {
+
+#define kFadeStep 2
+#define kVgaColDark 207
+#define kVgaColDarkGray 225 /*219*/
+#define kVgaColGray 231
+#define kVgaColLightGray 237
+#define kPixelTransp 0xFE
+#define kNoSeq (-1)
+#define kNoPtr ((uint8)-1)
+#define kSprExt ".SPR"
+#define kPalCount 256
+#define kPalSize (kPalCount * 3)
+
+
+struct Seq {
+ uint8 _now;
+ uint8 _next;
+ int8 _dx;
+ int8 _dy;
+ int _dly;
+};
+
+class SprExt {
+public:
+ int _x0;
+ int _y0;
+ int _x1;
+ int _y1;
+ BitmapPtr _b0;
+ BitmapPtr _b1;
+ BitmapPtr *_shpList;
+ Seq *_seq;
+ char *_name;
+ CommandHandler::Command *_near;
+ CommandHandler::Command *_take;
+ SprExt() :
+ _x0(0), _y0(0),
+ _x1(0), _y1(0),
+ _b0(NULL), _b1(NULL),
+ _shpList(NULL), _seq(NULL),
+ _name(NULL), _near(NULL), _take(NULL)
+ {}
+};
+
+class Sprite {
+protected:
+ SprExt *_ext;
+public:
+ int _ref;
+ signed char _scene;
+ struct Flags {
+ uint16 _hide : 1; // general visibility switch
+ uint16 _near : 1; // Near action lock
+ uint16 _drag : 1; // sprite is moveable
+ uint16 _hold : 1; // sprite is held with mouse
+ uint16 _____ : 1; // intrrupt driven animation
+ uint16 _slav : 1; // slave object
+ uint16 _syst : 1; // system object
+ uint16 _kill : 1; // dispose memory after remove
+ uint16 _xlat : 1; // 2nd way display: xlat table
+ uint16 _port : 1; // portable
+ uint16 _kept : 1; // kept in pocket
+ uint16 _east : 1; // talk to east (in opposite to west)
+ uint16 _shad : 1; // shadow
+ uint16 _back : 1; // 'send to background' request
+ uint16 _bDel : 1; // delete bitmaps in ~SPRITE
+ uint16 _tran : 1; // transparent (untouchable)
+ } _flags;
+ int _x;
+ int _y;
+ signed char _z;
+ uint16 _w;
+ uint16 _h;
+ uint16 _time;
+ uint8 _nearPtr;
+ uint8 _takePtr;
+ int _seqPtr;
+ int _shpCnt;
+ char _file[kMaxFile];
+ Sprite *_prev;
+ Sprite *_next;
+
+ bool works(Sprite *spr);
+ bool seqTest(int n);
+ inline bool active() {
+ return _ext != NULL;
+ }
+
+ Sprite(CGEEngine *vm, BitmapPtr *shp);
+ virtual ~Sprite();
+ BitmapPtr shp();
+ BitmapPtr *setShapeList(BitmapPtr *shp);
+ void moveShapes(uint8 *buf);
+ Sprite *expand();
+ Sprite *contract();
+ Sprite *backShow(bool fast = false);
+ void setName(char *newName);
+ inline char *name() {
+ return (_ext) ? _ext->_name : NULL;
+ }
+ void gotoxy(int x, int y);
+ void center();
+ void show();
+ void hide();
+ BitmapPtr ghost();
+ void show(uint16 pg);
+ void makeXlat(uint8 *x);
+ void killXlat();
+ void step(int nr = -1);
+ Seq *setSeq(Seq *seq);
+ CommandHandler::Command *snList(SnList type);
+ virtual void touch(uint16 mask, int x, int y);
+ virtual void tick();
+ void sync(Common::Serializer &s);
+private:
+ CGEEngine *_vm;
+};
+
+class Queue {
+ Sprite *_head;
+ Sprite *_tail;
+public:
+ Queue(bool show);
+ ~Queue();
+
+ bool _show;
+
+ void append(Sprite *spr);
+ void insert(Sprite *spr, Sprite *nxt);
+ void insert(Sprite *spr);
+ Sprite *remove(Sprite *spr);
+ Sprite *first() {
+ return _head;
+ }
+ Sprite *last() {
+ return _tail;
+ }
+ Sprite *locate(int ref);
+ void clear();
+};
+
+class Vga {
+ bool _setPal;
+ Dac *_oldColors;
+ Dac *_newColors;
+ const char *_msg;
+ const char *_name;
+
+ void updateColors();
+ void setColors();
+ void waitVR();
+ uint8 closest(Dac *pal, const uint8 colR, const uint8 colG, const uint8 colB);
+
+public:
+ uint32 _frmCnt;
+ Queue *_showQ;
+ Queue *_spareQ;
+ int _mono;
+ Graphics::Surface *_page[4];
+ Dac *_sysPal;
+
+ Vga();
+ ~Vga();
+
+ uint8 *glass(Dac *pal, const uint8 colR, const uint8 colG, const uint8 colB);
+ void getColors(Dac *tab);
+ void setColors(Dac *tab, int lum);
+ void clear(uint8 color);
+ void copyPage(uint16 d, uint16 s);
+ void sunrise(Dac *tab);
+ void sunset();
+ void show();
+ void update();
+
+ void palToDac(const byte *palData, Dac *tab);
+ void dacToPal(const Dac *tab, byte *palData);
+};
+
+class HorizLine: public Sprite {
+ CGEEngine *_vm;
+public:
+ HorizLine(CGEEngine *vm);
+};
+
+class SceneLight: public Sprite {
+ CGEEngine *_vm;
+public:
+ SceneLight(CGEEngine *vm);
+};
+
+class Speaker: public Sprite {
+ CGEEngine *_vm;
+public:
+ Speaker(CGEEngine *vm);
+};
+
+class PocLight: public Sprite {
+ CGEEngine *_vm;
+public:
+ PocLight(CGEEngine *vm);
+};
+
+} // End of namespace CGE
+
+#endif
diff --git a/engines/cge/vmenu.cpp b/engines/cge/vmenu.cpp
new file mode 100644
index 0000000000..a317a765d4
--- /dev/null
+++ b/engines/cge/vmenu.cpp
@@ -0,0 +1,142 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#include "cge/vmenu.h"
+#include "cge/events.h"
+#include "cge/cge_main.h"
+
+namespace CGE {
+
+MenuBar::MenuBar(CGEEngine *vm, uint16 w) : Talk(vm), _vm(vm) {
+ int h = kFontHigh + 2 * kMenuBarVM;
+ int i = (w += 2 * kMenuBarHM) * h;
+ uint8 *p = (uint8 *)malloc(sizeof(uint8) * i);
+
+ memset(p + w, kPixelTransp, i - 2 * w);
+ memset(p, kMenuBarLT, w);
+ memset(p + i - w, kMenuBarRB, w);
+ uint8 *p1 = p;
+ uint8 *p2 = p + i - 1;
+ for (int cpt = 0; cpt < h; cpt++) {
+ *p1 = kMenuBarLT;
+ *p2 = kMenuBarRB;
+ p1 += w;
+ p2 -= w;
+ }
+
+ _ts = new BitmapPtr[2];
+ _ts[0] = new Bitmap(_vm, w, h, p);
+ _ts[1] = NULL;
+ setShapeList(_ts);
+
+ _flags._slav = true;
+ _flags._tran = true;
+ _flags._kill = true;
+ _flags._bDel = true;
+}
+
+Vmenu *Vmenu::_addr = NULL;
+int Vmenu::_recent = -1;
+
+Vmenu::Vmenu(CGEEngine *vm, Choice *list, int x, int y)
+ : Talk(vm, VMGather(list), kTBRect), _menu(list), _bar(NULL), _vm(vm) {
+ Choice *cp;
+
+ _addr = this;
+ delete[] _vmgt;
+ _items = 0;
+ for (cp = list; cp->_text; cp++)
+ _items++;
+ _flags._bDel = true;
+ _flags._kill = true;
+ if (x < 0 || y < 0)
+ center();
+ else
+ gotoxy(x - _w / 2, y - (kTextVMargin + kFontHigh / 2));
+ _vm->_vga->_showQ->insert(this, _vm->_vga->_showQ->last());
+ _bar = new MenuBar(_vm, _w - 2 * kTextHMargin);
+ _bar->gotoxy(_x + kTextHMargin - kMenuBarHM, _y + kTextVMargin - kMenuBarVM);
+ _vm->_vga->_showQ->insert(_bar, _vm->_vga->_showQ->last());
+}
+
+Vmenu::~Vmenu() {
+ _addr = NULL;
+}
+
+#define CALL_MEMBER_FN(object,ptrToMember) ((object).*(ptrToMember))
+
+void Vmenu::touch(uint16 mask, int x, int y) {
+ if (!_items)
+ return;
+
+ Sprite::touch(mask, x, y);
+
+ y -= kTextVMargin - 1;
+ int n = 0;
+ bool ok = false;
+ uint16 h = kFontHigh + kTextLineSpace;
+
+ if (y >= 0) {
+ n = y / h;
+ if (n < _items)
+ ok = (x >= kTextHMargin && x < _w - kTextHMargin/* && y % h < FONT_HIG*/);
+ else
+ n = _items - 1;
+ }
+
+ _bar->gotoxy(_x + kTextHMargin - kMenuBarHM, _y + kTextVMargin + n * h - kMenuBarVM);
+
+ if (ok && (mask & kMouseLeftUp)) {
+ _items = 0;
+ _vm->_commandHandlerTurbo->addCommand(kCmdKill, -1, 0, this);
+ _recent = n;
+ assert(_menu[n].Proc);
+ CALL_MEMBER_FN(*_vm, _menu[n].Proc)();
+ }
+}
+
+char *Vmenu::VMGather(Choice *list) {
+ Choice *cp;
+ int len = 0, h = 0;
+
+ for (cp = list; cp->_text; cp++) {
+ len += strlen(cp->_text);
+ h++;
+ }
+ _vmgt = new char[len + h];
+ if (_vmgt) {
+ *_vmgt = '\0';
+ for (cp = list; cp->_text; cp++) {
+ if (*_vmgt)
+ strcat(_vmgt, "|");
+ strcat(_vmgt, cp->_text);
+ h++;
+ }
+ }
+ return _vmgt;
+}
+} // End of namespace CGE
diff --git a/engines/cge/vmenu.h b/engines/cge/vmenu.h
new file mode 100644
index 0000000000..89ef7a9484
--- /dev/null
+++ b/engines/cge/vmenu.h
@@ -0,0 +1,73 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#ifndef CGE_VMENU_H
+#define CGE_VMENU_H
+
+#include "cge/talk.h"
+
+namespace CGE {
+
+#define kMenuBarVM 1
+#define kMenuBarHM 3
+#define kMenuBarLT kVgaColLightGray
+#define kMenuBarRB kVgaColDarkGray
+
+
+struct Choice {
+ const char *_text;
+ void (CGEEngine::*Proc)();
+};
+
+
+class MenuBar : public Talk {
+public:
+ MenuBar(CGEEngine *vm, uint16 w);
+private:
+ CGEEngine *_vm;
+};
+
+class Vmenu : public Talk {
+public:
+ static Vmenu *_addr;
+ static int _recent;
+ MenuBar *_bar;
+ Vmenu(CGEEngine *vm, Choice *list, int x, int y);
+ ~Vmenu();
+ virtual void touch(uint16 mask, int x, int y);
+private:
+ char *_vmgt;
+ CGEEngine *_vm;
+ uint16 _items;
+ Choice *_menu;
+
+ char *VMGather(Choice *list);
+};
+
+} // End of namespace CGE
+
+#endif
diff --git a/engines/cge/walk.cpp b/engines/cge/walk.cpp
new file mode 100644
index 0000000000..31ea1909d8
--- /dev/null
+++ b/engines/cge/walk.cpp
@@ -0,0 +1,267 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#include "cge/walk.h"
+#include "cge/cge_main.h"
+
+namespace CGE {
+
+Cluster::Cluster(CGEEngine *vm, int16 a, int16 b) : _vm(vm) {
+ _pt = Common::Point(a, b);
+}
+
+Cluster::Cluster(CGEEngine *vm) : _vm(vm) {
+ _pt = Common::Point(-1, -1);
+}
+
+uint8 &Cluster::cell() {
+ return _vm->_clusterMap[_pt.y][_pt.x];
+}
+
+bool Cluster::isValid() const {
+ return (_pt.x >= 0) && (_pt.x < kMapXCnt) && (_pt.y >= 0) && (_pt.y < kMapZCnt);
+}
+
+Walk::Walk(CGEEngine *vm, BitmapPtr *shpl)
+ : Sprite(vm, shpl), _dir(kDirNone), _tracePtr(-1), _level(0), _target(-1, -1), _findLevel(-1), _here(vm), _vm(vm) {
+ for (int i = 0; i < kMaxFindLevel; i++) {
+ Cluster *tmpClust = new Cluster(_vm);
+ _trace.push_back(tmpClust);
+ }
+}
+
+Walk::~Walk() {
+ for (uint idx = 0; idx < _trace.size(); ++idx)
+ delete _trace[idx];
+}
+
+void Walk::tick() {
+ if (_flags._hide)
+ return;
+
+ _here = _vm->XZ(_x + _w / 2, _y + _h);
+
+ if (_dir != kDirNone) {
+ _vm->_sys->funTouch();
+ for (Sprite *spr = _vm->_vga->_showQ->first(); spr; spr = spr->_next) {
+ if (distance(spr) < 2) {
+ if (!spr->_flags._near) {
+ _vm->feedSnail(spr, kNear);
+ spr->_flags._near = true;
+ }
+ } else {
+ spr->_flags._near = false;
+ }
+ }
+ }
+
+ if (_flags._hold || _tracePtr < 0) {
+ park();
+ } else {
+ if (_here._pt == _trace[_tracePtr]->_pt) {
+ if (--_tracePtr < 0)
+ park();
+ } else {
+ Common::Point tmpPoint = _trace[_tracePtr]->_pt - _here._pt;
+ int16 dx = tmpPoint.x;
+ int16 dz = tmpPoint.y;
+ Dir d = (dx) ? ((dx > 0) ? kDirEast : kDirWest) : ((dz > 0) ? kDirSouth : kDirNorth);
+ turn(d);
+ }
+ }
+
+ step();
+
+ if ((_dir == kDirWest && _x <= 0) ||
+ (_dir == kDirEast && _x + _w >= kScrWidth) ||
+ (_dir == kDirSouth && _y + _w >= kWorldHeight - 2)) {
+ park();
+ } else {
+ // take current Z position
+ _z = _here._pt.y;
+ _vm->_commandHandlerTurbo->addCommand(kCmdZTrim, -1, 0, this); // update Hero's pos in show queue
+ }
+}
+
+int Walk::distance(Sprite *spr) {
+ int dx = spr->_x - (_x + _w - kWalkSide);
+ if (dx < 0)
+ dx = (_x + kWalkSide) - (spr->_x + spr->_w);
+
+ if (dx < 0)
+ dx = 0;
+
+ dx /= kMapGridX;
+ int dz = spr->_z - _z;
+ if (dz < 0)
+ dz = - dz;
+
+ dx = dx * dx + dz * dz;
+ for (dz = 1; dz * dz < dx; dz++)
+ ;
+
+ return dz - 1;
+}
+
+void Walk::turn(Dir d) {
+ Dir dir = (_dir == kDirNone) ? kDirSouth : _dir;
+ if (d != _dir) {
+ step((d == dir) ? (1 + dir + dir) : (9 + 4 * dir + d));
+ _dir = d;
+ }
+}
+
+void Walk::park() {
+ if (_time == 0)
+ _time++;
+
+ if (_dir != kDirNone) {
+ step(9 + 4 * _dir + _dir);
+ _dir = kDirNone;
+ _tracePtr = -1;
+ }
+}
+
+void Walk::findWay(Cluster c) {
+ if (c._pt == _here._pt)
+ return;
+
+ for (_findLevel = 1; _findLevel <= kMaxFindLevel; _findLevel++) {
+ _target = _here._pt;
+ int16 x = c._pt.x;
+ int16 z = c._pt.y;
+
+ if (find1Way(Cluster(_vm, x, z)))
+ break;
+ }
+
+ _tracePtr = (_findLevel > kMaxFindLevel) ? -1 : (_findLevel - 1);
+ if (_tracePtr < 0)
+ noWay();
+ _time = 1;
+}
+
+void Walk::findWay(Sprite *spr) {
+ if (!spr || spr == this)
+ return;
+
+ int x = spr->_x;
+ int z = spr->_z;
+ if (spr->_flags._east)
+ x += spr->_w + _w / 2 - kWalkSide;
+ else
+ x -= _w / 2 - kWalkSide;
+
+ findWay(Cluster(_vm, (x / kMapGridX),
+ ((z < kMapZCnt - kDistMax) ? (z + 1)
+ : (z - 1))));
+}
+
+bool Walk::lower(Sprite *spr) {
+ return (spr->_y > _y + (_h * 3) / 5);
+}
+
+void Walk::reach(Sprite *spr, int mode) {
+ if (spr) {
+ _vm->_hero->findWay(spr);
+ if (mode < 0) {
+ mode = spr->_flags._east;
+ if (lower(spr))
+ mode += 2;
+ }
+ }
+ // note: insert SNAIL commands in reverse order
+ _vm->_commandHandler->insertCommand(kCmdPause, -1, 64, NULL);
+ _vm->_commandHandler->insertCommand(kCmdSeq, -1, kTSeq + mode, this);
+ if (spr) {
+ _vm->_commandHandler->insertCommand(kCmdWait, -1, -1, _vm->_hero);
+ //SNINSERT(SNWALK, -1, -1, spr);
+ }
+ // sequence is not finished,
+ // now it is just at sprite appear (disappear) point
+}
+
+void Walk::noWay() {
+ _vm->trouble(kSeqNoWay, kNoWay);
+}
+
+bool Cluster::chkBar() const {
+ assert(_vm->_now <= kSceneMax);
+ return (_pt.x == _vm->_barriers[_vm->_now]._horz) || (_pt.y == _vm->_barriers[_vm->_now]._vert);
+}
+
+bool Walk::find1Way(Cluster c) {
+ const Cluster tab[4] = { Cluster(_vm, -1, 0), Cluster(_vm, 1, 0), Cluster(_vm, 0, -1), Cluster(_vm, 0, 1)};
+ const int tabLen = 4;
+
+ if (c._pt == _target)
+ // Found destination
+ return true;
+
+ if (_level >= _findLevel)
+ // Nesting limit
+ return false;
+
+ // Look for barriers
+ if (c.chkBar())
+ return false;
+
+ if (c.cell())
+ // Location is occupied
+ return false;
+
+ // Loop through each direction
+ Cluster start = c;
+ for (int i = 0; i < tabLen; i++) {
+ // Reset to starting position
+ c = start;
+
+ do {
+ c._pt += tab[i]._pt;
+ if (!c.isValid())
+ // Break to check next direction
+ break;
+
+ // Recursively check for further paths
+ ++_level;
+ ++start.cell();
+ bool foundPath = find1Way(c);
+ --start.cell();
+ --_level;
+
+ if (foundPath) {
+ // Set route point
+ _trace[_level]->_pt = start._pt;
+ return true;
+ }
+ } while (!c.chkBar() && !c.cell());
+ }
+
+ return false;
+}
+
+} // End of namespace CGE
diff --git a/engines/cge/walk.h b/engines/cge/walk.h
new file mode 100644
index 0000000000..99dc362eec
--- /dev/null
+++ b/engines/cge/walk.h
@@ -0,0 +1,87 @@
+/* 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 original Soltys source code
+ * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
+ */
+
+#ifndef CGE_WALK_H
+#define CGE_WALK_H
+
+#include "common/rect.h"
+#include "cge/vga13h.h"
+#include "cge/events.h"
+
+namespace CGE {
+
+#define kMapArrSize (kMapZCnt * kMapXCnt)
+#define kMapTop 80
+#define kMapHig 80
+#define kMapGridX (kScrWidth / kMapXCnt)
+#define kMapGridZ (kMapHig / kMapZCnt)
+#define kMaxFindLevel 3
+
+enum Dir { kDirNone = -1, kDirNorth, kDirEast, kDirSouth, kDirWest };
+
+class Cluster {
+public:
+ CGEEngine *_vm;
+ Common::Point _pt;
+public:
+ uint8 &cell();
+ Cluster(CGEEngine *vm, int16 a, int16 b);
+ Cluster(CGEEngine *vm);
+ bool chkBar() const;
+ bool isValid() const;
+};
+
+class Walk : public Sprite {
+private:
+ CGEEngine *_vm;
+public:
+ Cluster _here;
+ int _tracePtr;
+ int _level;
+ int _findLevel;
+ Common::Point _target;
+ Common::Array<Cluster *> _trace;
+
+ Dir _dir;
+ Walk(CGEEngine *vm, BitmapPtr *shpl);
+ ~Walk();
+ void tick();
+ void findWay(Cluster c);
+ void findWay(Sprite *spr);
+ int distance(Sprite *spr);
+ void turn(Dir d);
+ void park();
+ bool lower(Sprite *spr);
+ void reach(Sprite *spr, int mode = -1);
+
+ void noWay();
+ bool find1Way(Cluster c);
+};
+
+} // End of namespace CGE
+
+#endif
diff --git a/engines/cine/texte.cpp b/engines/cine/texte.cpp
index dc18d081c7..33ea569df7 100644
--- a/engines/cine/texte.cpp
+++ b/engines/cine/texte.cpp
@@ -28,13 +28,13 @@
namespace Cine {
-const char **failureMessages;
+const char *const *failureMessages;
const CommandeType *defaultActionCommand;
const CommandeType *systemMenu;
const CommandeType *confirmMenu;
-const char **otherMessages;
+const char *const *otherMessages;
const char *defaultCommandPreposition;
-const char **commandPrepositionTable;
+const char *const *commandPrepositionTable;
/**
* Loads font data from the given file.
@@ -152,7 +152,7 @@ static const CharacterEntry fontParamTable_alt[NUM_FONT_CHARS] = {
};
void initLanguage(Common::Language lang) {
- static const char *failureMessages_EN[] = {
+ static const char *const failureMessages_EN[] = {
// EXAMINE
"I don't see anything unusual.",
"There's nothing of interest here.",
@@ -195,7 +195,7 @@ void initLanguage(Common::Language lang) {
"NOACTION"
};
- static const char *commandPrepositionTable_EN[] = {
+ static const char *const commandPrepositionTable_EN[] = {
"", // EXAMINE
"", // TAKE
"", // INVENTORY
@@ -214,7 +214,7 @@ void initLanguage(Common::Language lang) {
"Save game"
};
- static const char *otherMessages_EN[] = {
+ static const char *const otherMessages_EN[] = {
"This backup doesn't exist ...",
"Could not create save file ...",
"PAUSE",
@@ -229,7 +229,7 @@ void initLanguage(Common::Language lang) {
"Absolutely Not!"
};
- static const char *failureMessages_FR[] = {
+ static const char *const failureMessages_FR[] = {
// EXAMINER
"Je ne vois rien de special.",
"Il n'y a rien d'int\x82ressant.",
@@ -272,7 +272,7 @@ void initLanguage(Common::Language lang) {
"NOACTION"
};
- static const char *commandPrepositionTable_FR[] = {
+ static const char *const commandPrepositionTable_FR[] = {
"", // EXAMINER
"", // PRENDRE
"", // INVENTAIRE
@@ -296,7 +296,7 @@ void initLanguage(Common::Language lang) {
"Surtout Pas !"
};
- static const char *otherMessages_FR[] = {
+ static const char *const otherMessages_FR[] = {
"Cette sauvegarde n'existe pas ...",
"Could not create save file ...", //
"PAUSE",
@@ -306,7 +306,7 @@ void initLanguage(Common::Language lang) {
"Veuillez entrer le Nom de la Sauvegarde ."
};
- static const char *failureMessages_ES[] = {
+ static const char *const failureMessages_ES[] = {
// EXAMINE
"No veo nada especial",
"No hay nada interesante",
@@ -349,7 +349,7 @@ void initLanguage(Common::Language lang) {
"NOACTION"
};
- static const char *commandPrepositionTable_ES[] = {
+ static const char *const commandPrepositionTable_ES[] = {
"", // EXAMINAR
"", // COGER
"", // INVENTARIO
@@ -373,7 +373,7 @@ void initLanguage(Common::Language lang) {
"Nade de nada !"
};
- static const char *otherMessages_ES[] = {
+ static const char *const otherMessages_ES[] = {
"Esta granacion no existe",
"Could not create save file ...", //
"PAUSE",
@@ -383,7 +383,7 @@ void initLanguage(Common::Language lang) {
"Teclea el nombre de la partida grabada"
};
- static const char *failureMessages_DE[] = {
+ static const char *const failureMessages_DE[] = {
// EXAMINE
"Ich sehe nichts Besonderes",
"Es gibt hier nichts Interessantes",
@@ -426,7 +426,7 @@ void initLanguage(Common::Language lang) {
"NOACTION"
};
- static const char *commandPrepositionTable_DE[] = {
+ static const char *const commandPrepositionTable_DE[] = {
"", // Prufe
"", // Nimm
"", // Bestand
@@ -450,7 +450,7 @@ void initLanguage(Common::Language lang) {
"Absolut Nicht!"
};
- static const char *otherMessages_DE[] = {
+ static const char *const otherMessages_DE[] = {
"Diese Sicherungskopie gibt es nicht",
"Could not create save file ...", //
"PAUSE",
@@ -460,7 +460,7 @@ void initLanguage(Common::Language lang) {
"Geben Sie den Namen|der Sicherungsdiskette ein"
};
- static const char *failureMessages_IT[] = {
+ static const char *const failureMessages_IT[] = {
// EXAMINE
"Non vedo nula di speciale",
"Non c'\x8a niente di interessante",
@@ -503,7 +503,7 @@ void initLanguage(Common::Language lang) {
"NOACTION"
};
- static const char *commandPrepositionTable_IT[] = {
+ static const char *const commandPrepositionTable_IT[] = {
"", // ESAMINARE
"", // PRENDERE
"", // INVENTARIO
@@ -527,7 +527,7 @@ void initLanguage(Common::Language lang) {
"Supratutto non!"
};
- static const char *otherMessages_IT[] = {
+ static const char *const otherMessages_IT[] = {
"Questo salvataggio non esiste...",
"Could not create save file ...", //
"PAUSE",
@@ -612,7 +612,7 @@ void loadErrmessDat(const char *fname) {
ptr[i] = (char *)ptr + (sizeof(char *) * 6 * 4) + 60 * i;
in.read(ptr[i], 60);
}
- failureMessages = const_cast<const char **>(ptr);
+ failureMessages = const_cast<const char *const *>(ptr);
in.close();
} else {
@@ -621,7 +621,7 @@ void loadErrmessDat(const char *fname) {
}
void freeErrmessDat() {
- free(failureMessages);
+ free(const_cast<const char **>(failureMessages));
failureMessages = 0;
}
diff --git a/engines/cine/texte.h b/engines/cine/texte.h
index f82127db98..dd4b7e06ee 100644
--- a/engines/cine/texte.h
+++ b/engines/cine/texte.h
@@ -50,13 +50,13 @@ struct TextHandler {
CharacterEntry fontParamTable[NUM_FONT_CHARS];
};
-extern const char **failureMessages;
+extern const char *const *failureMessages;
extern const CommandeType *defaultActionCommand;
extern const CommandeType *systemMenu;
extern const CommandeType *confirmMenu;
-extern const char **otherMessages;
+extern const char *const *otherMessages;
extern const char *defaultCommandPreposition;
-extern const char **commandPrepositionTable;
+extern const char *const *commandPrepositionTable;
void loadTextData(const char *filename);
void loadErrmessDat(const char *fname);
diff --git a/engines/composer/graphics.cpp b/engines/composer/graphics.cpp
index 0768a86e7a..f253d85ad7 100644
--- a/engines/composer/graphics.cpp
+++ b/engines/composer/graphics.cpp
@@ -534,7 +534,7 @@ void ComposerEngine::setBackground(uint16 id) {
static void decompressSLWM(byte *buffer, Common::SeekableReadStream *stream) {
uint bitsLeft = 0;
- uint16 lastBits;
+ uint16 lastBits = 0;
byte currBit;
while (true) {
if (bitsLeft == 0) { bitsLeft = 16; lastBits = stream->readUint16LE(); }
diff --git a/engines/cruise/detection.cpp b/engines/cruise/detection.cpp
index 5be2fdeeea..a68b14d986 100644
--- a/engines/cruise/detection.cpp
+++ b/engines/cruise/detection.cpp
@@ -284,19 +284,22 @@ void CruiseMetaEngine::removeSaveState(const char *target, int slot) const {
SaveStateDescriptor CruiseMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(
Cruise::CruiseEngine::getSavegameFile(slot));
- assert(f);
-
- Cruise::CruiseSavegameHeader header;
- Cruise::readSavegameHeader(f, header);
- delete f;
-
- // Create the return descriptor
- SaveStateDescriptor desc(slot, header.saveName);
- desc.setDeletableFlag(true);
- desc.setWriteProtectedFlag(false);
- desc.setThumbnail(header.thumbnail);
+
+ if (f) {
+ Cruise::CruiseSavegameHeader header;
+ Cruise::readSavegameHeader(f, header);
+ delete f;
+
+ // Create the return descriptor
+ SaveStateDescriptor desc(slot, header.saveName);
+ desc.setDeletableFlag(true);
+ desc.setWriteProtectedFlag(false);
+ desc.setThumbnail(header.thumbnail);
+
+ return desc;
+ }
- return desc;
+ return SaveStateDescriptor();
}
bool CruiseMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp
index 58bf629dc4..435576e9e4 100644
--- a/engines/dialogs.cpp
+++ b/engines/dialogs.cpp
@@ -228,7 +228,15 @@ void MainMenuDialog::save() {
if (result.empty()) {
// If the user was lazy and entered no save name, come up with a default name.
Common::String buf;
+ #if defined(USE_SAVEGAME_TIMESTAMP)
+ TimeDate curTime;
+ g_system->getTimeAndDate(curTime);
+ curTime.tm_year += 1900; // fixup year
+ curTime.tm_mon++; // fixup month
+ buf = Common::String::format("%04d.%02d.%02d / %02d:%02d:%02d", curTime.tm_year, curTime.tm_mon, curTime.tm_mday, curTime.tm_hour, curTime.tm_min, curTime.tm_sec);
+ #else
buf = Common::String::format("Save %d", slot + 1);
+ #endif
_engine->saveGameState(slot, buf);
} else {
_engine->saveGameState(slot, result);
diff --git a/engines/draci/detection.cpp b/engines/draci/detection.cpp
index b7e83e1edb..e7fbaf62ef 100644
--- a/engines/draci/detection.cpp
+++ b/engines/draci/detection.cpp
@@ -155,30 +155,33 @@ void DraciMetaEngine::removeSaveState(const char *target, int slot) const {
SaveStateDescriptor DraciMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(
Draci::DraciEngine::getSavegameFile(slot));
- assert(f);
-
- Draci::DraciSavegameHeader header;
- Draci::readSavegameHeader(f, header);
- delete f;
-
- // Create the return descriptor
- SaveStateDescriptor desc(slot, header.saveName);
- desc.setDeletableFlag(true);
- desc.setWriteProtectedFlag(false);
- desc.setThumbnail(header.thumbnail);
-
- int day = (header.date >> 24) & 0xFF;
- int month = (header.date >> 16) & 0xFF;
- int year = header.date & 0xFFFF;
- desc.setSaveDate(year, month, day);
-
- int hour = (header.time >> 8) & 0xFF;
- int minutes = header.time & 0xFF;
- desc.setSaveTime(hour, minutes);
-
- desc.setPlayTime(header.playtime * 1000);
+
+ if (f) {
+ Draci::DraciSavegameHeader header;
+ Draci::readSavegameHeader(f, header);
+ delete f;
+
+ // Create the return descriptor
+ SaveStateDescriptor desc(slot, header.saveName);
+ desc.setDeletableFlag(true);
+ desc.setWriteProtectedFlag(false);
+ desc.setThumbnail(header.thumbnail);
+
+ int day = (header.date >> 24) & 0xFF;
+ int month = (header.date >> 16) & 0xFF;
+ int year = header.date & 0xFFFF;
+ desc.setSaveDate(year, month, day);
+
+ int hour = (header.time >> 8) & 0xFF;
+ int minutes = header.time & 0xFF;
+ desc.setSaveTime(hour, minutes);
+
+ desc.setPlayTime(header.playtime * 1000);
+
+ return desc;
+ }
- return desc;
+ return SaveStateDescriptor();
}
bool DraciMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index 893e321b79..c4108cc0c7 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -39,7 +39,7 @@
namespace Draci {
-static const char *dialoguePath = "ROZH";
+static const char *const dialoguePath = "ROZH";
static double real_to_double(byte real[6]);
diff --git a/engines/draci/saveload.cpp b/engines/draci/saveload.cpp
index 78315d1a97..b3bf0cbcd8 100644
--- a/engines/draci/saveload.cpp
+++ b/engines/draci/saveload.cpp
@@ -33,7 +33,7 @@
namespace Draci {
-static const char *draciIdentString = "DRACI";
+static const char *const draciIdentString = "DRACI";
bool readSavegameHeader(Common::InSaveFile *in, DraciSavegameHeader &header) {
char saveIdentBuffer[6];
diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp
index f667e7b73c..ffcad5b6bf 100644
--- a/engines/dreamweb/backdrop.cpp
+++ b/engines/dreamweb/backdrop.cpp
@@ -21,8 +21,6 @@
*/
#include "dreamweb/dreamweb.h"
-#include "engines/util.h"
-#include "graphics/surface.h"
namespace DreamGen {
@@ -153,7 +151,7 @@ void DreamGenContext::showallobs() {
SetObject *setEntries = (SetObject *)segRef(data.word(kSetdat)).ptr(0, 128 * sizeof(SetObject));
for (size_t i = 0; i < 128; ++i) {
SetObject *setEntry = setEntries + i;
- if (getmapad(setEntry->b58) == 0)
+ if (getmapad(setEntry->mapad) == 0)
continue;
uint8 currentFrame = setEntry->b18[0];
data.word(kCurrentframe) = currentFrame;
@@ -162,7 +160,7 @@ void DreamGenContext::showallobs() {
calcfrframe();
uint16 x, y;
finalframe(&x, &y);
- setEntry->b17 = setEntry->b18[0];
+ setEntry->index = setEntry->b18[0];
if ((setEntry->type == 0) && (setEntry->priority != 5) && (setEntry->priority != 6)) {
x += data.word(kMapadx);
y += data.word(kMapady);
@@ -253,9 +251,9 @@ void DreamGenContext::showallfree() {
data.word(kDataad) = kFrframedata;
data.word(kFramesad) = kFrframes;
data.byte(kCurrentfree) = 0;
- const uint8 *mapData = segRef(data.word(kFreedat)).ptr(2, 0);
+ const DynObject *freeObjects = (const DynObject *)segRef(data.word(kFreedat)).ptr(0, 0);
for(size_t i = 0; i < 80; ++i) {
- uint8 mapad = getmapad(mapData);
+ uint8 mapad = getmapad(freeObjects[i].mapad);
if (mapad != 0) {
data.word(kCurrentframe) = 3 * data.byte(kCurrentfree);
uint8 width, height;
@@ -277,7 +275,6 @@ void DreamGenContext::showallfree() {
}
++data.byte(kCurrentfree);
- mapData += 16;
}
}
@@ -297,5 +294,40 @@ void DreamGenContext::drawflags() {
}
}
+void DreamGenContext::showallex() {
+ data.word(kListpos) = kExlist;
+ memset(segRef(data.word(kBuffers)).ptr(kExlist, 100 * 5), 0xff, 100 * 5);
+
+ data.word(kFrsegment) = data.word(kExtras);
+ data.word(kDataad) = kExframedata;
+ data.word(kFramesad) = kExframes;
+ data.byte(kCurrentex) = 0;
+ DynObject *objects = (DynObject *)segRef(data.word(kExtras)).ptr(kExdata, sizeof(DynObject));
+ for (size_t i = 0; i < 100; ++i, ++data.byte(kCurrentex)) {
+ DynObject *object = objects + i;
+ if (object->mapad[0] == 0xff)
+ continue;
+ if (object->currentLocation != data.byte(kReallocation))
+ continue;
+ if (getmapad(object->mapad) == 0)
+ continue;
+ data.word(kCurrentframe) = 3 * data.byte(kCurrentex);
+ uint8 width, height;
+ calcfrframe(&width, &height);
+ uint16 x, y;
+ finalframe(&x, &y);
+ if ((width != 0) || (height != 0)) {
+ showframe((Frame *)segRef(data.word(kFrsegment)).ptr(0, 0), x + data.word(kMapadx), y + data.word(kMapady), data.word(kCurrentframe) & 0xff, 0);
+ ObjPos *objPos = (ObjPos *)segRef(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(ObjPos));
+ objPos->xMin = data.byte(kSavex);
+ objPos->yMin = data.byte(kSavey);
+ objPos->xMax = data.byte(kSavesize + 0) + data.byte(kSavex);
+ objPos->yMax = data.byte(kSavesize + 1) + data.byte(kSavey);
+ objPos->index = i;
+ data.word(kListpos) += sizeof(ObjPos);
+ }
+ }
+}
+
} /*namespace dreamgen */
diff --git a/engines/dreamweb/dreamgen.cpp b/engines/dreamweb/dreamgen.cpp
index 8d3518d5f6..a76a2697e3 100644
--- a/engines/dreamweb/dreamgen.cpp
+++ b/engines/dreamweb/dreamgen.cpp
@@ -2032,24 +2032,6 @@ gottrainframe:
showgamereel();
}
-void DreamGenContext::addtopeoplelist() {
- STACK_CHECK;
- push(es);
- push(bx);
- push(bx);
- cl = es.byte(bx+7);
- ax = es.word(bx+3);
- bx = data.word(kListpos);
- es = data.word(kBuffers);
- es.word(bx) = ax;
- ax = pop();
- es.word(bx+2) = ax;
- es.byte(bx+4) = cl;
- bx = pop();
- es = pop();
- _add(data.word(kListpos), 5);
-}
-
void DreamGenContext::checkspeed() {
STACK_CHECK;
_cmp(data.byte(kLastweapon), -1);
@@ -2068,14 +2050,6 @@ forcenext:
_cmp(al, al);
}
-void DreamGenContext::delsprite() {
- STACK_CHECK;
- di = bx;
- cx = (32);
- al = 255;
- _stosb(cx, true);
-}
-
void DreamGenContext::checkforexit() {
STACK_CHECK;
cl = data.byte(kRyanx);
@@ -2411,30 +2385,6 @@ foundlineend:
goto lookforlinestart;
}
-void DreamGenContext::getblockofpixel() {
- STACK_CHECK;
- push(cx);
- push(es);
- push(di);
- ax = data.word(kMapxstart);
- _add(cl, al);
- ax = data.word(kMapystart);
- _add(ch, al);
- checkone();
- _and(cl, 1);
- if (!flags.z())
- goto failrain;
- di = pop();
- es = pop();
- cx = pop();
- return;
-failrain:
- di = pop();
- es = pop();
- cx = pop();
- al = 0;
-}
-
void DreamGenContext::liftnoise() {
STACK_CHECK;
_cmp(data.byte(kReallocation), 5);
@@ -2578,64 +2528,6 @@ bigroom:
_add(data.byte(kMapysize), 8);
}
-void DreamGenContext::dumpeverything() {
- STACK_CHECK;
- es = data.word(kBuffers);
- bx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40));
-dumpevery1:
- ax = es.word(bx);
- cx = es.word(bx+2);
- _cmp(ax, 0x0ffff);
- if (flags.z())
- goto finishevery1;
- _cmp(ax, es.word(bx+(40*5)));
- if (!flags.z())
- goto notskip1;
- _cmp(cx, es.word(bx+(40*5)+2));
- if (flags.z())
- goto skip1;
-notskip1:
- push(bx);
- push(es);
- push(ds);
- bl = ah;
- bh = 0;
- ah = 0;
- di = ax;
- _add(di, data.word(kMapadx));
- _add(bx, data.word(kMapady));
- multidump();
- ds = pop();
- es = pop();
- bx = pop();
-skip1:
- _add(bx, 5);
- goto dumpevery1;
-finishevery1:
- bx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5)+(100*5)+(12*5)+(46*40))+(40*5);
-dumpevery2:
- ax = es.word(bx);
- cx = es.word(bx+2);
- _cmp(ax, 0x0ffff);
- if (flags.z())
- return /* (finishevery2) */;
- push(bx);
- push(es);
- push(ds);
- bl = ah;
- bh = 0;
- ah = 0;
- di = ax;
- _add(di, data.word(kMapadx));
- _add(bx, data.word(kMapady));
- multidump();
- ds = pop();
- es = pop();
- bx = pop();
- _add(bx, 5);
- goto dumpevery2;
-}
-
void DreamGenContext::loadpalfromiff() {
STACK_CHECK;
dx = 2481;
@@ -2675,83 +2567,6 @@ nought:
goto palloop;
}
-void DreamGenContext::paneltomap() {
- STACK_CHECK;
- di = data.word(kMapxstart);
- _add(di, data.word(kMapadx));
- bx = data.word(kMapystart);
- _add(bx, data.word(kMapady));
- ds = data.word(kMapstore);
- si = 0;
- cl = data.byte(kMapxsize);
- ch = data.byte(kMapysize);
- multiget();
-}
-
-void DreamGenContext::maptopanel() {
- STACK_CHECK;
- di = data.word(kMapxstart);
- _add(di, data.word(kMapadx));
- bx = data.word(kMapystart);
- _add(bx, data.word(kMapady));
- ds = data.word(kMapstore);
- si = 0;
- cl = data.byte(kMapxsize);
- ch = data.byte(kMapysize);
- multiput();
-}
-
-void DreamGenContext::dumpmap() {
- STACK_CHECK;
- di = data.word(kMapxstart);
- _add(di, data.word(kMapadx));
- bx = data.word(kMapystart);
- _add(bx, data.word(kMapady));
- cl = data.byte(kMapxsize);
- ch = data.byte(kMapysize);
- multidump();
-}
-
-void DreamGenContext::pixelcheckset() {
- STACK_CHECK;
- push(ax);
- _sub(al, es.byte(bx));
- _sub(ah, es.byte(bx+1));
- push(es);
- push(bx);
- push(cx);
- push(ax);
- al = es.byte(bx+4);
- getsetad();
- al = es.byte(bx+17);
- es = data.word(kSetframes);
- bx = (0);
- ah = 0;
- cx = 6;
- _mul(cx);
- _add(bx, ax);
- ax = pop();
- push(ax);
- al = ah;
- ah = 0;
- cl = es.byte(bx);
- ch = 0;
- _mul(cx);
- cx = pop();
- ch = 0;
- _add(ax, cx);
- _add(ax, es.word(bx+2));
- bx = ax;
- _add(bx, (0+2080));
- al = es.byte(bx);
- dl = al;
- cx = pop();
- bx = pop();
- es = pop();
- ax = pop();
- _cmp(dl, 0);
-}
-
void DreamGenContext::createpanel() {
STACK_CHECK;
di = 0;
@@ -2797,99 +2612,6 @@ void DreamGenContext::createpanel2() {
showframe();
}
-void DreamGenContext::delthisone() {
- STACK_CHECK;
- push(ax);
- push(ax);
- al = ah;
- ah = 0;
- _add(ax, data.word(kMapady));
- bx = (320);
- _mul(bx);
- bx = pop();
- bh = 0;
- _add(bx, data.word(kMapadx));
- _add(ax, bx);
- di = ax;
- ax = pop();
- push(ax);
- al = ah;
- ah = 0;
- bx = 22*8;
- _mul(bx);
- bx = pop();
- bh = 0;
- _add(ax, bx);
- si = ax;
- es = data.word(kWorkspace);
- ds = data.word(kMapstore);
- dl = cl;
- dh = 0;
- ax = (320);
- _sub(ax, dx);
- _neg(dx);
- _add(dx, 22*8);
-deloneloop:
- push(cx);
- ch = 0;
- _movsb(cx, true);
- cx = pop();
- _add(di, ax);
- _add(si, dx);
- _dec(ch);
- if (!flags.z())
- goto deloneloop;
-}
-
-void DreamGenContext::transferinv() {
- STACK_CHECK;
- di = data.word(kExframepos);
- push(di);
- al = data.byte(kExpos);
- ah = 0;
- bx = ax;
- _add(ax, ax);
- _add(ax, bx);
- _inc(ax);
- cx = 6;
- _mul(cx);
- es = data.word(kExtras);
- bx = (0);
- _add(bx, ax);
- _add(di, (0+2080));
- push(bx);
- al = data.byte(kItemtotran);
- ah = 0;
- bx = ax;
- _add(ax, ax);
- _add(ax, bx);
- _inc(ax);
- cx = 6;
- _mul(cx);
- ds = data.word(kFreeframes);
- bx = (0);
- _add(bx, ax);
- si = (0+2080);
- al = ds.byte(bx);
- ah = 0;
- cl = ds.byte(bx+1);
- ch = 0;
- _add(si, ds.word(bx+2));
- dx = ds.word(bx+4);
- bx = pop();
- es.byte(bx+0) = al;
- es.byte(bx+1) = cl;
- es.word(bx+4) = dx;
- _mul(cx);
- cx = ax;
- push(cx);
- _movsb(cx, true);
- cx = pop();
- ax = pop();
- es.word(bx+2) = ax;
- _add(data.word(kExframepos), cx);
-}
-
void DreamGenContext::transfermap() {
STACK_CHECK;
di = data.word(kExframepos);
@@ -4012,51 +3734,6 @@ nottrigger2:
data.byte(kKerning) = 0;
}
-void DreamGenContext::fillryan() {
- STACK_CHECK;
- es = data.word(kBuffers);
- di = (0+(228*13)+32);
- findallryan();
- si = (0+(228*13)+32);
- al = data.byte(kRyanpage);
- ah = 0;
- cx = 20;
- _mul(cx);
- _add(si, ax);
- di = (80);
- bx = (58);
- cx = 2;
-ryanloop2:
- push(cx);
- push(di);
- push(bx);
- cx = 5;
-ryanloop1:
- push(cx);
- push(di);
- push(bx);
- ax = es.word(si);
- _add(si, 2);
- push(si);
- push(es);
- obtoinv();
- es = pop();
- si = pop();
- bx = pop();
- di = pop();
- cx = pop();
- _add(di, (44));
- if (--cx)
- goto ryanloop1;
- bx = pop();
- di = pop();
- cx = pop();
- _add(bx, (44));
- if (--cx)
- goto ryanloop2;
- showryanpage();
-}
-
void DreamGenContext::fillopen() {
STACK_CHECK;
deltextline();
@@ -4101,41 +3778,6 @@ nextopenslot:
undertextline();
}
-void DreamGenContext::findallryan() {
- STACK_CHECK;
- push(di);
- cx = 30;
- ax = 0x0ffff;
- _stosw(cx, true);
- di = pop();
- cl = 4;
- ds = data.word(kExtras);
- bx = (0+2080+30000);
- ch = 0;
-findryanloop:
- _cmp(ds.byte(bx+2), cl);
- if (!flags.z())
- goto notinryaninv;
- _cmp(ds.byte(bx+3), 255);
- if (!flags.z())
- goto notinryaninv;
- al = ds.byte(bx+4);
- ah = 0;
- push(di);
- _add(di, ax);
- _add(di, ax);
- al = ch;
- ah = 4;
- _stosw();
- di = pop();
-notinryaninv:
- _add(bx, 16);
- _inc(ch);
- _cmp(ch, (114));
- if (!flags.z())
- goto findryanloop;
-}
-
void DreamGenContext::findallopen() {
STACK_CHECK;
push(di);
@@ -4209,82 +3851,6 @@ findopen2a:
goto findopen1a;
}
-void DreamGenContext::obtoinv() {
- STACK_CHECK;
- push(bx);
- push(es);
- push(si);
- push(ax);
- push(ax);
- push(di);
- push(bx);
- ds = data.word(kIcons1);
- _sub(di, 2);
- _sub(bx, 1);
- al = 10;
- ah = 0;
- showframe();
- bx = pop();
- di = pop();
- ax = pop();
- _cmp(al, 255);
- if (flags.z())
- goto finishfill;
- push(bx);
- push(di);
- push(ax);
- ds = data.word(kExtras);
- _cmp(ah, 4);
- if (flags.z())
- goto isanextra;
- ds = data.word(kFreeframes);
-isanextra:
- cl = al;
- _add(al, al);
- _add(al, cl);
- _inc(al);
- ah = 128;
- _add(bx, 19);
- _add(di, 18);
- showframe();
- ax = pop();
- di = pop();
- bx = pop();
- push(bx);
- getanyaddir();
- isitworn();
- bx = pop();
- if (!flags.z())
- goto finishfill;
- ds = data.word(kIcons1);
- _sub(di, 3);
- _sub(bx, 2);
- al = 7;
- ah = 0;
- showframe();
-finishfill:
- ax = pop();
- si = pop();
- es = pop();
- bx = pop();
-}
-
-void DreamGenContext::isitworn() {
- STACK_CHECK;
- al = es.byte(bx+12);
- _cmp(al, 'W'-'A');
- if (!flags.z())
- return /* (notworn) */;
- al = es.byte(bx+13);
- _cmp(al, 'E'-'A');
-}
-
-void DreamGenContext::makeworn() {
- STACK_CHECK;
- es.byte(bx+12) = 'W'-'A';
- es.byte(bx+13) = 'E'-'A';
-}
-
void DreamGenContext::examineob() {
STACK_CHECK;
data.byte(kPointermode) = 0;
@@ -4331,6 +3897,9 @@ waitexam:
bx = offset_withlist1;
notuseinv:
checkcoords();
+ _cmp(data.byte(kQuitrequested), 0);
+ if (!flags.z())
+ goto stopwaiting;
_cmp(data.byte(kExamagain), 0);
if (flags.z())
goto norex;
@@ -4339,6 +3908,7 @@ norex:
_cmp(data.byte(kGetback), 0);
if (flags.z())
goto waitexam;
+stopwaiting:
data.byte(kPickup) = 0;
_cmp(data.word(kWatchingtime), 0);
if (!flags.z())
@@ -4431,30 +4001,6 @@ void DreamGenContext::openinv() {
data.byte(kCommandtype) = 255;
}
-void DreamGenContext::showryanpage() {
- STACK_CHECK;
- ds = data.word(kIcons1);
- di = (80)+167;
- bx = (58)-12;
- al = 12;
- ah = 0;
- showframe();
- al = 13;
- _add(al, data.byte(kRyanpage));
- push(ax);
- al = data.byte(kRyanpage);
- ah = 0;
- cx = 18;
- _mul(cx);
- ds = data.word(kIcons1);
- di = (80)+167;
- _add(di, ax);
- bx = (58)-12;
- ax = pop();
- ah = 0;
- showframe();
-}
-
void DreamGenContext::openob() {
STACK_CHECK;
al = data.byte(kOpenedob);
@@ -4486,28 +4032,6 @@ void DreamGenContext::openob() {
cs.word(bx) = ax;
}
-void DreamGenContext::obicons() {
- STACK_CHECK;
- al = data.byte(kCommand);
- getanyad();
- _cmp(al, 255);
- if (flags.z())
- goto cantopenit;
- ds = data.word(kIcons2);
- di = 210;
- bx = 1;
- al = 4;
- ah = 0;
- showframe();
-cantopenit:
- ds = data.word(kIcons2);
- di = 260;
- bx = 1;
- al = 1;
- ah = 0;
- showframe();
-}
-
void DreamGenContext::examicon() {
STACK_CHECK;
ds = data.word(kIcons2);
@@ -4518,38 +4042,6 @@ void DreamGenContext::examicon() {
showframe();
}
-void DreamGenContext::obpicture() {
- STACK_CHECK;
- al = data.byte(kCommand);
- ah = data.byte(kObjecttype);
- _cmp(ah, 1);
- if (flags.z())
- return /* (setframe) */;
- _cmp(ah, 4);
- if (flags.z())
- goto exframe;
- ds = data.word(kFreeframes);
- di = 160;
- bx = 68;
- cl = al;
- _add(al, al);
- _add(al, cl);
- _inc(al);
- ah = 128;
- showframe();
- return;
-exframe:
- ds = data.word(kExtras);
- di = 160;
- bx = 68;
- cl = al;
- _add(al, al);
- _add(al, cl);
- _inc(al);
- ah = 128;
- showframe();
-}
-
void DreamGenContext::describeob() {
STACK_CHECK;
getobtextstart();
@@ -4741,19 +4233,6 @@ foundmatch:
bx = pop();
}
-void DreamGenContext::findnextcolon() {
- STACK_CHECK;
-isntcolon:
- al = es.byte(si);
- _inc(si);
- _cmp(al, 0);
- if (flags.z())
- return /* (endofcolon) */;
- _cmp(al, ':');
- if (!flags.z())
- goto isntcolon;
-}
-
void DreamGenContext::inventory() {
STACK_CHECK;
_cmp(data.byte(kMandead), 1);
@@ -4802,7 +4281,7 @@ doopeninv:
data.byte(kOpenedob) = 255;
goto waitexam;
return;
-/*continuing to unbounded code: examineagain from examineob:3-66*/
+/*continuing to unbounded code: examineagain from examineob:3-69*/
examineagain:
data.byte(kInmaparea) = 0;
data.byte(kExamagain) = 0;
@@ -4845,6 +4324,9 @@ waitexam:
bx = offset_withlist1;
notuseinv:
checkcoords();
+ _cmp(data.byte(kQuitrequested), 0);
+ if (!flags.z())
+ goto stopwaiting;
_cmp(data.byte(kExamagain), 0);
if (flags.z())
goto norex;
@@ -4853,6 +4335,7 @@ norex:
_cmp(data.byte(kGetback), 0);
if (flags.z())
goto waitexam;
+stopwaiting:
data.byte(kPickup) = 0;
_cmp(data.word(kWatchingtime), 0);
if (!flags.z())
@@ -6044,24 +5527,6 @@ moretext:
goto moretext;
}
-void DreamGenContext::getexpos() {
- STACK_CHECK;
- es = data.word(kExtras);
- al = 0;
- di = (0+2080+30000);
-tryanotherex:
- _cmp(es.byte(di+2), 255);
- if (flags.z())
- goto foundnewex;
- _add(di, 16);
- _inc(al);
- _cmp(al, (114));
- if (!flags.z())
- goto tryanotherex;
-foundnewex:
- data.byte(kExpos) = al;
-}
-
void DreamGenContext::purgealocation() {
STACK_CHECK;
push(ax);
@@ -6321,94 +5786,6 @@ void DreamGenContext::drawfloor() {
es = pop();
}
-void DreamGenContext::showallex() {
- STACK_CHECK;
- es = data.word(kBuffers);
- bx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5));
- data.word(kListpos) = bx;
- di = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5));
- cx = 100*5;
- al = 255;
- _stosb(cx, true);
- es = data.word(kExtras);
- data.word(kFrsegment) = es;
- ax = (0);
- data.word(kDataad) = ax;
- ax = (0+2080);
- data.word(kFramesad) = ax;
- data.byte(kCurrentex) = 0;
- si = (0+2080+30000)+2;
- cx = 0;
-exloop:
- push(cx);
- push(si);
- es = data.word(kExtras);
- push(si);
- ch = 0;
- _cmp(es.byte(si), 255);
- if (flags.z())
- goto notinroom;
- al = es.byte(si-2);
- _cmp(al, data.byte(kReallocation));
- if (!flags.z())
- goto notinroom;
- getmapad();
-notinroom:
- si = pop();
- _cmp(ch, 0);
- if (flags.z())
- goto blankex;
- al = data.byte(kCurrentex);
- ah = 0;
- dx = ax;
- _add(ax, ax);
- _add(ax, dx);
- data.word(kCurrentframe) = ax;
- push(es);
- push(si);
- calcfrframe();
- es = data.word(kMapstore);
- ds = data.word(kFrsegment);
- finalframe();
- si = pop();
- es = pop();
- _cmp(cx, 0);
- if (flags.z())
- goto blankex;
- ax = data.word(kCurrentframe);
- ah = 0;
- _add(di, data.word(kMapadx));
- _add(bx, data.word(kMapady));
- showframe();
- si = data.word(kListpos);
- es = data.word(kBuffers);
- al = data.byte(kSavex);
- ah = data.byte(kSavey);
- es.word(si) = ax;
- cx = ax;
- ax = data.word(kSavesize);
- _add(al, cl);
- _add(ah, ch);
- es.word(si+2) = ax;
- ax = pop();
- cx = pop();
- push(cx);
- push(ax);
- es.byte(si+4) = cl;
- _add(si, 5);
- data.word(kListpos) = si;
-blankex:
- _inc(data.byte(kCurrentex));
- si = pop();
- cx = pop();
- _add(si, 16);
- _inc(cx);
- _cmp(cx, 100);
- if (flags.z())
- return /* (finex) */;
- goto exloop;
-}
-
void DreamGenContext::autolook() {
STACK_CHECK;
ax = data.word(kMousex);
@@ -8756,91 +8133,6 @@ douse:
useroutine();
}
-void DreamGenContext::useroutine() {
- STACK_CHECK;
- _cmp(data.byte(kReallocation), 50);
- if (flags.c())
- goto nodream7;
- _cmp(data.byte(kPointerpower), 0);
- if (!flags.z())
- goto powerok;
- return;
-powerok:
- data.byte(kPointerpower) = 0;
-nodream7:
- getanyad();
- dx = data;
- ds = dx;
- si = offset_uselist;
-checkuselist:
- push(si);
- _lodsb();
- _sub(al, 'A');
- _cmp(al, es.byte(bx+12));
- if (!flags.z())
- goto failed;
- _lodsb();
- _sub(al, 'A');
- _cmp(al, es.byte(bx+13));
- if (!flags.z())
- goto failed;
- _lodsb();
- _sub(al, 'A');
- _cmp(al, es.byte(bx+14));
- if (!flags.z())
- goto failed;
- _lodsb();
- _sub(al, 'A');
- _cmp(al, es.byte(bx+15));
- if (!flags.z())
- goto failed;
- _lodsw();
- si = pop();
- __dispatch_call(ax);
- return;
-failed:
- si = pop();
- _add(si, 6);
- _cmp(ds.byte(si), 140);
- if (!flags.z())
- goto checkuselist;
- delpointer();
- getobtextstart();
- findnextcolon();
- _cmp(al, 0);
- if (flags.z())
- goto cantuse2;
- findnextcolon();
- _cmp(al, 0);
- if (flags.z())
- goto cantuse2;
- al = es.byte(si);
- _cmp(al, 0);
- if (flags.z())
- goto cantuse2;
- usetext();
- cx = 400;
- hangonp();
- putbackobstuff();
- return;
-cantuse2:
- createpanel();
- showpanel();
- showman();
- showexit();
- obicons();
- di = 33;
- bx = 100;
- al = 63;
- dl = 241;
- printmessage();
- worktoscreenm();
- cx = 50;
- hangonp();
- putbackobstuff();
- data.byte(kCommandtype) = 255;
-}
-
void DreamGenContext::wheelsound() {
STACK_CHECK;
al = 17;
@@ -10843,23 +10135,6 @@ doselob:
useroutine();
}
-void DreamGenContext::compare() {
- STACK_CHECK;
- _sub(dl, 'A');
- _sub(dh, 'A');
- _sub(cl, 'A');
- _sub(ch, 'A');
- push(cx);
- push(dx);
- getanyaddir();
- dx = pop();
- cx = pop();
- _cmp(es.word(bx+12), cx);
- if (!flags.z())
- return /* (comparefin) */;
- _cmp(es.word(bx+14), dx);
-}
-
void DreamGenContext::findsetobject() {
STACK_CHECK;
_sub(al, 'A');
@@ -10985,26 +10260,6 @@ notfoundinside:
goto insideloop;
}
-void DreamGenContext::usetext() {
- STACK_CHECK;
- push(es);
- push(si);
- createpanel();
- showpanel();
- showman();
- showexit();
- obicons();
- si = pop();
- es = pop();
- di = 36;
- bx = 104;
- dl = 241;
- al = 0;
- ah = 0;
- printdirect();
- worktoscreenm();
-}
-
void DreamGenContext::putbackobstuff() {
STACK_CHECK;
createpanel();
@@ -15160,105 +14415,6 @@ nothingund:
blank();
}
-void DreamGenContext::checkifset() {
- STACK_CHECK;
- es = data.word(kBuffers);
- bx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32))+(127*5);
- cx = 127;
-identifyset:
- _cmp(es.byte(bx+4), 255);
- if (flags.z())
- goto notasetid;
- _cmp(al, es.byte(bx));
- if (flags.c())
- goto notasetid;
- _cmp(al, es.byte(bx+2));
- if (!flags.c())
- goto notasetid;
- _cmp(ah, es.byte(bx+1));
- if (flags.c())
- goto notasetid;
- _cmp(ah, es.byte(bx+3));
- if (!flags.c())
- goto notasetid;
- pixelcheckset();
- if (flags.z())
- goto notasetid;
- isitdescribed();
- if (flags.z())
- goto notasetid;
- al = es.byte(bx+4);
- ah = 1;
- obname();
- al = 0;
- _cmp(al, 1);
- return;
-notasetid:
- _sub(bx, 5);
- _dec(cx);
- _cmp(cx, -1);
- if (!flags.z())
- goto identifyset;
-}
-
-void DreamGenContext::checkifex() {
- STACK_CHECK;
- es = data.word(kBuffers);
- bx = (0+(228*13)+32+60+(32*32)+(11*10*3)+768+768+768+(32*32)+(128*5)+(80*5))+(99*5);
- cx = 99;
-identifyex:
- _cmp(es.byte(bx+4), 255);
- if (flags.z())
- goto notanexid;
- _cmp(al, es.byte(bx));
- if (flags.c())
- goto notanexid;
- _cmp(al, es.byte(bx+2));
- if (!flags.c())
- goto notanexid;
- _cmp(ah, es.byte(bx+1));
- if (flags.c())
- goto notanexid;
- _cmp(ah, es.byte(bx+3));
- if (!flags.c())
- goto notanexid;
- al = es.byte(bx+4);
- ah = 4;
- obname();
- al = 1;
- _cmp(al, 0);
- return;
-notanexid:
- _sub(bx, 5);
- _dec(cx);
- _cmp(cx, -1);
- if (!flags.z())
- goto identifyex;
-}
-
-void DreamGenContext::isitdescribed() {
- STACK_CHECK;
- push(ax);
- push(cx);
- push(es);
- push(bx);
- al = es.byte(bx+4);
- ah = 0;
- _add(ax, ax);
- bx = ax;
- es = data.word(kSetdesc);
- _add(bx, (0));
- ax = es.word(bx);
- _add(ax, (0+(130*2)));
- bx = ax;
- dl = es.byte(bx);
- bx = pop();
- es = pop();
- cx = pop();
- ax = pop();
- _cmp(dl, 0);
-}
-
void DreamGenContext::findpathofpoint() {
STACK_CHECK;
push(ax);
@@ -15346,118 +14502,6 @@ gotfirst:
al = es.byte(bx+6);
}
-void DreamGenContext::turnpathon() {
- STACK_CHECK;
- push(ax);
- push(ax);
- cl = 255;
- ch = data.byte(kRoomnum);
- _add(ch, 100);
- findormake();
- ax = pop();
- getroomspaths();
- ax = pop();
- _cmp(al, 255);
- if (flags.z())
- return /* (nopathon) */;
- ah = 0;
- _add(ax, ax);
- _add(ax, ax);
- _add(ax, ax);
- _add(bx, ax);
- al = 255;
- es.byte(bx+6) = al;
-}
-
-void DreamGenContext::turnpathoff() {
- STACK_CHECK;
- push(ax);
- push(ax);
- cl = 0;
- ch = data.byte(kRoomnum);
- _add(ch, 100);
- findormake();
- ax = pop();
- getroomspaths();
- ax = pop();
- _cmp(al, 255);
- if (flags.z())
- return /* (nopathoff) */;
- ah = 0;
- _add(ax, ax);
- _add(ax, ax);
- _add(ax, ax);
- _add(bx, ax);
- al = 0;
- es.byte(bx+6) = al;
-}
-
-void DreamGenContext::turnanypathon() {
- STACK_CHECK;
- push(ax);
- push(ax);
- cl = 255;
- ch = ah;
- _add(ch, 100);
- findormake();
- ax = pop();
- al = ah;
- ah = 0;
- cx = 144;
- _mul(cx);
- es = data.word(kReels);
- bx = (0);
- _add(bx, ax);
- ax = pop();
- ah = 0;
- _add(ax, ax);
- _add(ax, ax);
- _add(ax, ax);
- _add(bx, ax);
- al = 255;
- es.byte(bx+6) = al;
-}
-
-void DreamGenContext::turnanypathoff() {
- STACK_CHECK;
- push(ax);
- push(ax);
- cl = 0;
- ch = ah;
- _add(ch, 100);
- findormake();
- ax = pop();
- al = ah;
- ah = 0;
- cx = 144;
- _mul(cx);
- es = data.word(kReels);
- bx = (0);
- _add(bx, ax);
- ax = pop();
- ah = 0;
- _add(ax, ax);
- _add(ax, ax);
- _add(ax, ax);
- _add(bx, ax);
- al = 0;
- es.byte(bx+6) = al;
-}
-
-void DreamGenContext::checkifpathison() {
- STACK_CHECK;
- push(ax);
- getroomspaths();
- ax = pop();
- ah = 0;
- _add(ax, ax);
- _add(ax, ax);
- _add(ax, ax);
- _add(bx, ax);
- al = es.byte(bx+6);
- _cmp(al, 255);
-}
-
void DreamGenContext::afternewroom() {
STACK_CHECK;
_cmp(data.byte(kNowinnewroom), 0);
@@ -15607,34 +14651,6 @@ void DreamGenContext::afterintroroom() {
data.byte(kNowinnewroom) = 0;
}
-void DreamGenContext::examineobtext() {
- STACK_CHECK;
- bl = data.byte(kCommand);
- bh = data.byte(kCommandtype);
- al = 1;
- commandwithob();
-}
-
-void DreamGenContext::printmessage() {
- STACK_CHECK;
- push(dx);
- push(bx);
- push(di);
- ah = 0;
- _add(ax, ax);
- bx = ax;
- es = data.word(kCommandtext);
- ax = es.word(bx);
- _add(ax, (66*2));
- si = ax;
- di = pop();
- bx = pop();
- dx = pop();
- al = 0;
- ah = 0;
- printdirect();
-}
-
void DreamGenContext::printmessage2() {
STACK_CHECK;
push(dx);
@@ -15707,134 +14723,6 @@ holdingreel:
data.byte(kWatchmode) = 2;
}
-void DreamGenContext::bresenhams() {
- STACK_CHECK;
- workoutframes();
- dx = data;
- es = dx;
- di = 8173;
- si = 1;
- data.byte(kLinedirection) = 0;
- cx = data.word(kLineendx);
- _sub(cx, data.word(kLinestartx));
- if (flags.z())
- goto vertline;
- if (!flags.s())
- goto line1;
- _neg(cx);
- bx = data.word(kLineendx);
- _xchg(bx, data.word(kLinestartx));
- data.word(kLineendx) = bx;
- bx = data.word(kLineendy);
- _xchg(bx, data.word(kLinestarty));
- data.word(kLineendy) = bx;
- data.byte(kLinedirection) = 1;
-line1:
- bx = data.word(kLineendy);
- _sub(bx, data.word(kLinestarty));
- if (flags.z())
- goto horizline;
- if (!flags.s())
- goto line3;
- _neg(bx);
- _neg(si);
-line3:
- push(si);
- data.byte(kLineroutine) = 0;
- _cmp(bx, cx);
- if (flags.le())
- goto line4;
- data.byte(kLineroutine) = 1;
- _xchg(bx, cx);
-line4:
- _shl(bx, 1);
- data.word(kIncrement1) = bx;
- _sub(bx, cx);
- si = bx;
- _sub(bx, cx);
- data.word(kIncrement2) = bx;
- ax = data.word(kLinestartx);
- bx = data.word(kLinestarty);
- ah = bl;
- _inc(cx);
- bx = pop();
- _cmp(data.byte(kLineroutine), 1);
- if (flags.z())
- goto hislope;
- goto loslope;
-vertline:
- ax = data.word(kLinestarty);
- bx = data.word(kLineendy);
- cx = bx;
- _sub(cx, ax);
- if (!flags.l())
- goto line31;
- _neg(cx);
- ax = bx;
- data.byte(kLinedirection) = 1;
-line31:
- _inc(cx);
- bx = data.word(kLinestartx);
- _xchg(ax, bx);
- ah = bl;
- bx = si;
-line32:
- _stosw();
- _add(ah, bl);
- if (--cx)
- goto line32;
- goto lineexit;
-horizline:
- ax = data.word(kLinestartx);
- bx = data.word(kLinestarty);
- ah = bl;
- _inc(cx);
-horizloop:
- _stosw();
- _inc(al);
- if (--cx)
- goto horizloop;
- goto lineexit;
-loslope:
-loloop:
- _stosw();
- _inc(al);
- _or(si, si);
- if (!flags.s())
- goto line12;
- _add(si, data.word(kIncrement1));
- if (--cx)
- goto loloop;
- goto lineexit;
-line12:
- _add(si, data.word(kIncrement2));
- _add(ah, bl);
- if (--cx)
- goto loloop;
- goto lineexit;
-hislope:
-hiloop:
- _stosw();
- _add(ah, bl);
- _or(si, si);
- if (!flags.s())
- goto line23;
- _add(si, data.word(kIncrement1));
- if (--cx)
- goto hiloop;
- goto lineexit;
-line23:
- _add(si, data.word(kIncrement2));
- _inc(al);
- if (--cx)
- goto hiloop;
-lineexit:
- _sub(di, 8173);
- ax = di;
- _shr(ax, 1);
- data.byte(kLinelength) = al;
-}
-
void DreamGenContext::workoutframes() {
STACK_CHECK;
bx = data.word(kLinestartx);
@@ -16169,53 +15057,6 @@ void DreamGenContext::allpointer() {
dumppointer();
}
-void DreamGenContext::hangonp() {
- STACK_CHECK;
- push(cx);
- _add(cx, cx);
- ax = pop();
- _add(cx, ax);
- data.word(kMaintimer) = 0;
- al = data.byte(kPointerframe);
- ah = data.byte(kPickup);
- push(ax);
- data.byte(kPointermode) = 3;
- data.byte(kPickup) = 0;
- push(cx);
- data.byte(kCommandtype) = 255;
- readmouse();
- animpointer();
- showpointer();
- vsync();
- dumppointer();
- cx = pop();
-hangloop:
- push(cx);
- delpointer();
- readmouse();
- animpointer();
- showpointer();
- vsync();
- dumppointer();
- cx = pop();
- ax = data.word(kMousebutton);
- _cmp(ax, 0);
- if (flags.z())
- goto notpressed;
- _cmp(ax, data.word(kOldbutton));
- if (!flags.z())
- goto getoutofit;
-notpressed:
- if (--cx)
- goto hangloop;
-getoutofit:
- delpointer();
- ax = pop();
- data.byte(kPointerframe) = al;
- data.byte(kPickup) = ah;
- data.byte(kPointermode) = 0;
-}
-
void DreamGenContext::hangonw() {
STACK_CHECK;
hangloopw:
@@ -16342,16 +15183,6 @@ void DreamGenContext::randomnum2() {
ds = pop();
}
-void DreamGenContext::hangon() {
- STACK_CHECK;
-hangonloop:
- push(cx);
- vsync();
- cx = pop();
- if (--cx)
- goto hangonloop;
-}
-
void DreamGenContext::loadtraveltext() {
STACK_CHECK;
dx = 2234;
@@ -17968,9 +16799,7 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_copper: copper(); break;
case addr_sparky: sparky(); break;
case addr_train: train(); break;
- case addr_addtopeoplelist: addtopeoplelist(); break;
case addr_checkspeed: checkspeed(); break;
- case addr_delsprite: delsprite(); break;
case addr_mainman: mainman(); break;
case addr_checkforexit: checkforexit(); break;
case addr_adjustdown: adjustdown(); break;
@@ -17980,7 +16809,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_reminders: reminders(); break;
case addr_initrain: initrain(); break;
case addr_splitintolines: splitintolines(); break;
- case addr_getblockofpixel: getblockofpixel(); break;
case addr_backobject: backobject(); break;
case addr_liftnoise: liftnoise(); break;
case addr_random: random(); break;
@@ -17990,20 +16818,13 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_soundonreels: soundonreels(); break;
case addr_reconstruct: reconstruct(); break;
case addr_deleverything: deleverything(); break;
- case addr_dumpeverything: dumpeverything(); break;
case addr_showpcx: showpcx(); break;
case addr_loadpalfromiff: loadpalfromiff(); break;
case addr_setmode: setmode(); break;
- case addr_paneltomap: paneltomap(); break;
- case addr_maptopanel: maptopanel(); break;
- case addr_dumpmap: dumpmap(); break;
- case addr_pixelcheckset: pixelcheckset(); break;
case addr_createpanel: createpanel(); break;
case addr_createpanel2: createpanel2(); break;
case addr_vsync: vsync(); break;
case addr_doshake: doshake(); break;
- case addr_delthisone: delthisone(); break;
- case addr_transferinv: transferinv(); break;
case addr_transfermap: transfermap(); break;
case addr_fadedos: fadedos(); break;
case addr_dofade: dofade(); break;
@@ -18051,29 +16872,20 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_set16colpalette: set16colpalette(); break;
case addr_realcredits: realcredits(); break;
case addr_monprint: monprint(); break;
- case addr_fillryan: fillryan(); break;
case addr_fillopen: fillopen(); break;
- case addr_findallryan: findallryan(); break;
case addr_findallopen: findallopen(); break;
- case addr_obtoinv: obtoinv(); break;
- case addr_isitworn: isitworn(); break;
- case addr_makeworn: makeworn(); break;
case addr_examineob: examineob(); break;
case addr_makemainscreen: makemainscreen(); break;
case addr_getbackfromob: getbackfromob(); break;
case addr_incryanpage: incryanpage(); break;
case addr_openinv: openinv(); break;
- case addr_showryanpage: showryanpage(); break;
case addr_openob: openob(); break;
- case addr_obicons: obicons(); break;
case addr_examicon: examicon(); break;
- case addr_obpicture: obpicture(); break;
case addr_describeob: describeob(); break;
case addr_additionaltext: additionaltext(); break;
case addr_obsthatdothings: obsthatdothings(); break;
case addr_getobtextstart: getobtextstart(); break;
case addr_searchforsame: searchforsame(); break;
- case addr_findnextcolon: findnextcolon(); break;
case addr_inventory: inventory(); break;
case addr_setpickup: setpickup(); break;
case addr_examinventory: examinventory(); break;
@@ -18108,7 +16920,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_pickupconts: pickupconts(); break;
case addr_transfercontoex: transfercontoex(); break;
case addr_transfertext: transfertext(); break;
- case addr_getexpos: getexpos(); break;
case addr_purgealocation: purgealocation(); break;
case addr_emergencypurge: emergencypurge(); break;
case addr_purgeanitem: purgeanitem(); break;
@@ -18117,7 +16928,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_deleteextext: deleteextext(); break;
case addr_blockget: blockget(); break;
case addr_drawfloor: drawfloor(); break;
- case addr_showallex: showallex(); break;
case addr_autolook: autolook(); break;
case addr_look: look(); break;
case addr_dolook: dolook(); break;
@@ -18187,7 +16997,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_printcurs: printcurs(); break;
case addr_delcurs: delcurs(); break;
case addr_useobject: useobject(); break;
- case addr_useroutine: useroutine(); break;
case addr_wheelsound: wheelsound(); break;
case addr_runtap: runtap(); break;
case addr_playguitar: playguitar(); break;
@@ -18266,12 +17075,10 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_useelvdoor: useelvdoor(); break;
case addr_withwhat: withwhat(); break;
case addr_selectob: selectob(); break;
- case addr_compare: compare(); break;
case addr_findsetobject: findsetobject(); break;
case addr_findexobject: findexobject(); break;
case addr_isryanholding: isryanholding(); break;
case addr_checkinside: checkinside(); break;
- case addr_usetext: usetext(); break;
case addr_putbackobstuff: putbackobstuff(); break;
case addr_showpuztext: showpuztext(); break;
case addr_findpuztext: findpuztext(); break;
@@ -18444,25 +17251,14 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_mainscreen: mainscreen(); break;
case addr_madmanrun: madmanrun(); break;
case addr_identifyob: identifyob(); break;
- case addr_checkifset: checkifset(); break;
- case addr_checkifex: checkifex(); break;
- case addr_isitdescribed: isitdescribed(); break;
case addr_findpathofpoint: findpathofpoint(); break;
case addr_findfirstpath: findfirstpath(); break;
- case addr_turnpathon: turnpathon(); break;
- case addr_turnpathoff: turnpathoff(); break;
- case addr_turnanypathon: turnanypathon(); break;
- case addr_turnanypathoff: turnanypathoff(); break;
- case addr_checkifpathison: checkifpathison(); break;
case addr_afternewroom: afternewroom(); break;
case addr_atmospheres: atmospheres(); break;
case addr_walkintoroom: walkintoroom(); break;
case addr_afterintroroom: afterintroroom(); break;
- case addr_examineobtext: examineobtext(); break;
- case addr_printmessage: printmessage(); break;
case addr_printmessage2: printmessage2(); break;
case addr_setwalk: setwalk(); break;
- case addr_bresenhams: bresenhams(); break;
case addr_workoutframes: workoutframes(); break;
case addr_showicon: showicon(); break;
case addr_middlepanel: middlepanel(); break;
@@ -18478,7 +17274,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_worktoscreenm: worktoscreenm(); break;
case addr_blank: blank(); break;
case addr_allpointer: allpointer(); break;
- case addr_hangonp: hangonp(); break;
case addr_hangonw: hangonw(); break;
case addr_hangoncurs: hangoncurs(); break;
case addr_getunderzoom: getunderzoom(); break;
@@ -18490,7 +17285,6 @@ void DreamGenContext::__dispatch_call(uint16 addr) {
case addr_readkey: readkey(); break;
case addr_randomnum1: randomnum1(); break;
case addr_randomnum2: randomnum2(); break;
- case addr_hangon: hangon(); break;
case addr_loadtraveltext: loadtraveltext(); break;
case addr_loadintotemp: loadintotemp(); break;
case addr_loadintotemp2: loadintotemp2(); break;
diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h
index fc4deeb488..729b802b41 100644
--- a/engines/dreamweb/dreamgen.h
+++ b/engines/dreamweb/dreamgen.h
@@ -74,7 +74,6 @@ public:
static const uint16 addr_loadintotemp2 = 0xcb1c;
static const uint16 addr_loadintotemp = 0xcb18;
static const uint16 addr_loadtraveltext = 0xcb14;
- static const uint16 addr_hangon = 0xcb10;
static const uint16 addr_randomnum2 = 0xcb08;
static const uint16 addr_randomnum1 = 0xcb04;
static const uint16 addr_readkey = 0xcafc;
@@ -86,7 +85,6 @@ public:
static const uint16 addr_getunderzoom = 0xcab4;
static const uint16 addr_hangoncurs = 0xcab0;
static const uint16 addr_hangonw = 0xcaac;
- static const uint16 addr_hangonp = 0xcaa8;
static const uint16 addr_allpointer = 0xcaa4;
static const uint16 addr_blank = 0xcaa0;
static const uint16 addr_worktoscreenm = 0xca9c;
@@ -102,25 +100,14 @@ public:
static const uint16 addr_middlepanel = 0xca68;
static const uint16 addr_showicon = 0xca64;
static const uint16 addr_workoutframes = 0xca54;
- static const uint16 addr_bresenhams = 0xca50;
static const uint16 addr_setwalk = 0xca44;
static const uint16 addr_printmessage2 = 0xca30;
- static const uint16 addr_printmessage = 0xca2c;
- static const uint16 addr_examineobtext = 0xca20;
static const uint16 addr_afterintroroom = 0xca14;
static const uint16 addr_walkintoroom = 0xca10;
static const uint16 addr_atmospheres = 0xca0c;
static const uint16 addr_afternewroom = 0xca08;
- static const uint16 addr_checkifpathison = 0xca04;
- static const uint16 addr_turnanypathoff = 0xca00;
- static const uint16 addr_turnanypathon = 0xc9fc;
- static const uint16 addr_turnpathoff = 0xc9f8;
- static const uint16 addr_turnpathon = 0xc9f4;
static const uint16 addr_findfirstpath = 0xc9f0;
static const uint16 addr_findpathofpoint = 0xc9ec;
- static const uint16 addr_isitdescribed = 0xc9e8;
- static const uint16 addr_checkifex = 0xc9e0;
- static const uint16 addr_checkifset = 0xc9dc;
static const uint16 addr_identifyob = 0xc9d4;
static const uint16 addr_madmanrun = 0xc9cc;
static const uint16 addr_mainscreen = 0xc9c8;
@@ -294,12 +281,10 @@ public:
static const uint16 addr_findpuztext = 0xc6e0;
static const uint16 addr_showpuztext = 0xc6dc;
static const uint16 addr_putbackobstuff = 0xc6d8;
- static const uint16 addr_usetext = 0xc6d4;
static const uint16 addr_checkinside = 0xc6d0;
static const uint16 addr_isryanholding = 0xc6cc;
static const uint16 addr_findexobject = 0xc6c8;
static const uint16 addr_findsetobject = 0xc6c4;
- static const uint16 addr_compare = 0xc6c0;
static const uint16 addr_selectob = 0xc6bc;
static const uint16 addr_withwhat = 0xc6b8;
static const uint16 addr_useelvdoor = 0xc6b4;
@@ -378,7 +363,6 @@ public:
static const uint16 addr_playguitar = 0xc590;
static const uint16 addr_runtap = 0xc58c;
static const uint16 addr_wheelsound = 0xc588;
- static const uint16 addr_useroutine = 0xc584;
static const uint16 addr_useobject = 0xc580;
static const uint16 addr_delcurs = 0xc57c;
static const uint16 addr_printcurs = 0xc578;
@@ -448,7 +432,6 @@ public:
static const uint16 addr_dolook = 0xc474;
static const uint16 addr_look = 0xc470;
static const uint16 addr_autolook = 0xc46c;
- static const uint16 addr_showallex = 0xc450;
static const uint16 addr_drawfloor = 0xc428;
static const uint16 addr_blockget = 0xc424;
static const uint16 addr_deleteextext = 0xc420;
@@ -457,7 +440,6 @@ public:
static const uint16 addr_purgeanitem = 0xc414;
static const uint16 addr_emergencypurge = 0xc410;
static const uint16 addr_purgealocation = 0xc40c;
- static const uint16 addr_getexpos = 0xc408;
static const uint16 addr_transfertext = 0xc404;
static const uint16 addr_transfercontoex = 0xc400;
static const uint16 addr_pickupconts = 0xc3fc;
@@ -492,29 +474,20 @@ public:
static const uint16 addr_examinventory = 0xc384;
static const uint16 addr_setpickup = 0xc380;
static const uint16 addr_inventory = 0xc37c;
- static const uint16 addr_findnextcolon = 0xc378;
static const uint16 addr_searchforsame = 0xc374;
static const uint16 addr_getobtextstart = 0xc370;
static const uint16 addr_obsthatdothings = 0xc36c;
static const uint16 addr_additionaltext = 0xc368;
static const uint16 addr_describeob = 0xc364;
- static const uint16 addr_obpicture = 0xc360;
static const uint16 addr_examicon = 0xc35c;
- static const uint16 addr_obicons = 0xc358;
static const uint16 addr_openob = 0xc354;
- static const uint16 addr_showryanpage = 0xc350;
static const uint16 addr_openinv = 0xc34c;
static const uint16 addr_incryanpage = 0xc348;
static const uint16 addr_getbackfromob = 0xc344;
static const uint16 addr_makemainscreen = 0xc340;
static const uint16 addr_examineob = 0xc33c;
- static const uint16 addr_makeworn = 0xc338;
- static const uint16 addr_isitworn = 0xc334;
- static const uint16 addr_obtoinv = 0xc330;
static const uint16 addr_findallopen = 0xc32c;
- static const uint16 addr_findallryan = 0xc328;
static const uint16 addr_fillopen = 0xc324;
- static const uint16 addr_fillryan = 0xc320;
static const uint16 addr_monprint = 0xc314;
static const uint16 addr_realcredits = 0xc2f8;
static const uint16 addr_set16colpalette = 0xc2f4;
@@ -562,20 +535,13 @@ public:
static const uint16 addr_dofade = 0xc24c;
static const uint16 addr_fadedos = 0xc248;
static const uint16 addr_transfermap = 0xc244;
- static const uint16 addr_transferinv = 0xc240;
- static const uint16 addr_delthisone = 0xc214;
static const uint16 addr_doshake = 0xc20c;
static const uint16 addr_vsync = 0xc208;
static const uint16 addr_createpanel2 = 0xc200;
static const uint16 addr_createpanel = 0xc1fc;
- static const uint16 addr_pixelcheckset = 0xc1f8;
- static const uint16 addr_dumpmap = 0xc1f4;
- static const uint16 addr_maptopanel = 0xc1f0;
- static const uint16 addr_paneltomap = 0xc1ec;
static const uint16 addr_setmode = 0xc1dc;
static const uint16 addr_loadpalfromiff = 0xc1d8;
static const uint16 addr_showpcx = 0xc1cc;
- static const uint16 addr_dumpeverything = 0xc1c4;
static const uint16 addr_deleverything = 0xc1c0;
static const uint16 addr_reconstruct = 0xc1ac;
static const uint16 addr_soundonreels = 0xc1a8;
@@ -585,7 +551,6 @@ public:
static const uint16 addr_random = 0xc17c;
static const uint16 addr_liftnoise = 0xc178;
static const uint16 addr_backobject = 0xc170;
- static const uint16 addr_getblockofpixel = 0xc168;
static const uint16 addr_splitintolines = 0xc164;
static const uint16 addr_initrain = 0xc160;
static const uint16 addr_reminders = 0xc15c;
@@ -595,9 +560,7 @@ public:
static const uint16 addr_adjustdown = 0xc14c;
static const uint16 addr_checkforexit = 0xc148;
static const uint16 addr_mainman = 0xc138;
- static const uint16 addr_delsprite = 0xc11c;
static const uint16 addr_checkspeed = 0xc110;
- static const uint16 addr_addtopeoplelist = 0xc108;
static const uint16 addr_train = 0xc104;
static const uint16 addr_sparky = 0xc100;
static const uint16 addr_copper = 0xc0fc;
@@ -671,7 +634,6 @@ public:
static const uint16 offset_openchangesize = 0x0a1c;
static const uint16 offset_keys = 0x0b14;
static const uint16 offset_mainlist2 = 0x1440;
- static const uint16 offset_uselist = 0x0ba8;
static const uint16 offset_gameerror2 = 0x0fb2;
static const uint16 offset_loadlist = 0x0ef0;
static const uint16 offset_gameerror6 = 0x10be;
@@ -1289,7 +1251,6 @@ public:
void uselighter();
void showmenu();
void usepoolreader();
- void showgroup();
void startdmablock();
void useopenbox();
void clearbuffers();
@@ -1297,12 +1258,13 @@ public:
void neterror();
void storeit();
//void lockeddoorway();
- void isitworn();
+ //void isitworn();
//void putundertimed();
- void dumpmap();
+ //void dumpmap();
//void multidump();
void channel0only();
void worktoscreenm();
+ //void obicons();
void removeemm();
//void frameoutbh();
void getobtextstart();
@@ -1318,10 +1280,10 @@ public:
void buttonenter();
void checkinput();
//void crosshair();
- void bresenhams();
+ void setmode();
void getbackfromops();
//void frameoutv();
- void opensarters();
+ void showbyte();
void screenupdate();
//void addlength();
void wornerror();
@@ -1333,13 +1295,13 @@ public:
void mainscreen();
void watchreel();
void showfolder();
- void turnanypathoff();
+ //void turnanypathoff();
void openfilefromc();
void gettime();
//void clearwork();
void loadtraveltext();
//void worktoscreen();
- void getexpos();
+ //void getexpos();
void fadedos();
//void fillspace();
void selectlocation();
@@ -1358,7 +1320,7 @@ public:
void opentomb();
//void makename();
void buttonfour();
- void dosometalk();
+ void restoreall();
//void lockmon();
//void dochange();
void getanyaddir();
@@ -1370,7 +1332,7 @@ public:
void showdiscops();
void advisor();
void additionaltext();
- //void kernchars();
+ //void compare();
void othersmoker();
void dofade();
//void setuptimedtemp();
@@ -1414,10 +1376,10 @@ public:
void showdiary();
void purgealocation();
//void updatepeople();
- void addtopeoplelist();
+ //void addtopeoplelist();
void hangoncurs();
- void sparkydrip();
- void compare();
+ //void getblockofpixel();
+ //void kernchars();
void printcurs();
//void convertkey();
void outofopen();
@@ -1434,7 +1396,6 @@ public:
//void cancelch1();
void loadold();
void loadtempcharset();
- void showbyte();
void useslab();
void dumpzoom();
//void aboutturn();
@@ -1460,8 +1421,7 @@ public:
void selectslot2();
void runtap();
//void domix();
- void priesttext();
- void paneltomap();
+ //void paneltomap();
//void obname();
void getridoftemp3();
void getridoftemp2();
@@ -1469,12 +1429,12 @@ public:
void runendseq();
void dumpdiarykeys();
void disablesoundint();
- void checkifset();
- void showallex();
+ void priesttext();
+ //void showallex();
void openpoolboss();
void buttontwo();
//void usetimedtext();
- void delsprite();
+ //void delsprite();
//void getroomspaths();
//void dumptextline();
void fadescreendownhalf();
@@ -1482,7 +1442,7 @@ public:
void candles1();
void lookininterface();
void manasleep();
- void isitdescribed();
+ //void isitdescribed();
void hotelbell();
void loadspeech();
void interupttest();
@@ -1507,7 +1467,7 @@ public:
void checkspeed();
//void printchar();
void showkeypad();
- void obtoinv();
+ //void obtoinv();
//void getroomdata();
void removeobfrominv();
void usecoveredbox();
@@ -1524,7 +1484,7 @@ public:
void usetempcharset();
void discops();
//void printdirect();
- void delthisone();
+ //void delthisone();
//void makebackob();
void middlepanel();
void dumpwatch();
@@ -1534,21 +1494,21 @@ public:
void entersymbol();
void showword();
void dirfile();
- void setmode();
+ //void bresenhams();
//void walktotext();
void pickupconts();
void locklightoff();
void wearwatch();
void runintroseq();
//void doblocks();
- void restoreall();
+ void opensarters();
//void delpointer();
void attendant();
void nextsymbol();
void monks2text();
void clearpalette();
void cantdrop();
- void maptopanel();
+ //void maptopanel();
//void calcmapad();
void getridofall();
void copper();
@@ -1571,8 +1531,8 @@ public:
void vsync();
//void finishedwalking();
void findinvpos();
- void usetext();
- void hangonpq();
+ void dumpmenu();
+ //void examineobtext();
void liftnoise();
void workoutframes();
void getbackfromob();
@@ -1588,7 +1548,7 @@ public:
void getkeyandlogo();
void selectob();
//void checkcoords();
- void dumpmenu();
+ //void usetext();
void chewy();
void accesslighton();
void useplinth();
@@ -1598,7 +1558,7 @@ public:
void usecooker();
void loadmenu();
void checkforemm();
- void checkifpathison();
+ //void checkifpathison();
//void finalframe();
void receptionist();
void selectslot();
@@ -1615,7 +1575,7 @@ public:
void errormessage3();
//void deletetaken();
void putundermenu();
- void checkifex();
+ void intromonks2();
void intromagic2();
void intromagic3();
void edeninbath();
@@ -1630,12 +1590,12 @@ public:
void playchannel0();
void usemon();
void steady();
- void pixelcheckset();
+ //void pixelcheckset();
void reexfrominv();
void examinventory();
void talk();
void usedryer();
- void dumpeverything();
+ //void dumpeverything();
//void readmouse2();
//void zoom();
void outofinv();
@@ -1645,7 +1605,7 @@ public:
//void readabyte();
//void showframe();
void random();
- void obicons();
+ void mainman();
void mansatstill();
void channel1only();
void checkbasemem();
@@ -1661,16 +1621,17 @@ public:
void purgeanitem();
void madman();
void createpanel();
- void turnpathon();
+ //void turnpathon();
void enablesoundint();
void madmanstelly();
void constant();
void loadroomssample();
- void getblockofpixel();
+ void sparkydrip();
void paltostartpal();
void bossman();
void getridofpit();
void convnum();
+ //void checkifset();
void nothelderror();
//void readheader();
void getsetad();
@@ -1691,8 +1652,8 @@ public:
//void showallfree();
void loadnews();
void rollem();
- void makeworn();
- void examineobtext();
+ //void makeworn();
+ void hangonpq();
void startup();
void savegame();
void startpaltoend();
@@ -1745,7 +1706,7 @@ public:
void initialinv();
void quitsymbol();
//void modifychar();
- void hangon();
+ //void initman();
void settopright();
void findsetobject();
void singlekey();
@@ -1775,15 +1736,16 @@ public:
void dropobject();
void isitright();
void reexfromopen();
- void fillryan();
+ //void fillryan();
void drawitall();
void usestereo();
void showcurrentfile();
+ //void turnpathoff();
//void copyname();
void look();
void setmouse();
//void checkone();
- void transferinv();
+ //void transferinv();
void candles2();
void pickupob();
void error();
@@ -1843,10 +1805,10 @@ public:
void gates();
void newgame();
void showwatch();
- void turnanypathon();
+ //void turnanypathon();
void restorereels();
void setwalk();
- void useroutine();
+ //void useroutine();
void zoomicon();
//void findlen();
void findpathofpoint();
@@ -1863,7 +1825,7 @@ public:
void read();
void fadescreenups();
//void checkdest();
- //void initman();
+ //void hangon();
void loadpalfromiff();
//void facerightway();
void startup1();
@@ -1876,7 +1838,7 @@ public:
void settopleft();
void searchforstring();
//void clearsprites();
- void obpicture();
+ //void obpicture();
void selectopenob();
//void widedoor();
void security();
@@ -1885,7 +1847,7 @@ public:
void soundonreels();
void usegun();
void autoappear();
- void findnextcolon();
+ //void findnextcolon();
//void readmouse4();
void openryan();
void callhotellift();
@@ -1931,6 +1893,7 @@ public:
void delcurs();
void randomaccess();
void splitintolines();
+ //void checkifex();
//void findobname();
void initialmoncols();
void checkforshake();
@@ -1954,14 +1917,13 @@ public:
void usecontrol();
void buttonseven();
void redrawmainscrn();
- void turnpathoff();
- void findallryan();
+ void showgroup();
+ //void findallryan();
//void channel0tran();
void buttonpress();
//void parseblaster();
//void readmouse1();
void makemainscreen();
- void intromonks2();
void usewinch();
void setbotright();
//void readmouse3();
@@ -1975,7 +1937,7 @@ public:
//void drawflags();
void zoomonoff();
void updatesymboltop();
- void showryanpage();
+ //void showryanpage();
void printlogo();
void allpointer();
void showseconduse();
@@ -1990,7 +1952,7 @@ public:
void parser();
void hangonw();
void intro();
- void hangonp();
+ //void hangonp();
void fadescreendowns();
void openhoteldoor2();
void getridoftempsp();
@@ -2007,6 +1969,7 @@ public:
void emergencypurge();
void usemenu();
void alleybarksound();
+ void dosometalk();
void usecart();
void intromusic();
void quitkey();
@@ -2017,7 +1980,7 @@ public:
void loadsecondsample();
void transfercontoex();
//void multiput();
- void printmessage();
+ //void printmessage();
void businessman();
void switchryanoff();
//void commandwithob();
@@ -2030,7 +1993,6 @@ public:
void accesslightoff();
void usehole();
void useobject();
- void mainman();
void volumeadjust();
//void checkiffree();
};
diff --git a/engines/dreamweb/module.mk b/engines/dreamweb/module.mk
index bdacbe79f3..8cacbdc91e 100644
--- a/engines/dreamweb/module.mk
+++ b/engines/dreamweb/module.mk
@@ -11,6 +11,7 @@ MODULE_OBJS := \
saveload.o \
sprite.o \
stubs.o \
+ use.o \
vgagrafx.o
# This module can be built as a plugin
diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp
index 2579105c6f..d367f02d15 100644
--- a/engines/dreamweb/pathfind.cpp
+++ b/engines/dreamweb/pathfind.cpp
@@ -21,50 +21,69 @@
*/
#include "dreamweb/dreamweb.h"
-#include "engines/util.h"
-#include "graphics/surface.h"
-#include "common/config-manager.h"
namespace DreamGen {
-void DreamGenContext::turnpathonCPP(uint8 param) {
- al = param;
- push(es);
- push(bx);
- turnpathon();
- bx = pop();
- es = pop();
+void DreamGenContext::turnpathon() {
+ turnpathon(al);
}
-void DreamGenContext::turnpathoffCPP(uint8 param) {
- al = param;
- push(es);
- push(bx);
- turnpathoff();
- bx = pop();
- es = pop();
+void DreamGenContext::turnpathon(uint8 param) {
+ findormake(param, 0xff, data.byte(kRoomnum) + 100);
+ PathNode *roomsPaths = getroomspaths()->nodes;
+ if (param == 0xff)
+ return;
+ roomsPaths[param].on = 0xff;
+}
+
+void DreamGenContext::turnpathoff() {
+ turnpathoff(al);
}
-void DreamGenContext::getroomspaths() {
- es = data.word(kReels);
- bx = data.byte(kRoomnum) * 144;
+void DreamGenContext::turnpathoff(uint8 param) {
+ findormake(param, 0x00, data.byte(kRoomnum) + 100);
+ PathNode *roomsPaths = getroomspaths()->nodes;
+ if (param == 0xff)
+ return;
+ roomsPaths[param].on = 0x00;
+}
+
+void DreamGenContext::turnanypathon(uint8 param, uint8 room) {
+ findormake(param, 0xff, room + 100);
+ PathNode *paths = (PathNode *)segRef(data.word(kReels)).ptr(kPathdata + 144 * room, 0);
+ paths[param].on = 0xff;
+}
+
+
+void DreamGenContext::turnanypathon() {
+ turnanypathon(al, ah);
}
-uint8 *DreamGenContext::getroomspathsCPP() {
+void DreamGenContext::turnanypathoff(uint8 param, uint8 room) {
+ findormake(param, 0x00, room + 100);
+ PathNode *paths = (PathNode *)segRef(data.word(kReels)).ptr(kPathdata + 144 * room, 0);
+ paths[param].on = 0x00;
+}
+
+void DreamGenContext::turnanypathoff() {
+ turnanypathoff(al, ah);
+}
+
+RoomPaths *DreamGenContext::getroomspaths() {
void *result = segRef(data.word(kReels)).ptr(data.byte(kRoomnum) * 144, 144);
- return (uint8 *)result;
+ return (RoomPaths *)result;
}
void DreamGenContext::autosetwalk() {
al = data.byte(kManspath);
if (data.byte(kFinaldest) == al)
return;
- const uint8 *roomsPaths = getroomspathsCPP();
+ const RoomPaths *roomsPaths = getroomspaths();
checkdest(roomsPaths);
- data.word(kLinestartx) = roomsPaths[data.byte(kManspath) * 8 + 0] - 12;
- data.word(kLinestarty) = roomsPaths[data.byte(kManspath) * 8 + 1] - 12;
- data.word(kLineendx) = roomsPaths[data.byte(kDestination) * 8 + 0] - 12;
- data.word(kLineendy) = roomsPaths[data.byte(kDestination) * 8 + 1] - 12;
+ data.word(kLinestartx) = roomsPaths->nodes[data.byte(kManspath)].x - 12;
+ data.word(kLinestarty) = roomsPaths->nodes[data.byte(kManspath)].y - 12;
+ data.word(kLineendx) = roomsPaths->nodes[data.byte(kDestination)].x - 12;
+ data.word(kLineendy) = roomsPaths->nodes[data.byte(kDestination)].y - 12;
bresenhams();
if (data.byte(kLinedirection) != 0) {
data.byte(kLinepointer) = data.byte(kLinelength) - 1;
@@ -74,32 +93,161 @@ void DreamGenContext::autosetwalk() {
data.byte(kLinepointer) = 0;
}
-void DreamGenContext::checkdest(const uint8 *roomsPaths) {
- const uint8 *p = roomsPaths + 12 * 8;
+void DreamGenContext::checkdest(const RoomPaths *roomsPaths) {
+ const PathSegment *segments = roomsPaths->segments;
ah = data.byte(kManspath) << 4;
al = data.byte(kDestination);
uint8 destination = data.byte(kDestination);
for (size_t i = 0; i < 24; ++i) {
- dh = p[0] & 0xf0;
- dl = p[0] & 0x0f;
+ dh = segments[i].b0 & 0xf0;
+ dl = segments[i].b0 & 0x0f;
if (ax == dx) {
- data.byte(kDestination) = p[1] & 0x0f;
+ data.byte(kDestination) = segments[i].b1 & 0x0f;
return;
}
- dl = (p[0] & 0xf0) >> 4;
- dh = (p[0] & 0x0f) << 4;
+ dl = (segments[i].b0 & 0xf0) >> 4;
+ dh = (segments[i].b0 & 0x0f) << 4;
if (ax == dx) {
- destination = p[1] & 0x0f;
+ destination = segments[i].b1 & 0x0f;
}
- p += 2;
}
data.byte(kDestination) = destination;
}
void DreamGenContext::findxyfrompath() {
- const uint8 *roomsPaths = getroomspathsCPP();
- data.byte(kRyanx) = roomsPaths[data.byte(kManspath) * 8 + 0] - 12;
- data.byte(kRyany) = roomsPaths[data.byte(kManspath) * 8 + 1] - 12;
+ const PathNode *roomsPaths = getroomspaths()->nodes;
+ data.byte(kRyanx) = roomsPaths[data.byte(kManspath)].x - 12;
+ data.byte(kRyany) = roomsPaths[data.byte(kManspath)].y - 12;
+}
+
+void DreamGenContext::checkifpathison() {
+ flags._z = checkifpathison(al);
+}
+
+bool DreamGenContext::checkifpathison(uint8 index) {
+ RoomPaths *roomsPaths = getroomspaths();
+ uint8 pathOn = roomsPaths->nodes[index].on;
+ return pathOn == 0xff;
+}
+
+void DreamGenContext::bresenhams() {
+ workoutframes();
+ int8 *lineData = (int8 *)data.ptr(kLinedata, 0);
+ int16 startX = (int16)data.word(kLinestartx);
+ int16 startY = (int16)data.word(kLinestarty);
+ int16 endX = (int16)data.word(kLineendx);
+ int16 endY = (int16)data.word(kLineendy);
+
+ if (endX == startX) {
+ uint16 deltaY;
+ int8 y;
+ if (endY < startY) {
+ deltaY = startY - endY;
+ y = (int8)endY;
+ data.byte(kLinedirection) = 1;
+ } else {
+ deltaY = endY - startY;
+ y = (int8)startY;
+ data.byte(kLinedirection) = 0;
+ }
+ ++deltaY;
+ int8 x = (int8)startX;
+ data.byte(kLinelength) = deltaY;
+ do {
+ lineData[0] = x;
+ lineData[1] = y;
+ lineData += 2;
+ ++y;
+ --deltaY;
+ } while (deltaY);
+ return;
+ }
+ uint16 deltaX;
+ if (endX < startX) {
+ deltaX = startX - endX;
+ SWAP(startX, endX);
+ SWAP(startY, endY);
+ data.word(kLinestartx) = (uint16)startX;
+ data.word(kLinestarty) = (uint16)startY;
+ data.word(kLineendx) = (uint16)endX;
+ data.word(kLineendy) = (uint16)endY;
+ data.byte(kLinedirection) = 1;
+ } else {
+ deltaX = endX - startX;
+ data.byte(kLinedirection) = 0;
+ }
+
+ int16 increment;
+ if (endY == startY) {
+ int8 x = (int8)startX;
+ int8 y = (int8)startY;
+ ++deltaX;
+ data.byte(kLinelength) = deltaX;
+ do {
+ lineData[0] = x;
+ lineData[1] = y;
+ lineData += 2;
+ ++x;
+ --deltaX;
+ } while (deltaX);
+ return;
+ }
+ uint16 deltaY;
+ if (startY > endY) {
+ deltaY = startY - endY;
+ increment = -1;
+ } else {
+ deltaY = endY - startY;
+ increment = 1;
+ }
+
+ uint16 delta1, delta2;
+ if (deltaY > deltaX) {
+ data.byte(kLineroutine) = 1;
+ delta1 = deltaY;
+ delta2 = deltaX;
+ } else {
+ data.byte(kLineroutine) = 0;
+ delta1 = deltaX;
+ delta2 = deltaY;
+ }
+
+ data.word(kIncrement1) = delta2 * 2;
+ int16 remainder = delta2 * 2 - delta1;
+ data.word(kIncrement2) = delta2 * 2 - delta1 * 2;
+ ++delta1;
+ int8 x = (int8)startX;
+ int8 y = (int8)startY;
+ data.byte(kLinelength) = delta1;
+ if (data.byte(kLineroutine) != 1) {
+ do {
+ lineData[0] = x;
+ lineData[1] = y;
+ lineData += 2;
+ ++x;
+ if (remainder < 0) {
+ remainder += data.word(kIncrement1);
+ } else {
+ remainder += data.word(kIncrement2);
+ y += increment;
+ }
+ --delta1;
+ } while (delta1);
+ } else {
+ do {
+ lineData[0] = x;
+ lineData[1] = y;
+ lineData += 2;
+ y += increment;
+ if (remainder < 0) {
+ remainder += data.word(kIncrement1);
+ } else {
+ remainder += data.word(kIncrement2);
+ ++x;
+ }
+ --delta1;
+ } while (delta1);
+ }
}
} /*namespace dreamgen */
diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp
index c1dbfc0a87..edaf8ee1eb 100644
--- a/engines/dreamweb/print.cpp
+++ b/engines/dreamweb/print.cpp
@@ -21,8 +21,6 @@
*/
#include "dreamweb/dreamweb.h"
-#include "engines/util.h"
-#include "graphics/surface.h"
namespace DreamGen {
@@ -113,6 +111,8 @@ uint8 DreamGenContext::printslow(const uint8 *string, uint16 x, uint16 y, uint8
data.word(kCharshift) = 0;
for (int i=0; i<2; ++i) {
uint16 mouseState = waitframes();
+ if (data.byte(kQuitrequested))
+ return 0;
if (mouseState == 0)
continue;
if (mouseState != data.word(kOldbutton)) {
@@ -138,6 +138,10 @@ void DreamGenContext::printdirect() {
bx = y;
}
+void DreamGenContext::printdirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) {
+ printdirect(&string, x, &y, maxWidth, centered);
+}
+
void DreamGenContext::printdirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered) {
data.word(kLastxpos) = x;
const Frame *charSet = (const Frame *)segRef(data.word(kCurrentset)).ptr(0, 0);
diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp
index 17d4ddbbed..864bba1d8c 100644
--- a/engines/dreamweb/sprite.cpp
+++ b/engines/dreamweb/sprite.cpp
@@ -21,8 +21,6 @@
*/
#include "dreamweb/dreamweb.h"
-#include "engines/util.h"
-#include "graphics/surface.h"
namespace DreamGen {
@@ -90,17 +88,6 @@ Sprite *DreamGenContext::makesprite(uint8 x, uint8 y, uint16 updateCallback, uin
return sprite;
}
-void DreamGenContext::makesprite() { // NB: returns new sprite in es:bx
- Sprite *sprite = makesprite(si & 0xff, si >> 8, cx, dx, di);
-
- // Recover es:bx from sprite
- es = data.word(kBuffers);
- bx = kSpritetable;
- Sprite *sprites = (Sprite *)es.ptr(bx, sizeof(Sprite) * 16);
- bx += sizeof(Sprite) * (sprite - sprites);
- //
-}
-
void DreamGenContext::spriteupdate() {
Sprite *sprites = spritetable();
sprites[0].hidden = data.byte(kRyanon);
@@ -297,7 +284,7 @@ void DreamGenContext::constant(Sprite *sprite, SetObject *objData) {
sprite->frame = 0;
}
uint8 b18 = objData->b18[sprite->frame];
- objData->b17 = b18;
+ objData->index = b18;
sprite->b15 = b18;
}
@@ -361,7 +348,7 @@ void DreamGenContext::dodoor(Sprite *sprite, SetObject *objData) {
if (objData->b18[sprite->frame] == 255) {
--sprite->frame;
}
- sprite->b15 = objData->b17 = objData->b18[sprite->frame];
+ sprite->b15 = objData->index = objData->b18[sprite->frame];
data.byte(kThroughdoor) = 1;
return;
shutdoor:
@@ -375,14 +362,14 @@ shutdoor:
if (sprite->frame != 0) {
--sprite->frame;
}
- sprite->b15 = objData->b17 = objData->b18[sprite->frame];
+ sprite->b15 = objData->index = objData->b18[sprite->frame];
if (sprite->frame == 5) //nearly
data.byte(kThroughdoor) = 0;
}
void DreamGenContext::steady(Sprite *sprite, SetObject *objData) {
uint8 b18 = objData->b18[0];
- objData->b17 = b18;
+ objData->index = b18;
sprite->b15 = b18;
}
@@ -414,7 +401,7 @@ void DreamGenContext::lockeddoorway(Sprite *sprite, SetObject *objData) {
}
if (sprite->frame == 6) {
- turnpathonCPP(data.byte(kDoorpath));
+ turnpathon(data.byte(kDoorpath));
}
if ((data.byte(kThroughdoor) == 1) && (sprite->frame == 0)) {
@@ -426,7 +413,7 @@ void DreamGenContext::lockeddoorway(Sprite *sprite, SetObject *objData) {
--sprite->frame;
}
- sprite->b15 = objData->b17 = objData->b18[sprite->frame];
+ sprite->b15 = objData->index = objData->b18[sprite->frame];
if (sprite->frame == 5)
data.byte(kThroughdoor) = 1;
return;
@@ -442,10 +429,10 @@ shutdoor2:
}
data.byte(kThroughdoor) = 0;
- sprite->b15 = objData->b17 = objData->b18[sprite->frame];
+ sprite->b15 = objData->index = objData->b18[sprite->frame];
if (sprite->frame == 0) {
- turnpathoffCPP(data.byte(kDoorpath));
+ turnpathoff(data.byte(kDoorpath));
data.byte(kLockstatus) = 1;
}
}
@@ -453,7 +440,7 @@ shutdoor2:
void DreamGenContext::liftsprite(Sprite *sprite, SetObject *objData) {
uint8 liftFlag = data.byte(kLiftflag);
if (liftFlag == 0) { //liftclosed
- turnpathoffCPP(data.byte(kLiftpath));
+ turnpathoff(data.byte(kLiftpath));
if (data.byte(kCounttoopen) != 0) {
_dec(data.byte(kCounttoopen));
@@ -461,10 +448,10 @@ void DreamGenContext::liftsprite(Sprite *sprite, SetObject *objData) {
data.byte(kLiftflag) = 3;
}
sprite->frame = 0;
- sprite->b15 = objData->b17 = objData->b18[sprite->frame];
+ sprite->b15 = objData->index = objData->b18[sprite->frame];
}
else if (liftFlag == 1) { //liftopen
- turnpathonCPP(data.byte(kLiftpath));
+ turnpathon(data.byte(kLiftpath));
if (data.byte(kCounttoclose) != 0) {
_dec(data.byte(kCounttoclose));
@@ -472,7 +459,7 @@ void DreamGenContext::liftsprite(Sprite *sprite, SetObject *objData) {
data.byte(kLiftflag) = 2;
}
sprite->frame = 12;
- sprite->b15 = objData->b17 = objData->b18[sprite->frame];
+ sprite->b15 = objData->index = objData->b18[sprite->frame];
}
else if (liftFlag == 3) { //openlift
if (sprite->frame == 12) {
@@ -484,7 +471,7 @@ void DreamGenContext::liftsprite(Sprite *sprite, SetObject *objData) {
al = 2;
liftnoise();
}
- sprite->b15 = objData->b17 = objData->b18[sprite->frame];
+ sprite->b15 = objData->index = objData->b18[sprite->frame];
} else { //closeLift
assert(liftFlag == 2);
if (sprite->frame == 0) {
@@ -496,13 +483,13 @@ void DreamGenContext::liftsprite(Sprite *sprite, SetObject *objData) {
al = 3;
liftnoise();
}
- sprite->b15 = objData->b17 = objData->b18[sprite->frame];
+ sprite->b15 = objData->index = objData->b18[sprite->frame];
}
}
void DreamGenContext::facerightway() {
- uint8 *paths = getroomspathsCPP();
- uint8 dir = paths[8 * data.byte(kManspath) + 7];
+ PathNode *paths = getroomspaths()->nodes;
+ uint8 dir = paths[data.byte(kManspath)].dir;
data.byte(kTurntoface) = dir;
data.byte(kLeavedirection) = dir;
}
@@ -549,16 +536,16 @@ void DreamGenContext::showreelframe(Reel *reel) {
}
void DreamGenContext::showgamereel() {
- uint16 reelpointer = es.word(bx+3);
+ showgamereel((ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine)));
+}
+
+void DreamGenContext::showgamereel(ReelRoutine *routine) {
+ uint16 reelpointer = routine->reelPointer();
if (reelpointer >= 512)
return;
data.word(kReelpointer) = reelpointer;
- push(es);
- push(bx);
plotreel();
- bx = pop();
- es = pop();
- es.word(bx+3) = data.word(kReelpointer);
+ routine->setReelPointer(data.word(kReelpointer));
}
const Frame *DreamGenContext::getreelframeax(uint16 frame) {
@@ -889,5 +876,32 @@ void DreamGenContext::checkone(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uin
*type = tileData[2];
}
+void DreamGenContext::getblockofpixel() {
+ al = getblockofpixel(cl, ch);
+}
+
+uint8 DreamGenContext::getblockofpixel(uint8 x, uint8 y) {
+ uint8 flag, flagEx, type, flagX, flagY;
+ checkone(x + data.word(kMapxstart), y + data.word(kMapystart), &flag, &flagEx, &type, &flagX, &flagY);
+ if (flag & 1)
+ return 0;
+ else
+ return type;
+}
+
+void DreamGenContext::addtopeoplelist() {
+ addtopeoplelist((ReelRoutine *)es.ptr(bx, sizeof(ReelRoutine)));
+}
+
+void DreamGenContext::addtopeoplelist(ReelRoutine *routine) {
+ uint16 routinePointer = (const uint8 *)routine - cs.ptr(0, 0);
+
+ People *people = (People *)segRef(data.word(kBuffers)).ptr(data.word(kListpos), sizeof(People));
+ people->setReelPointer(routine->reelPointer());
+ people->setRoutinePointer(routinePointer);
+ people->b4 = routine->b7;
+ data.word(kListpos) += sizeof(People);
+}
+
} /*namespace dreamgen */
diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h
index 1cb52eccea..0d7bbb6cbf 100644
--- a/engines/dreamweb/structs.h
+++ b/engines/dreamweb/structs.h
@@ -85,7 +85,7 @@ struct SetObject {
uint8 b11;
uint8 name[4];
uint8 b16;
- uint8 b17;
+ uint8 index;
uint8 b18[13]; // NB: Don't know the size yet
uint8 b31;
uint8 b32;
@@ -114,23 +114,19 @@ struct SetObject {
uint8 b55;
uint8 b56;
uint8 b57;
- uint8 b58[5];
+ uint8 mapad[5];
uint8 b63;
};
struct DynObject {
- uint8 b0;
+ uint8 currentLocation;
uint8 index;
- uint8 b2;
- uint8 b3;
- uint8 b4;
- uint8 b5;
- uint8 b6;
+ uint8 mapad[5];
uint8 b7;
uint8 b8;
uint8 b9;
uint8 b10;
- uint8 location;
+ uint8 initialLocation;
uint8 id[4];
};
@@ -168,6 +164,8 @@ struct ReelRoutine {
uint8 mapY;
uint8 b3;
uint8 b4;
+ uint16 reelPointer() const { return READ_LE_UINT16(&b3); }
+ void setReelPointer(uint16 v) { WRITE_LE_UINT16(&b3, v); }
uint8 b5;
uint8 b6;
uint8 b7;
@@ -176,12 +174,12 @@ struct ReelRoutine {
struct People {
uint8 b0;
uint8 b1;
- uint16 w0() const { return READ_LE_UINT16(&b0); }
- void setW0(uint16 v) { WRITE_LE_UINT16(&b0, v); }
+ uint16 reelPointer() const { return READ_LE_UINT16(&b0); }
+ void setReelPointer(uint16 v) { WRITE_LE_UINT16(&b0, v); }
uint8 b2;
uint8 b3;
- uint16 w2() const { return READ_LE_UINT16(&b2); }
- void setW2(uint16 v) { WRITE_LE_UINT16(&b2, v); }
+ uint16 routinePointer() const { return READ_LE_UINT16(&b2); }
+ void setRoutinePointer(uint16 v) { WRITE_LE_UINT16(&b2, v); }
uint8 b4;
};
@@ -230,4 +228,24 @@ struct Change {
uint8 type;
};
+struct PathNode {
+ uint8 x;
+ uint8 y;
+ uint8 b2;
+ uint8 b3;
+ uint8 b4;
+ uint8 b5;
+ uint8 on;
+ uint8 dir;
+};
+
+struct PathSegment {
+ uint8 b0;
+ uint8 b1;
+};
+
+struct RoomPaths {
+ PathNode nodes[12];
+ PathSegment segments[24];
+};
diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp
index 9b85cbb9f4..acba57ae87 100644
--- a/engines/dreamweb/stubs.cpp
+++ b/engines/dreamweb/stubs.cpp
@@ -22,7 +22,6 @@
#include "dreamweb/dreamweb.h"
#include "engines/util.h"
-#include "graphics/surface.h"
#include "common/config-manager.h"
namespace DreamGen {
@@ -145,8 +144,7 @@ void DreamGenContext::dreamweb() {
// "endofgame"
clearbeforeload();
fadescreendowns();
- cx = 200;
- hangon();
+ hangon(200);
endgame();
quickquit2();
return;
@@ -186,8 +184,7 @@ void DreamGenContext::dreamweb() {
clearbeforeload();
showgun();
fadescreendown();
- cx = 100;
- hangon();
+ hangon(100);
}
}
@@ -935,7 +932,11 @@ void DreamGenContext::plotreel() {
showreelframe(reel);
++reel;
}
+ push(es);
+ push(bx);
soundonreels();
+ bx = pop();
+ es = pop();
}
void DreamGenContext::crosshair() {
@@ -981,7 +982,7 @@ bool DreamGenContext::checkifperson(uint8 x, uint8 y) {
for (size_t i = 0; i < 12; ++i, ++people) {
if (people->b4 == 255)
continue;
- data.word(kReelpointer) = people->w0();
+ data.word(kReelpointer) = people->reelPointer();
Reel *reel = getreelstart();
if (reel->frame() == 0xffff)
++reel;
@@ -998,7 +999,7 @@ bool DreamGenContext::checkifperson(uint8 x, uint8 y) {
continue;
if (y >= ymax)
continue;
- data.word(kPersondata) = people->w2();
+ data.word(kPersondata) = people->routinePointer();
obname(people->b4, 5);
return true;
}
@@ -1029,6 +1030,30 @@ bool DreamGenContext::checkiffree(uint8 x, uint8 y) {
return false;
}
+void DreamGenContext::checkifex() {
+ flags._z = not checkifex(al, ah);
+}
+
+bool DreamGenContext::checkifex(uint8 x, uint8 y) {
+ const ObjPos *exList = (const ObjPos *)segRef(data.word(kBuffers)).ptr(kExlist, 100 * sizeof(ObjPos));
+ for (size_t i = 0; i < 100; ++i) {
+ const ObjPos *objPos = exList + 99 - i;
+ if (objPos->index == 0xff)
+ continue;
+ if (x < objPos->xMin)
+ continue;
+ if (x >= objPos->xMax)
+ continue;
+ if (y < objPos->yMin)
+ continue;
+ if (y >= objPos->yMax)
+ continue;
+ obname(objPos->index, 4);
+ return true;
+ }
+ return false;
+}
+
const uint8 *DreamGenContext::findobname(uint8 type, uint8 index) {
if (type == 5) {
uint16 i = 64 * 2 * (index & 127);
@@ -1077,22 +1102,21 @@ void DreamGenContext::commandwithob(uint8 command, uint8 type, uint8 index) {
uint16 commandText = kTextstart + segRef(data.word(kCommandtext)).word(command * 2);
uint8 textLen = data.byte(kTextlen);
{
- uint16 y = data.word(kTextaddressy);
const uint8 *string = segRef(data.word(kCommandtext)).ptr(commandText, 0);
- printdirect(&string, data.word(kTextaddressx), &y, textLen, (bool)(textLen & 1));
+ printdirect(string, data.word(kTextaddressx), data.word(kTextaddressy), textLen, (bool)(textLen & 1));
}
copyname(type, index, commandLine);
uint16 x = data.word(kLastxpos);
if (command != 0)
x += 5;
- {
- uint16 y = data.word(kTextaddressy);
- const uint8 *string = commandLine;
- printdirect(&string, x, &y, textLen, (bool)(textLen & 1));
- }
+ printdirect(commandLine, x, data.word(kTextaddressy), textLen, (bool)(textLen & 1));
data.byte(kNewtextline) = 1;
}
+void DreamGenContext::examineobtext() {
+ commandwithob(1, data.byte(kCommandtype), data.byte(kCommand));
+}
+
void DreamGenContext::showpanel() {
Frame *frame = (Frame *)segRef(data.word(kIcons1)).ptr(0, sizeof(Frame));
showframe(frame, 72, 0, 19, 0);
@@ -1160,6 +1184,34 @@ DynObject *DreamGenContext::geteitheradCPP() {
return getfreead(data.byte(kItemframe));
}
+void *DreamGenContext::getanyad(uint8 *value1, uint8 *value2) {
+ if (data.byte(kObjecttype) == 4) {
+ DynObject *exObject = getexad(data.byte(kCommand));
+ *value1 = exObject->b7;
+ *value2 = exObject->b8;
+ return exObject;
+ } else if (data.byte(kObjecttype) == 2) {
+ DynObject *freeObject = getfreead(data.byte(kCommand));
+ *value1 = freeObject->b7;
+ *value2 = freeObject->b8;
+ return freeObject;
+ } else {
+ SetObject *setObject = getsetad(data.byte(kCommand));
+ *value1 = setObject->b4;
+ *value2 = setObject->priority;
+ return setObject;
+ }
+}
+
+void *DreamGenContext::getanyaddir(uint8 index, uint8 flag) {
+ if (flag == 4)
+ return getexad(index);
+ else if (flag == 2)
+ return getfreead(index);
+ else
+ return getsetad(index);
+}
+
SetObject *DreamGenContext::getsetad(uint8 index) {
return (SetObject *)segRef(data.word(kSetdat)).ptr(0, 0) + index;
}
@@ -1170,11 +1222,11 @@ void DreamGenContext::dochange() {
void DreamGenContext::dochange(uint8 index, uint8 value, uint8 type) {
if (type == 0) { //object
- getsetad(index)->b58[0] = value;
+ getsetad(index)->mapad[0] = value;
} else if (type == 1) { //freeobject
DynObject *freeObject = getfreead(index);
- if (freeObject->b2 == 0xff)
- freeObject->b2 = value;
+ if (freeObject->mapad[0] == 0xff)
+ freeObject->mapad[0] = value;
} else { //path
bx = kPathdata + (type - 100) * 144 + index * 8;
es = data.word(kReels);
@@ -1186,12 +1238,26 @@ void DreamGenContext::deletetaken() {
const DynObject *extraObjects = (const DynObject *)segRef(data.word(kExtras)).ptr(kExdata, 0);
DynObject *freeObjects = (DynObject *)segRef(data.word(kFreedat)).ptr(0, 0);
for(size_t i = 0; i < kNumexobjects; ++i) {
- uint8 location = extraObjects[i].location;
+ uint8 location = extraObjects[i].initialLocation;
if (location == data.byte(kReallocation)) {
uint8 index = extraObjects[i].index;
- freeObjects[index].b2 = 254;
+ freeObjects[index].mapad[0] = 0xfe;
+ }
+ }
+}
+
+void DreamGenContext::getexpos() {
+ es = data.word(kExtras);
+ const DynObject *objects = (const DynObject *)segRef(data.word(kExtras)).ptr(kExdata, sizeof(DynObject));
+ for (size_t i = 0; i < kNumexobjects; ++i) {
+ if (objects[i].mapad[0] == 0xff) {
+ data.byte(kExpos) = i;
+ di = kExdata + i * sizeof(DynObject);
+ return;
}
}
+ data.byte(kExpos) = kNumexobjects;
+ di = kExdata + kNumexobjects * sizeof(DynObject);
}
void DreamGenContext::placesetobject() {
@@ -1200,7 +1266,7 @@ void DreamGenContext::placesetobject() {
void DreamGenContext::placesetobject(uint8 index) {
findormake(index, 0, 0);
- getsetad(index)->b58[0] = 0;
+ getsetad(index)->mapad[0] = 0;
}
void DreamGenContext::removesetobject() {
@@ -1209,7 +1275,7 @@ void DreamGenContext::removesetobject() {
void DreamGenContext::removesetobject(uint8 index) {
findormake(index, 0xff, 0);
- getsetad(index)->b58[0] = 0xff;
+ getsetad(index)->mapad[0] = 0xff;
}
void DreamGenContext::finishedwalking() {
@@ -1544,9 +1610,11 @@ void DreamGenContext::showpointer() {
height = 12;
data.byte(kPointerxs) = width;
data.byte(kPointerys) = height;
- data.word(kOldpointerx) -= width / 2;
- data.word(kOldpointery) -= height / 2;
- multiget(segRef(data.word(kBuffers)).ptr(kPointerback, 0), x - width / 2, y - height / 2, width, height);
+ uint16 xMin = (x >= width / 2) ? x - width / 2 : 0;
+ uint16 yMin = (y >= height / 2) ? y - height / 2 : 0;
+ data.word(kOldpointerx) = xMin;
+ data.word(kOldpointery) = yMin;
+ multiget(segRef(data.word(kBuffers)).ptr(kPointerback, 0), xMin, yMin, width, height);
showframe(frames, x, y, 3 * data.byte(kItemframe) + 1, 128);
showframe(icons1, x, y, 3, 128);
} else {
@@ -1618,6 +1686,59 @@ void DreamGenContext::animpointer() {
data.byte(kPointerframe) = 8;
}
+void DreamGenContext::printmessage() {
+ printmessage(di, bx, al, dl, (bool)(dl & 1));
+}
+
+void DreamGenContext::printmessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) {
+ uint16 offset = kTextstart + segRef(data.word(kCommandtext)).word(index * 2);
+ const uint8 *string = segRef(data.word(kCommandtext)).ptr(offset, 0);
+ printdirect(&string, x, &y, maxWidth, centered);
+}
+
+void DreamGenContext::obpicture() {
+ if (data.byte(kObjecttype) == 1)
+ return;
+ Frame *frames;
+ if (data.byte(kObjecttype) == 4)
+ frames = (Frame *)segRef(data.word(kExtras)).ptr(0, 0);
+ else
+ frames = (Frame *)segRef(data.word(kFreeframes)).ptr(0, 0);
+ uint8 frame = 3 * data.byte(kCommand) + 1;
+ showframe(frames, 160, 68, frame, 0x80);
+}
+
+void DreamGenContext::obicons() {
+ uint8 value1, value2;
+ getanyad(&value1, &value2);
+ if (value1 == 0xff) {
+ showframe((Frame *)segRef(data.word(kIcons2)).ptr(0, 0), 260, 1, 1, 0);
+ } else {
+ showframe((Frame *)segRef(data.word(kIcons2)).ptr(0, 0), 210, 1, 4, 0);
+ }
+}
+
+void DreamGenContext::compare() {
+ char id[4] = { cl, ch, dl, dh };
+ flags._z = compare(al, ah, id);
+}
+
+bool DreamGenContext::compare(uint8 index, uint8 flag, const char id[4]) {
+ void *ptr = getanyaddir(index, flag);
+ const char *objId = (const char *)(((const uint8 *)ptr) + 12); // whether it is a DynObject or a SetObject
+ for (size_t i = 0; i < 4; ++i) {
+ if(id[i] != objId[i] + 'A')
+ return false;
+ }
+ return true;
+}
+
+bool DreamGenContext::isitdescribed(const ObjPos *pos) {
+ uint16 offset = segRef(data.word(kSetdesc)).word(kSettextdat + pos->index * 2);
+ uint8 result = segRef(data.word(kSetdesc)).byte(kSettext + offset);
+ return result != 0;
+}
+
bool DreamGenContext::isCD() {
// The original sources has two codepaths depending if the game is 'if cd' or not
// This is a hack to guess which version to use with the assumption that if we have a cd version
@@ -1625,5 +1746,186 @@ bool DreamGenContext::isCD() {
// Maybe detect the version during game id?
return (data.byte(kSpeechloaded) == 1);
}
+
+void DreamGenContext::checkifset() {
+ flags._z = !checkifset(al, ah);
+}
+
+bool DreamGenContext::checkifset(uint8 x, uint8 y) {
+ const ObjPos *setList = (const ObjPos *)segRef(data.word(kBuffers)).ptr(kSetlist, sizeof(ObjPos) * 128);
+ for (size_t i = 0; i < 128; ++i) {
+ const ObjPos *pos = setList + 127 - i;
+ if (pos->index == 0xff)
+ continue;
+ if (x < pos->xMin)
+ continue;
+ if (x >= pos->xMax)
+ continue;
+ if (y < pos->yMin)
+ continue;
+ if (y >= pos->yMax)
+ continue;
+ if (! pixelcheckset(pos, x, y))
+ continue;
+ if (! isitdescribed(pos))
+ continue;
+ obname(pos->index, 1);
+ return true;
+ }
+ return false;
+}
+
+void DreamGenContext::isitworn() {
+ flags._z = isitworn((const DynObject *)es.ptr(bx, sizeof(DynObject)));
+}
+
+bool DreamGenContext::isitworn(const DynObject *object) {
+ return (object->id[0] == 'W'-'A') && (object->id[1] == 'E'-'A');
+}
+
+void DreamGenContext::makeworn() {
+ makeworn((DynObject *)es.ptr(bx, sizeof(DynObject)));
+}
+
+void DreamGenContext::makeworn(DynObject *object) {
+ object->id[0] = 'W'-'A';
+ object->id[1] = 'E'-'A';
+}
+
+void DreamGenContext::obtoinv() {
+ obtoinv(al, ah, di, bx);
+}
+
+void DreamGenContext::obtoinv(uint8 index, uint8 flag, uint16 x, uint16 y) {
+ Frame *icons1 = (Frame *)segRef(data.word(kIcons1)).ptr(0, 0);
+ showframe(icons1, x - 2, y - 1, 10, 0);
+ if (index == 0xff)
+ return;
+
+ Frame *extras = (Frame *)segRef(data.word(kExtras)).ptr(0, 0);
+ Frame *frees = (Frame *)segRef(data.word(kFreeframes)).ptr(0, 0);
+ Frame *frames = (flag == 4) ? extras : frees;
+ showframe(frames, x + 18, y + 19, 3 * index + 1, 128);
+ const DynObject *object = (const DynObject *)getanyaddir(index, flag);
+ bool worn = isitworn(object);
+ if (worn)
+ showframe(icons1, x - 3, y - 2, 7, 0);
+}
+
+void DreamGenContext::showryanpage() {
+ Frame *icons1 = (Frame *)segRef(data.word(kIcons1)).ptr(0, 0);
+ showframe(icons1, kInventx + 167, kInventy - 12, 12, 0);
+ showframe(icons1, kInventx + 167 + 18 * data.byte(kRyanpage), kInventy - 12, 13 + data.byte(kRyanpage), 0);
+}
+
+void DreamGenContext::findallryan() {
+ findallryan(es.ptr(di, 60));
+}
+
+void DreamGenContext::findallryan(uint8 *inv) {
+ memset(inv, 0xff, 60);
+ for (size_t i = 0; i < kNumexobjects; ++i) {
+ DynObject *extra = getexad(i);
+ if (extra->mapad[0] != 4)
+ continue;
+ if (extra->mapad[1] != 0xff)
+ continue;
+ uint8 slot = extra->mapad[2];
+ assert(slot < 30);
+ inv[2 * slot + 0] = i;
+ inv[2 * slot + 1] = 4;
+ }
+}
+
+void DreamGenContext::fillryan() {
+ uint8 *inv = segRef(data.word(kBuffers)).ptr(kRyaninvlist, 60);
+ findallryan(inv);
+ inv += data.byte(kRyanpage) * 2 * 10;
+ for (size_t i = 0; i < 2; ++i) {
+ for (size_t j = 0; j < 5; ++j) {
+ uint8 objIndex = *inv++;
+ uint8 objType = *inv++;
+ obtoinv(objIndex, objType, kInventx + j * kItempicsize, kInventy + i * kItempicsize);
+ }
+ }
+ showryanpage();
+}
+
+void DreamGenContext::hangon() {
+ hangon(cx);
+}
+
+void DreamGenContext::hangon(uint16 frameCount) {
+ while (frameCount) {
+ vsync();
+ --frameCount;
+ if (data.byte(kQuitrequested))
+ break;
+ }
+}
+
+void DreamGenContext::hangonp() {
+ hangonp(cx);
+}
+
+void DreamGenContext::hangonp(uint16 count) {
+ data.word(kMaintimer) = 0;
+ uint8 pointerFrame = data.byte(kPointerframe);
+ uint8 pickup = data.byte(kPickup);
+ data.byte(kPointermode) = 3;
+ data.byte(kPickup) = 0;
+ data.byte(kCommandtype) = 255;
+ readmouse();
+ animpointer();
+ showpointer();
+ vsync();
+ dumppointer();
+ for (size_t i = 0; i < count * 3; ++i) {
+ delpointer();
+ readmouse();
+ animpointer();
+ showpointer();
+ vsync();
+ dumppointer();
+ if (data.byte(kQuitrequested))
+ break;
+ if (data.word(kMousebutton) == 0)
+ continue;
+ if (data.word(kMousebutton) != data.word(kOldbutton))
+ break;
+ }
+
+ delpointer();
+ data.byte(kPointerframe) = pointerFrame;
+ data.byte(kPickup) = pickup;
+ data.byte(kPointermode) = 0;
+}
+
+void DreamGenContext::findnextcolon() {
+ uint8 *initialString = es.ptr(si, 0);
+ uint8 *string = initialString;
+ al = findnextcolon(&string);
+ si += (string - initialString);
+}
+
+uint8 DreamGenContext::findnextcolon(uint8 **string) {
+ uint8 c;
+ do {
+ c = **string;
+ ++(*string);
+ } while ((c != 0) && (c != ':'));
+ return c;
+}
+
+uint8 *DreamGenContext::getobtextstartCPP() {
+ push(es);
+ push(si);
+ getobtextstart();
+ uint8 *result = es.ptr(si, 0);
+ si = pop();
+ es = pop();
+ return result;
+}
+
} /*namespace dreamgen */
diff --git a/engines/dreamweb/stubs.h b/engines/dreamweb/stubs.h
index 7c8cee4690..d25a8d13b7 100644
--- a/engines/dreamweb/stubs.h
+++ b/engines/dreamweb/stubs.h
@@ -25,7 +25,7 @@
void clearwork();
void multidump();
void multidump(uint16 x, uint16 y, uint8 width, uint8 height);
- void frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
+ void frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y);
void frameoutnm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
void frameoutbh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
void frameoutfx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y);
@@ -47,6 +47,9 @@
void printchar(const Frame* charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height);
void printdirect();
void printdirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered);
+ void printdirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered);
+ void printmessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered);
+ void printmessage();
void usetimedtext();
void dumptimedtext();
void setuptimedtemp();
@@ -74,7 +77,6 @@
void multiput();
void eraseoldobs();
void clearsprites();
- void makesprite();
Sprite *makesprite(uint8 x, uint8 y, uint16 updateCallback, uint16 frameData, uint16 somethingInDi);
void spriteupdate();
void initman();
@@ -82,7 +84,7 @@
void facerightway();
void walking(Sprite *sprite);
void autosetwalk();
- void checkdest(const uint8 *roomsPaths);
+ void checkdest(const RoomPaths *roomsPaths);
void aboutturn(Sprite *sprite);
void backobject(Sprite *sprite);
void constant(Sprite *sprite, SetObject *objData);
@@ -97,13 +99,19 @@
void findsource();
Frame *findsourceCPP();
void showgamereel();
+ void showgamereel(ReelRoutine *routine);
void showreelframe();
void showreelframe(Reel *reel);
const Frame *getreelframeax(uint16 frame);
- void turnpathonCPP(uint8 param);
- void turnpathoffCPP(uint8 param);
- void getroomspaths();
- uint8 *getroomspathsCPP();
+ void turnpathon(uint8 param);
+ void turnpathoff(uint8 param);
+ void turnpathon();
+ void turnpathoff();
+ void turnanypathon(uint8 param, uint8 room);
+ void turnanypathoff(uint8 param, uint8 room);
+ void turnanypathon();
+ void turnanypathoff();
+ RoomPaths *getroomspaths();
void makebackob(SetObject *objData);
void modifychar();
void lockmon();
@@ -123,6 +131,8 @@
bool checkifperson(uint8 x, uint8 y);
void checkiffree();
bool checkiffree(uint8 x, uint8 y);
+ void checkifex();
+ bool checkifex(uint8 x, uint8 y);
const uint8 *findobname(uint8 type, uint8 index);
void copyname();
void copyname(uint8 type, uint8 index, uint8 *dst);
@@ -157,6 +167,8 @@
DynObject *getexad(uint8 index);
DynObject *geteitheradCPP();
SetObject *getsetad(uint8 index);
+ void *getanyad(uint8 *value1, uint8 *value2);
+ void *getanyaddir(uint8 index, uint8 flag);
void setallchanges();
void dochange();
void dochange(uint8 index, uint8 value, uint8 type);
@@ -167,6 +179,7 @@
void removesetobject();
void removesetobject(uint8 index);
void showallfree();
+ void showallex();
bool finishedwalkingCPP();
void finishedwalking();
void checkone();
@@ -191,4 +204,46 @@
void readmouse4();
uint16 waitframes();
void drawflags();
+ void addtopeoplelist();
+ void addtopeoplelist(ReelRoutine *routine);
+ void getexpos();
+ void paneltomap();
+ void maptopanel();
+ void dumpmap();
+ void obpicture();
+ void transferinv();
+ void obicons();
+ void compare();
+ bool compare(uint8 index, uint8 flag, const char id[4]);
+ bool pixelcheckset(const ObjPos *pos, uint8 x, uint8 y);
+ bool isitdescribed(const ObjPos *objPos);
+ void checkifset();
+ bool checkifset(uint8 x, uint8 y);
+ void checkifpathison();
+ bool checkifpathison(uint8 index);
+ void isitworn();
+ bool isitworn(const DynObject *object);
+ void makeworn();
+ void makeworn(DynObject *object);
+ void obtoinv();
+ void obtoinv(uint8 index, uint8 flag, uint16 x, uint16 y);
+ void showryanpage();
+ void findallryan();
+ void findallryan(uint8 *inv);
+ void fillryan();
+ void useroutine();
+ void hangon();
+ void hangon(uint16 frameCount);
+ void hangonp();
+ void hangonp(uint16 count);
+ uint8 findnextcolon(uint8 **string);
+ void findnextcolon();
+ uint8 *getobtextstartCPP();
+ void usetext(const uint8 *string);
+ void usetext();
+ void getblockofpixel();
+ uint8 getblockofpixel(uint8 x, uint8 y);
+ void bresenhams();
+ void examineobtext();
+
diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp
new file mode 100644
index 0000000000..d6648b556e
--- /dev/null
+++ b/engines/dreamweb/use.cpp
@@ -0,0 +1,178 @@
+/* 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 "dreamweb/dreamweb.h"
+
+namespace DreamGen {
+
+
+typedef void (DreamGenContext::*UseCallback)(void);
+
+struct UseListEntry {
+ uint8 id[5]; // 0-terminal because it is easier syntatically to initialize the array
+ UseCallback callback;
+};
+
+void DreamGenContext::useroutine() {
+
+ static const UseListEntry kUseList[] = {
+ { "NETW", &DreamGenContext::usemon },
+ { "ELVA", &DreamGenContext::useelevator1 },
+ { "ELVB", &DreamGenContext::useelevator2 },
+ { "ELVC", &DreamGenContext::useelevator3 },
+ { "ELVE", &DreamGenContext::useelevator4 },
+ { "ELVF", &DreamGenContext::useelevator5 },
+ { "CGAT", &DreamGenContext::usechurchgate },
+ { "REMO", &DreamGenContext::usestereo },
+ { "BUTA", &DreamGenContext::usebuttona },
+ { "CBOX", &DreamGenContext::usewinch },
+ { "LITE", &DreamGenContext::uselighter },
+ { "PLAT", &DreamGenContext::useplate },
+ { "LIFT", &DreamGenContext::usecontrol },
+ { "WIRE", &DreamGenContext::usewire },
+ { "HNDL", &DreamGenContext::usehandle },
+ { "HACH", &DreamGenContext::usehatch },
+ { "DOOR", &DreamGenContext::useelvdoor },
+ { "CSHR", &DreamGenContext::usecashcard },
+ { "GUNA", &DreamGenContext::usegun },
+ { "CRAA", &DreamGenContext::usecardreader1 },
+ { "CRBB", &DreamGenContext::usecardreader2 },
+ { "CRCC", &DreamGenContext::usecardreader3 },
+ { "SEAT", &DreamGenContext::sitdowninbar },
+ { "MENU", &DreamGenContext::usemenu },
+ { "COOK", &DreamGenContext::usecooker },
+ { "ELCA", &DreamGenContext::callhotellift },
+ { "EDCA", &DreamGenContext::calledenslift },
+ { "DDCA", &DreamGenContext::calledensdlift },
+ { "ALTR", &DreamGenContext::usealtar },
+ { "LOKA", &DreamGenContext::openhoteldoor },
+ { "LOKB", &DreamGenContext::openhoteldoor2 },
+ { "ENTA", &DreamGenContext::openlouis },
+ { "ENTB", &DreamGenContext::openryan },
+ { "ENTE", &DreamGenContext::openpoolboss },
+ { "ENTC", &DreamGenContext::openyourneighbour },
+ { "ENTD", &DreamGenContext::openeden },
+ { "ENTH", &DreamGenContext::opensarters },
+ { "WWAT", &DreamGenContext::wearwatch },
+ { "POOL", &DreamGenContext::usepoolreader },
+ { "WSHD", &DreamGenContext::wearshades },
+ { "GRAF", &DreamGenContext::grafittidoor },
+ { "TRAP", &DreamGenContext::trapdoor },
+ { "CDPE", &DreamGenContext::edenscdplayer },
+ { "DLOK", &DreamGenContext::opentvdoor },
+ { "HOLE", &DreamGenContext::usehole },
+ { "DRYR", &DreamGenContext::usedryer },
+ { "HOLY", &DreamGenContext::usechurchhole },
+ { "WALL", &DreamGenContext::usewall },
+ { "BOOK", &DreamGenContext::usediary },
+ { "AXED", &DreamGenContext::useaxe },
+ { "SHLD", &DreamGenContext::useshield },
+ { "BCNY", &DreamGenContext::userailing },
+ { "LIDC", &DreamGenContext::usecoveredbox },
+ { "LIDU", &DreamGenContext::useclearbox },
+ { "LIDO", &DreamGenContext::useopenbox },
+ { "PIPE", &DreamGenContext::usepipe },
+ { "BALC", &DreamGenContext::usebalcony },
+ { "WIND", &DreamGenContext::usewindow },
+ { "PAPR", &DreamGenContext::viewfolder },
+ { "UWTA", &DreamGenContext::usetrainer },
+ { "UWTB", &DreamGenContext::usetrainer },
+ { "STAT", &DreamGenContext::entersymbol },
+ { "TLID", &DreamGenContext::opentomb },
+ { "SLAB", &DreamGenContext::useslab },
+ { "CART", &DreamGenContext::usecart },
+ { "FCAR", &DreamGenContext::usefullcart },
+ { "SLBA", &DreamGenContext::slabdoora },
+ { "SLBB", &DreamGenContext::slabdoorb },
+ { "SLBC", &DreamGenContext::slabdoorc },
+ { "SLBD", &DreamGenContext::slabdoord },
+ { "SLBE", &DreamGenContext::slabdoore },
+ { "SLBF", &DreamGenContext::slabdoorf },
+ { "PLIN", &DreamGenContext::useplinth },
+ { "LADD", &DreamGenContext::useladder },
+ { "LADB", &DreamGenContext::useladderb },
+ { "GUMA", &DreamGenContext::chewy },
+ { "SQEE", &DreamGenContext::wheelsound },
+ { "TAPP", &DreamGenContext::runtap },
+ { "GUIT", &DreamGenContext::playguitar },
+ { "CONT", &DreamGenContext::hotelcontrol },
+ { "BELL", &DreamGenContext::hotelbell },
+ };
+
+ if (data.byte(kReallocation) >= 50) {
+ if (data.byte(kPointerpower) == 0)
+ return;
+ data.byte(kPointerpower) = 0;
+ }
+
+ getanyad();
+ const uint8 *id = es.ptr(bx + 12, 4);
+
+ for (size_t i = 0; i < sizeof(kUseList)/sizeof(UseListEntry); ++i) {
+ const UseListEntry &entry = kUseList[i];
+ if (('A' + id[0] == entry.id[0]) && ('A' + id[1] == entry.id[1]) && ('A' + id[2] == entry.id[2]) && ('A' + id[3] == entry.id[3])) {
+ (this->*entry.callback)();
+ return;
+ }
+ }
+
+ delpointer();
+ uint8 *obText = getobtextstartCPP();
+ if (findnextcolon(&obText) != 0) {
+ if (findnextcolon(&obText) != 0) {
+ if (*obText != 0) {
+ usetext(obText);
+ hangonp(400);
+ putbackobstuff();
+ return;
+ }
+ }
+ }
+
+ createpanel();
+ showpanel();
+ showman();
+ showexit();
+ obicons();
+ printmessage(33, 100, 63, 241, true);
+ worktoscreenm();
+ hangonp(50);
+ putbackobstuff();
+ data.byte(kCommandtype) = 255;
+}
+
+void DreamGenContext::usetext() {
+ usetext(es.ptr(si, 0));
+}
+
+void DreamGenContext::usetext(const uint8 *string) {
+ createpanel();
+ showpanel();
+ showman();
+ showexit();
+ obicons();
+ printdirect(string, 36, 104, 241, true);
+ worktoscreenm();
+}
+
+} /*namespace dreamgen */
+
diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp
index 3c92640768..53db811313 100644
--- a/engines/dreamweb/vgagrafx.cpp
+++ b/engines/dreamweb/vgagrafx.cpp
@@ -43,6 +43,8 @@ void DreamGenContext::multiget() {
}
void DreamGenContext::multiget(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h) {
+ assert(x < 320);
+ assert(y < 200);
const uint8 *src = workspace() + x + y * kScreenwidth;
if (y + h > 200)
h = 200 - y;
@@ -64,6 +66,8 @@ void DreamGenContext::multiput() {
}
void DreamGenContext::multiput(const uint8 *src, uint16 x, uint16 y, uint8 w, uint8 h) {
+ assert(x < 320);
+ assert(y < 200);
uint8 *dst = workspace() + x + y * kScreenwidth;
if (y + h > 200)
h = 200 - y;
@@ -150,11 +154,10 @@ void DreamGenContext::frameoutfx(uint8 *dst, const uint8 *src, uint16 pitch, uin
void DreamGenContext::doshake() {
uint8 &counter = data.byte(kShakecounter);
- _cmp(counter, 48);
- if (flags.z())
+ if (counter == 48)
return;
- _add(counter, 1);
+ ++counter;
static const int shakeTable[] = {
0, -2, 3, -2, 0, 2, 4, -1,
1, -3, 3, 2, 0, -2, 3, -2,
@@ -282,11 +285,23 @@ void DreamGenContext::showpcx() {
pcxFile.close();
}
-void DreamGenContext::frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) {
+void DreamGenContext::frameoutv(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y) {
// NB : These resilience checks were not in the original engine, but did they result in undefined behaviour
// or was something broken during porting to C++?
assert(pitch == 320);
+ if(x < 0) {
+ assert(width >= -x);
+ width -= -x;
+ src += -x;
+ x = 0;
+ }
+ if(y < 0) {
+ assert(height >= -y);
+ height -= -y;
+ src += (-y) * width;
+ y = 0;
+ }
if(x >= 320)
return;
if(y >= 200)
@@ -411,5 +426,43 @@ void DreamGenContext::zoom() {
data.byte(kDidzoom) = 1;
}
+void DreamGenContext::paneltomap() {
+ multiget(segRef(data.word(kMapstore)).ptr(0, 0), data.word(kMapxstart) + data.word(kMapadx), data.word(kMapystart) + data.word(kMapady), data.byte(kMapxsize), data.byte(kMapysize));
+}
+
+void DreamGenContext::maptopanel() {
+ multiput(segRef(data.word(kMapstore)).ptr(0, 0), data.word(kMapxstart) + data.word(kMapadx), data.word(kMapystart) + data.word(kMapady), data.byte(kMapxsize), data.byte(kMapysize));
+}
+
+void DreamGenContext::dumpmap() {
+ multidump(data.word(kMapxstart) + data.word(kMapadx), data.word(kMapystart) + data.word(kMapady), data.byte(kMapxsize), data.byte(kMapysize));
+}
+
+void DreamGenContext::transferinv() {
+ const Frame *freeFrames = (const Frame *)segRef(data.word(kFreeframes)).ptr(kFrframedata, 0);
+ const Frame *freeFrame = freeFrames + (3 * data.byte(kItemtotran) + 1);
+ Frame *exFrames = (Frame *)segRef(data.word(kExtras)).ptr(kExframedata, 0);
+ Frame *exFrame = exFrames + (3 * data.byte(kExpos) + 1);
+ exFrame->width = freeFrame->width;
+ exFrame->height = freeFrame->height;
+ exFrame->x = freeFrame->x;
+ exFrame->y = freeFrame->y;
+ uint16 byteCount = freeFrame->width * freeFrame->height;
+ const uint8 *src = segRef(data.word(kFreeframes)).ptr(kFrframes + freeFrame->ptr(), byteCount);
+ uint8 *dst = segRef(data.word(kExtras)).ptr(kExframes + data.word(kExframepos), byteCount);
+ memcpy(dst, src, byteCount);
+ exFrame->setPtr(data.word(kExframepos));
+ data.word(kExframepos) += byteCount;
+}
+
+bool DreamGenContext::pixelcheckset(const ObjPos *pos, uint8 x, uint8 y) {
+ x -= pos->xMin;
+ y -= pos->yMin;
+ SetObject *setObject = getsetad(pos->index);
+ Frame *frame = (Frame *)segRef(data.word(kSetframes)).ptr(kFramedata, 0) + setObject->index;
+ const uint8 *ptr = segRef(data.word(kSetframes)).ptr(kFrames, 0) + frame->ptr() + y * frame->width + x;
+ return *ptr != 0;
+}
+
} /*namespace dreamgen */
diff --git a/engines/engines.mk b/engines/engines.mk
index a822ab4ba3..bf0c24c57d 100644
--- a/engines/engines.mk
+++ b/engines/engines.mk
@@ -26,6 +26,11 @@ DEFINES += -DENABLE_AGOS2
endif
endif
+ifdef ENABLE_CGE
+DEFINES += -DENABLE_CGE=$(ENABLE_CGE)
+MODULES += engines/cge
+endif
+
ifdef ENABLE_CINE
DEFINES += -DENABLE_CINE=$(ENABLE_CINE)
MODULES += engines/cine
diff --git a/engines/gob/anifile.cpp b/engines/gob/anifile.cpp
new file mode 100644
index 0000000000..1a905f1083
--- /dev/null
+++ b/engines/gob/anifile.cpp
@@ -0,0 +1,326 @@
+/* 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 "common/stream.h"
+#include "common/substream.h"
+
+#include "gob/gob.h"
+#include "gob/util.h"
+#include "gob/dataio.h"
+#include "gob/surface.h"
+#include "gob/video.h"
+#include "gob/anifile.h"
+
+namespace Gob {
+
+ANIFile::Layer::Layer() : surface(0), coordinates(0) {
+}
+
+ANIFile::Layer::~Layer() {
+ delete coordinates;
+ delete surface;
+}
+
+
+ANIFile::ANIFile(GobEngine *vm, const Common::String &fileName,
+ uint16 width, uint8 bpp) : _vm(vm),
+ _width(width), _bpp(bpp), _hasPadding(false) {
+
+ Common::SeekableReadStream *ani = _vm->_dataIO->getFile(fileName);
+ if (ani) {
+ Common::SeekableSubReadStreamEndian sub(ani, 0, ani->size(), false, DisposeAfterUse::YES);
+
+ load(sub, fileName);
+ return;
+ }
+
+ // File doesn't exist, try to open the big-endian'd alternate file
+ Common::String alternateFileName = fileName;
+ alternateFileName.setChar('_', 0);
+
+ ani = _vm->_dataIO->getFile(alternateFileName);
+ if (ani) {
+ Common::SeekableSubReadStreamEndian sub(ani, 0, ani->size(), true, DisposeAfterUse::YES);
+
+ // The big endian version pads a few fields to even size
+ _hasPadding = true;
+
+ load(sub, fileName);
+ return;
+ }
+
+ warning("ANIFile::ANIFile(): No such file \"%s\"", fileName.c_str());
+}
+
+ANIFile::~ANIFile() {
+}
+
+void ANIFile::load(Common::SeekableSubReadStreamEndian &ani, const Common::String &fileName) {
+ ani.skip(2); // Unused
+
+ uint16 animationCount = ani.readUint16();
+ uint16 layerCount = ani.readUint16();
+
+ if (layerCount < 1)
+ warning("ANIFile::load(): Less than one layer (%d) in file \"%s\"",
+ layerCount, fileName.c_str());
+
+ // Load the layers
+ if (layerCount > 0) {
+ ani.skip(13); // The first layer is ignored?
+ if (_hasPadding)
+ ani.skip(1);
+
+ _layers.resize(layerCount - 1);
+ for (LayerArray::iterator l = _layers.begin(); l != _layers.end(); ++l)
+ loadLayer(*l, ani);
+ }
+
+ _maxWidth = 0;
+ _maxHeight = 0;
+
+ // Load the animations
+ _animations.resize(animationCount);
+ _frames.resize(animationCount);
+
+ for (uint16 animation = 0; animation < animationCount; animation++) {
+ loadAnimation(_animations[animation], _frames[animation], ani);
+
+ _maxWidth = MAX<uint16>(_maxWidth , _animations[animation].width);
+ _maxHeight = MAX<uint16>(_maxHeight, _animations[animation].height);
+ }
+}
+
+void ANIFile::loadAnimation(Animation &animation, FrameArray &frames,
+ Common::SeekableSubReadStreamEndian &ani) {
+
+ // Animation properties
+
+ animation.name = Util::readString(ani, 13);
+ if (_hasPadding)
+ ani.skip(1);
+
+ ani.skip(13); // The name a second time?!?
+ if (_hasPadding)
+ ani.skip(1);
+
+ ani.skip(2); // Unknown
+
+ animation.x = (int16) ani.readUint16();
+ animation.y = (int16) ani.readUint16();
+ animation.deltaX = (int16) ani.readUint16();
+ animation.deltaY = (int16) ani.readUint16();
+
+ animation.transp = ani.readByte() != 0;
+
+ if (_hasPadding)
+ ani.skip(1);
+
+ uint16 frameCount = ani.readUint16();
+
+ // Load the frames
+
+ frames.resize(MAX<uint16>(1, frameCount));
+ loadFrames(frames, ani);
+
+ animation.frameCount = frames.size();
+
+ animation.width = 0;
+ animation.height = 0;
+
+ // Calculate the areas of each frame
+
+ animation.frameAreas.resize(animation.frameCount);
+ for (uint16 i = 0; i < animation.frameCount; i++) {
+ const ChunkList &frame = frames[i];
+ FrameArea &area = animation.frameAreas[i];
+
+ area.left = area.top = 0x7FFF;
+ area.right = area.bottom = -0x7FFF;
+
+ for (ChunkList::const_iterator c = frame.begin(); c != frame.end(); c++) {
+ const Layer *layer;
+ const RXYFile::Coordinates *coords;
+
+ if (!getPart(c->layer, c->part, layer, coords))
+ continue;
+
+ const uint16 width = coords->right - coords->left + 1;
+ const uint16 height = coords->bottom - coords->top + 1;
+
+ const uint16 l = c->x;
+ const uint16 t = c->y;
+ const uint16 r = l + width - 1;
+ const uint16 b = t + height - 1;
+
+ area.left = MIN<int16>(area.left , l);
+ area.top = MIN<int16>(area.top , t);
+ area.right = MAX<int16>(area.right , r);
+ area.bottom = MAX<int16>(area.bottom, b);
+ }
+
+ if ((area.left <= area.right) && (area.top <= area.bottom)) {
+ animation.width = MAX<uint16>(animation.width , area.right - area.left + 1);
+ animation.height = MAX<uint16>(animation.height, area.bottom - area.top + 1);
+ }
+ }
+}
+
+void ANIFile::loadFrames(FrameArray &frames, Common::SeekableSubReadStreamEndian &ani) {
+ uint32 curFrame = 0;
+
+ bool end = false;
+ while (!end) {
+ frames[curFrame].push_back(AnimationChunk());
+ AnimationChunk &chunk = frames[curFrame].back();
+
+ uint8 layerFlags = ani.readByte();
+
+ // Chunk properties
+ chunk.layer = (layerFlags & 0x0F) - 1;
+ chunk.part = ani.readByte();
+ chunk.x = (int8) ani.readByte();
+ chunk.y = (int8) ani.readByte();
+
+ // X multiplier/offset
+ int16 xOff = ((layerFlags & 0xC0) >> 6) << 7;
+ if (chunk.x >= 0)
+ chunk.x += xOff;
+ else
+ chunk.x -= xOff;
+
+ // Y multiplier/offset
+ int16 yOff = ((layerFlags & 0x30) >> 4) << 7;
+ if (chunk.y >= 0)
+ chunk.y += yOff;
+ else
+ chunk.y -= yOff;
+
+ uint8 multiPart = ani.readByte();
+ if (multiPart == 0xFF) // No more frames in this animation
+ end = true;
+ else if (multiPart != 0x01) // No more chunks in this frame
+ curFrame++;
+
+ // Shouldn't happen, but just to be safe
+ if (curFrame >= frames.size())
+ frames.resize(curFrame + 1);
+
+ if (_hasPadding)
+ ani.skip(1);
+
+ if (ani.eos() || ani.err())
+ error("ANIFile::loadFrames(): Read error");
+ }
+}
+
+void ANIFile::loadLayer(Layer &layer, Common::SeekableSubReadStreamEndian &ani) {
+ Common::String file = Util::readString(ani, 13);
+ if (_hasPadding)
+ ani.skip(1);
+
+ if (file.empty())
+ return;
+
+ Common::String fileRXY = Util::setExtension(file, ".RXY");
+ Common::String fileCMP = Util::setExtension(file, ".CMP");
+ if (!_vm->_dataIO->hasFile(fileRXY) || !_vm->_dataIO->hasFile(fileCMP))
+ return;
+
+ loadLayer(layer, fileRXY, fileCMP);
+}
+
+void ANIFile::loadLayer(Layer &layer, const Common::String &fileRXY,
+ const Common::String &fileCMP) {
+
+ Common::SeekableReadStream *dataRXY = _vm->_dataIO->getFile(fileRXY);
+ if (!dataRXY)
+ return;
+
+ layer.coordinates = new RXYFile(*dataRXY);
+ layer.surface = new Surface(_width, layer.coordinates->getHeight(), _bpp);
+
+ _vm->_video->drawPackedSprite(fileCMP.c_str(), *layer.surface);
+}
+
+uint16 ANIFile::getAnimationCount() const {
+ return _animations.size();
+}
+
+void ANIFile::getMaxSize(uint16 &width, uint16 &height) const {
+ width = _maxWidth;
+ height = _maxHeight;
+}
+
+const ANIFile::Animation &ANIFile::getAnimationInfo(uint16 animation) const {
+ assert(animation < _animations.size());
+
+ return _animations[animation];
+}
+
+bool ANIFile::getPart(uint16 layer, uint16 part,
+ const Layer *&l, const RXYFile::Coordinates *&c) const {
+
+ if (layer >= _layers.size())
+ return false;
+
+ l = &_layers[layer];
+ if (!l->surface || !l->coordinates)
+ return false;
+
+ if (part >= l->coordinates->size())
+ return false;
+
+ c = &(*l->coordinates)[part];
+ if (c->left == 0xFFFF)
+ return false;
+
+ return true;
+}
+
+void ANIFile::draw(Surface &dest, uint16 animation, uint16 frame, int16 x, int16 y) const {
+ if (animation >= _animations.size())
+ return;
+
+ const Animation &anim = _animations[animation];
+ if (frame >= anim.frameCount)
+ return;
+
+ const ChunkList &chunks = _frames[animation][frame];
+
+ for (ChunkList::const_iterator c = chunks.begin(); c != chunks.end(); ++c)
+ drawLayer(dest, c->layer, c->part, x + c->x, y + c->y, anim.transp ? 0 : -1);
+}
+
+void ANIFile::drawLayer(Surface &dest, uint16 layer, uint16 part,
+ int16 x, int16 y, int32 transp) const {
+
+ const Layer *l;
+ const RXYFile::Coordinates *c;
+
+ if (!getPart(layer, part, l, c))
+ return;
+
+ dest.blit(*l->surface, c->left, c->top, c->right, c->bottom, x, y, transp);
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/anifile.h b/engines/gob/anifile.h
new file mode 100644
index 0000000000..1e10da6ff4
--- /dev/null
+++ b/engines/gob/anifile.h
@@ -0,0 +1,161 @@
+/* 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.
+ *
+ */
+
+#ifndef GOB_ANIFILE_H
+#define GOB_ANIFILE_H
+
+#include "common/system.h"
+#include "common/str.h"
+#include "common/array.h"
+#include "common/list.h"
+
+#include "gob/rxyfile.h"
+
+namespace Common {
+ class SeekableSubReadStreamEndian;
+}
+
+namespace Gob {
+
+class GobEngine;
+class Surface;
+
+/** An ANI file, describing an animation.
+ *
+ * Used in hardcoded "actiony" parts of gob games.
+ * The principle is similar to an Anim in Scenery (see scenery.cpp), but
+ * instead of referencing indices in the sprites array, ANIs reference sprites
+ * directly by filename.
+ */
+class ANIFile {
+public:
+ /** The relative area a frame sprite occupies. */
+ struct FrameArea {
+ int16 left;
+ int16 top;
+ int16 right;
+ int16 bottom;
+ };
+
+ /** An animation within an ANI file. */
+ struct Animation {
+ Common::String name; ///< The name of the animation.
+
+ uint16 frameCount; ///< The number of frames in this animation.
+
+ int16 x; ///< The default x position for this animation.
+ int16 y; ///< The default y position for this animation.
+ bool transp; ///< Should the animation frames be drawn with transparency?
+
+ int16 deltaX; ///< # of pixels to advance in X direction after each cycle.
+ int16 deltaY; ///< # of pixels to advance in Y direction after each cycle.
+
+ /** The relative area each frame sprite occupies. */
+ Common::Array<FrameArea> frameAreas;
+
+ uint16 width; ///< The maximum width of this animation's frames.
+ uint16 height; ///< The maximum height of this animation's frames.
+ };
+
+
+ ANIFile(GobEngine *vm, const Common::String &fileName,
+ uint16 width = 320, uint8 bpp = 1);
+ ~ANIFile();
+
+ /** Return the number of animations in this ANI file. */
+ uint16 getAnimationCount() const;
+
+ /** Return the maximum size of all animation frames. */
+ void getMaxSize(uint16 &width, uint16 &height) const;
+
+ /** Get this animation's properties. */
+ const Animation &getAnimationInfo(uint16 animation) const;
+
+ /** Draw an animation frame. */
+ void draw(Surface &dest, uint16 animation, uint16 frame, int16 x, int16 y) const;
+
+private:
+ /** A sprite layer. */
+ struct Layer {
+ Surface *surface; ///< The surface containing the layer sprite.
+ RXYFile *coordinates; ///< The coordinates describing the layer sprite parts.
+
+ Layer();
+ ~Layer();
+ };
+
+ typedef Common::Array<Layer> LayerArray;
+ typedef Common::Array<Animation> AnimationArray;
+
+ /** A "chunk" of an animation frame. */
+ struct AnimationChunk {
+ int16 x; ///< The relative x offset of this chunk.
+ int16 y; ///< The relative y offset of this chunk.
+
+ uint16 layer; ///< The layer the chunk's sprite is on.
+ uint16 part; ///< The layer part the chunk's sprite is.
+ };
+
+ typedef Common::List<AnimationChunk> ChunkList;
+ typedef Common::Array<ChunkList> FrameArray;
+ typedef Common::Array<FrameArray> AnimationFrameArray;
+
+
+ GobEngine *_vm;
+
+ uint16 _width; ///< The width of a sprite layer.
+ uint8 _bpp; ///< Number of bytes per pixel in a sprite layer.
+
+ byte _hasPadding;
+
+ LayerArray _layers; ///< The animation sprite layers.
+ AnimationArray _animations; ///< The animations.
+ AnimationFrameArray _frames; ///< The animation frames.
+
+ uint16 _maxWidth;
+ uint16 _maxHeight;
+
+
+ // Loading helpers
+
+ void load(Common::SeekableSubReadStreamEndian &ani, const Common::String &fileName);
+
+ void loadLayer(Layer &layer, Common::SeekableSubReadStreamEndian &ani);
+ void loadLayer(Layer &layer, const Common::String &fileRXY,
+ const Common::String &fileCMP);
+
+ void loadAnimation(Animation &animation, FrameArray &frames,
+ Common::SeekableSubReadStreamEndian &ani);
+ void loadFrames(FrameArray &frames, Common::SeekableSubReadStreamEndian &ani);
+
+ // Drawing helpers
+
+ bool getPart(uint16 layer, uint16 part,
+ const Layer *&l, const RXYFile::Coordinates *&c) const;
+
+ void drawLayer(Surface &dest, uint16 layer, uint16 part,
+ int16 x, int16 y, int32 transp) const;
+};
+
+} // End of namespace Gob
+
+#endif // GOB_ANIFILE_H
diff --git a/engines/gob/aniobject.cpp b/engines/gob/aniobject.cpp
new file mode 100644
index 0000000000..a01fe43672
--- /dev/null
+++ b/engines/gob/aniobject.cpp
@@ -0,0 +1,210 @@
+/* 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 "gob/surface.h"
+#include "gob/anifile.h"
+#include "gob/aniobject.h"
+
+namespace Gob {
+
+ANIObject::ANIObject(const ANIFile &ani) : _ani(&ani),
+ _visible(false), _paused(false), _mode(kModeContinuous),
+ _x(0), _y(0), _background(0), _drawn(false) {
+
+ setAnimation(0);
+ setPosition();
+}
+
+ANIObject::~ANIObject() {
+ delete _background;
+}
+
+void ANIObject::setVisible(bool visible) {
+ _visible = visible;
+}
+
+bool ANIObject::isVisible() const {
+ return _visible;
+}
+
+void ANIObject::setPause(bool pause) {
+ _paused = pause;
+}
+
+bool ANIObject::isPaused() const {
+ return _paused;
+}
+
+void ANIObject::setMode(Mode mode) {
+ _mode = mode;
+}
+
+void ANIObject::setAnimation(uint16 animation) {
+ _animation = animation;
+ _frame = 0;
+}
+
+void ANIObject::rewind() {
+ _frame = 0;
+}
+
+void ANIObject::setPosition() {
+ if (_animation >= _ani->getAnimationCount())
+ return;
+
+ const ANIFile::Animation &animation = _ani->getAnimationInfo(_animation);
+
+ _x = animation.x;
+ _y = animation.y;
+}
+
+void ANIObject::setPosition(int16 x, int16 y) {
+ _x = x;
+ _y = y;
+}
+
+void ANIObject::getPosition(int16 &x, int16 &y) const {
+ x = _x;
+ y = _y;
+}
+
+void ANIObject::getFramePosition(int16 &x, int16 &y) const {
+ if (_animation >= _ani->getAnimationCount())
+ return;
+
+ const ANIFile::Animation &animation = _ani->getAnimationInfo(_animation);
+ if (_frame >= animation.frameCount)
+ return;
+
+ x = _x + animation.frameAreas[_frame].left;
+ y = _y + animation.frameAreas[_frame].top;
+}
+
+void ANIObject::getFrameSize(int16 &width, int16 &height) const {
+ if (_animation >= _ani->getAnimationCount())
+ return;
+
+ const ANIFile::Animation &animation = _ani->getAnimationInfo(_animation);
+ if (_frame >= animation.frameCount)
+ return;
+
+ width = animation.frameAreas[_frame].right - animation.frameAreas[_frame].left + 1;
+ height = animation.frameAreas[_frame].bottom - animation.frameAreas[_frame].top + 1;
+}
+
+void ANIObject::draw(Surface &dest, int16 &left, int16 &top,
+ int16 &right, int16 &bottom) {
+
+ if (!_visible)
+ return;
+
+ if (!_background) {
+ uint16 width, height;
+
+ _ani->getMaxSize(width, height);
+
+ _background = new Surface(width, height, dest.getBPP());
+ }
+
+ const ANIFile::Animation &animation = _ani->getAnimationInfo(_animation);
+ if (_frame >= animation.frameCount)
+ return;
+
+ const ANIFile::FrameArea &area = animation.frameAreas[_frame];
+
+ _backgroundLeft = CLIP<int16>(area.left + _x, 0, dest.getWidth () - 1);
+ _backgroundTop = CLIP<int16>(area.top + _y, 0, dest.getHeight() - 1);
+ _backgroundRight = CLIP<int16>(area.right + _x, 0, dest.getWidth () - 1);
+ _backgroundBottom = CLIP<int16>(area.bottom + _y, 0, dest.getHeight() - 1);
+
+ _background->blit(dest, _backgroundLeft , _backgroundTop,
+ _backgroundRight, _backgroundBottom, 0, 0);
+
+ _ani->draw(dest, _animation, _frame, _x, _y);
+
+ _drawn = true;
+
+ left = _backgroundLeft;
+ top = _backgroundTop;
+ right = _backgroundRight;
+ bottom = _backgroundBottom;
+}
+
+void ANIObject::clear(Surface &dest, int16 &left, int16 &top,
+ int16 &right, int16 &bottom) {
+
+ if (!_drawn)
+ return;
+
+ const int16 bgRight = _backgroundRight - _backgroundLeft;
+ const int16 bgBottom = _backgroundBottom - _backgroundTop;
+
+ dest.blit(*_background, 0, 0, bgRight, bgBottom, _backgroundLeft, _backgroundTop);
+
+ _drawn = false;
+
+ left = _backgroundLeft;
+ top = _backgroundTop;
+ right = _backgroundRight;
+ bottom = _backgroundBottom;
+}
+
+void ANIObject::advance() {
+ if (_paused)
+ return;
+
+ if (_animation >= _ani->getAnimationCount())
+ return;
+
+ const ANIFile::Animation &animation = _ani->getAnimationInfo(_animation);
+
+ _frame = (_frame + 1) % animation.frameCount;
+
+ if (_frame == 0) {
+ _x += animation.deltaX;
+ _y += animation.deltaY;
+
+ if (_mode == kModeOnce) {
+ _paused = true;
+ _visible = false;
+ }
+ }
+}
+
+uint16 ANIObject::getAnimation() const {
+ return _animation;
+}
+
+uint16 ANIObject::getFrame() const {
+ return _frame;
+}
+
+bool ANIObject::lastFrame() const {
+ if (_animation >= _ani->getAnimationCount())
+ return true;
+
+ const ANIFile::Animation &animation = _ani->getAnimationInfo(_animation);
+
+ return (_frame + 1) >= animation.frameCount;
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/aniobject.h b/engines/gob/aniobject.h
new file mode 100644
index 0000000000..28103007a6
--- /dev/null
+++ b/engines/gob/aniobject.h
@@ -0,0 +1,119 @@
+/* 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.
+ *
+ */
+
+#ifndef GOB_ANIOBJECT_H
+#define GOB_ANIOBJECT_H
+
+#include "common/system.h"
+
+namespace Gob {
+
+class ANIFile;
+class Surface;
+
+/** An ANI object, controlling an animation within an ANI file. */
+class ANIObject {
+public:
+ enum Mode {
+ kModeContinuous, ///< Play the animation continuously.
+ kModeOnce ///< Play the animation only once.
+ };
+
+ ANIObject(const ANIFile &ani);
+ virtual ~ANIObject();
+
+ /** Make the object visible/invisible. */
+ void setVisible(bool visible);
+
+ /** Is the object currently visible? */
+ bool isVisible() const;
+
+ /** Pause/Unpause the animation. */
+ void setPause(bool pause);
+
+ /** Is the animation currently paused? */
+ bool isPaused() const;
+
+ /** Set the animation mode. */
+ void setMode(Mode mode);
+
+ /** Set the current position to the animation's default. */
+ void setPosition();
+ /** Set the current position. */
+ void setPosition(int16 x, int16 y);
+
+ /** Return the current position. */
+ void getPosition(int16 &x, int16 &y) const;
+
+ /** Return the current frame position. */
+ void getFramePosition(int16 &x, int16 &y) const;
+ /** Return the current frame size. */
+ void getFrameSize(int16 &width, int16 &height) const;
+
+ /** Set the animation number. */
+ void setAnimation(uint16 animation);
+
+ /** Rewind the current animation to the first frame. */
+ void rewind();
+
+ /** Return the current animation number. */
+ uint16 getAnimation() const;
+ /** Return the current frame number. */
+ uint16 getFrame() const;
+
+ /** Is this the last frame within this animation cycle? */
+ bool lastFrame() const;
+
+ /** Draw the current frame onto the surface and return the affected rectangle. */
+ void draw(Surface &dest, int16 &left, int16 &top, int16 &right, int16 &bottom);
+ /** Draw the current frame from the surface and return the affected rectangle. */
+ void clear(Surface &dest, int16 &left , int16 &top, int16 &right, int16 &bottom);
+
+ /** Advance the animation to the next frame. */
+ virtual void advance();
+
+private:
+ const ANIFile *_ani; ///< The managed ANI file.
+
+ uint16 _animation; ///< The current animation number
+ uint16 _frame; ///< The current frame.
+
+ bool _visible; ///< Is the object currently visible?
+ bool _paused; ///< Is the animation currently paused?
+
+ Mode _mode; ///< The animation mode.
+
+ int16 _x; ///< The current X position.
+ int16 _y; ///< The current Y position.
+
+ Surface *_background; ///< The saved background.
+ bool _drawn; ///< Was the animation drawn?
+
+ int16 _backgroundLeft; ///< The left position of the saved background.
+ int16 _backgroundTop; ///< The top of the saved background.
+ int16 _backgroundRight; ///< The right position of the saved background.
+ int16 _backgroundBottom; ///< The bottom position of the saved background.
+};
+
+} // End of namespace Gob
+
+#endif // GOB_ANIOBJECT_H
diff --git a/engines/gob/decfile.cpp b/engines/gob/decfile.cpp
new file mode 100644
index 0000000000..f5910f0654
--- /dev/null
+++ b/engines/gob/decfile.cpp
@@ -0,0 +1,214 @@
+/* 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 "common/str.h"
+#include "common/stream.h"
+#include "common/substream.h"
+
+#include "gob/gob.h"
+#include "gob/util.h"
+#include "gob/dataio.h"
+#include "gob/surface.h"
+#include "gob/video.h"
+#include "gob/rxyfile.h"
+#include "gob/decfile.h"
+
+namespace Gob {
+
+DECFile::Layer::Layer() : surface(0), coordinates(0) {
+}
+
+DECFile::Layer::~Layer() {
+ delete coordinates;
+ delete surface;
+}
+
+
+DECFile::DECFile(GobEngine *vm, const Common::String &fileName,
+ uint16 width, uint16 height, uint8 bpp) : _vm(vm),
+ _width(width), _height(height), _bpp(bpp), _hasPadding(false) {
+
+ _backdrop = new Surface(_width, _height, _bpp);
+
+ Common::SeekableReadStream *dec = _vm->_dataIO->getFile(fileName);
+ if (dec) {
+ Common::SeekableSubReadStreamEndian sub(dec, 0, dec->size(), false, DisposeAfterUse::YES);
+
+ load(sub, fileName);
+ return;
+ }
+
+ // File doesn't exist, try to open the big-endian'd alternate file
+ Common::String alternateFileName = fileName;
+ alternateFileName.setChar('_', 0);
+
+ dec = _vm->_dataIO->getFile(alternateFileName);
+ if (dec) {
+ Common::SeekableSubReadStreamEndian sub(dec, 0, dec->size(), true, DisposeAfterUse::YES);
+
+ // The big endian version pads a few fields to even size
+ _hasPadding = true;
+
+ load(sub, fileName);
+ return;
+ }
+
+ warning("DECFile::DECFile(): No such file \"%s\"", fileName.c_str());
+}
+
+DECFile::~DECFile() {
+ delete _backdrop;
+}
+
+void DECFile::load(Common::SeekableSubReadStreamEndian &dec, const Common::String &fileName) {
+ dec.skip(2); // Unused
+
+ int16 backdropCount = dec.readUint16();
+ int16 layerCount = dec.readUint16();
+
+ // Sanity checks
+ if (backdropCount > 1)
+ warning("DECFile::load(): More than one backdrop (%d) in file \"%s\"",
+ backdropCount, fileName.c_str());
+ if (layerCount < 1)
+ warning("DECFile::load(): Less than one layer (%d) in file \"%s\"",
+ layerCount, fileName.c_str());
+
+ // Load the backdrop
+ if (backdropCount > 0) {
+ loadBackdrop(dec);
+
+ // We only support one backdrop, skip the rest
+ dec.skip((backdropCount - 1) * (13 + (_hasPadding ? 1 : 0)));
+ }
+
+ // Load the layers
+ _layers.resize(MAX(0, layerCount - 1));
+ for (LayerArray::iterator l = _layers.begin(); l != _layers.end(); ++l)
+ loadLayer(*l, dec);
+
+ // Load the backdrop parts
+ if (backdropCount > 0)
+ loadParts(dec);
+}
+
+void DECFile::loadBackdrop(Common::SeekableSubReadStreamEndian &dec) {
+ // Interestingly, DEC files reference "FOO.LBM" instead of "FOO.CMP"
+ Common::String file = Util::setExtension(Util::readString(dec, 13), ".CMP");
+ if (_hasPadding)
+ dec.skip(1);
+
+ if (file.empty() || !_vm->_dataIO->hasFile(file))
+ return;
+
+ _vm->_video->drawPackedSprite(file.c_str(), *_backdrop);
+}
+
+void DECFile::loadLayer(Layer &layer, Common::SeekableSubReadStreamEndian &dec) {
+ Common::String file = Util::readString(dec, 13);
+ if (_hasPadding)
+ dec.skip(1);
+
+ if (file.empty())
+ return;
+
+ Common::String fileRXY = Util::setExtension(file, ".RXY");
+ Common::String fileCMP = Util::setExtension(file, ".CMP");
+ if (!_vm->_dataIO->hasFile(fileRXY) || !_vm->_dataIO->hasFile(fileCMP))
+ return;
+
+ loadLayer(layer, fileRXY, fileCMP);
+}
+
+void DECFile::loadLayer(Layer &layer, const Common::String &fileRXY,
+ const Common::String &fileCMP) {
+
+ Common::SeekableReadStream *dataRXY = _vm->_dataIO->getFile(fileRXY);
+ if (!dataRXY)
+ return;
+
+ layer.coordinates = new RXYFile(*dataRXY);
+ layer.surface = new Surface(_width, layer.coordinates->getHeight(), _bpp);
+
+ _vm->_video->drawPackedSprite(fileCMP.c_str(), *layer.surface);
+}
+
+void DECFile::loadParts(Common::SeekableSubReadStreamEndian &dec) {
+ dec.skip(13); // Name
+ if (_hasPadding)
+ dec.skip(1);
+
+ dec.skip(13); // File?
+ if (_hasPadding)
+ dec.skip(1);
+
+ uint16 partCount = dec.readUint16();
+
+ _parts.resize(partCount);
+ for (PartArray::iterator p = _parts.begin(); p != _parts.end(); ++p)
+ loadPart(*p, dec);
+}
+
+void DECFile::loadPart(Part &part, Common::SeekableSubReadStreamEndian &dec) {
+ part.layer = dec.readByte() - 1;
+ part.part = dec.readByte();
+
+ dec.skip(1); // Unknown
+
+ part.x = dec.readUint16();
+ part.y = dec.readUint16();
+
+ part.transp = dec.readByte() != 0;
+}
+
+void DECFile::draw(Surface &dest) const {
+ drawBackdrop(dest);
+
+ for (PartArray::const_iterator p = _parts.begin(); p != _parts.end(); ++p)
+ drawLayer(dest, p->layer, p->part, p->x, p->y, p->transp ? 0 : -1);
+}
+
+void DECFile::drawBackdrop(Surface &dest) const {
+ dest.blit(*_backdrop);
+}
+
+void DECFile::drawLayer(Surface &dest, uint16 layer, uint16 part,
+ uint16 x, uint16 y, int32 transp) const {
+
+ if (layer >= _layers.size())
+ return;
+
+ const Layer &l = _layers[layer];
+ if (!l.surface || !l.coordinates)
+ return;
+
+ if (part >= l.coordinates->size())
+ return;
+
+ const RXYFile::Coordinates &c = (*l.coordinates)[part];
+ if (c.left == 0xFFFF)
+ return;
+
+ dest.blit(*l.surface, c.left, c.top, c.right, c.bottom, x, y, transp);
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/decfile.h b/engines/gob/decfile.h
new file mode 100644
index 0000000000..31d90180d3
--- /dev/null
+++ b/engines/gob/decfile.h
@@ -0,0 +1,111 @@
+/* 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.
+ *
+ */
+
+#ifndef GOB_DECFILE_H
+#define GOB_DECFILE_H
+
+#include "common/system.h"
+
+namespace Common {
+ class String;
+ class SeekableSubReadStreamEndian;
+}
+
+namespace Gob {
+
+class GobEngine;
+class Surface;
+class RXYFile;
+
+/** A DEC file, describing a "decal" (background).
+ *
+ * Used in hardcoded "actiony" parts of gob games.
+ * The principle is similar to a Static in Scenery (see scenery.cpp), but
+ * instead of referencing indices in the sprites array, DECs reference sprites
+ * directly by filename.
+ */
+class DECFile {
+public:
+ DECFile(GobEngine *vm, const Common::String &fileName,
+ uint16 width, uint16 height, uint8 bpp = 1);
+ ~DECFile();
+
+ /** Draw the background, including all default layer parts. */
+ void draw(Surface &dest) const;
+
+ /** Explicitly draw the backdrop. */
+ void drawBackdrop(Surface &dest) const;
+
+ /** Explicitly draw a layer part. */
+ void drawLayer(Surface &dest, uint16 layer, uint16 part,
+ uint16 x, uint16 y, int32 transp = -1) const;
+
+private:
+ struct Layer {
+ Surface *surface; ///< The surface containing the layer sprite.
+ RXYFile *coordinates; ///< The coordinates describing the layer sprite parts.
+
+ Layer();
+ ~Layer();
+ };
+
+ struct Part {
+ uint8 layer;
+ uint8 part;
+
+ uint16 x;
+ uint16 y;
+ bool transp;
+ };
+
+ typedef Common::Array<Layer> LayerArray;
+ typedef Common::Array<Part> PartArray;
+
+ GobEngine *_vm;
+
+ uint16 _width;
+ uint16 _height;
+ uint8 _bpp;
+
+ byte _hasPadding;
+
+ Surface *_backdrop;
+
+ LayerArray _layers;
+ PartArray _parts;
+
+
+ void load(Common::SeekableSubReadStreamEndian &dec, const Common::String &fileName);
+
+ void loadBackdrop(Common::SeekableSubReadStreamEndian &dec);
+
+ void loadLayer(Layer &layer, Common::SeekableSubReadStreamEndian &dec);
+ void loadLayer(Layer &layer, const Common::String &fileRXY,
+ const Common::String &fileCMP);
+
+ void loadParts(Common::SeekableSubReadStreamEndian &dec);
+ void loadPart(Part &part, Common::SeekableSubReadStreamEndian &dec);
+};
+
+} // End of namespace Gob
+
+#endif // GOB_DECFILE_H
diff --git a/engines/gob/detection_tables.h b/engines/gob/detection_tables.h
index 4c1ff9a8e3..9c13b4f7b8 100644
--- a/engines/gob/detection_tables.h
+++ b/engines/gob/detection_tables.h
@@ -2515,6 +2515,20 @@ static const GOBGameDescription gameDescriptions[] = {
},
{
{
+ "geisha",
+ "",
+ AD_ENTRY1s("disk1.stk", "e5892f00917c62423e93f5fd9920cf47", 208120),
+ UNK_LANG,
+ kPlatformAmiga,
+ ADGF_NO_FLAGS,
+ GUIO_NOSUBTITLES | GUIO_NOSPEECH
+ },
+ kGameTypeGeisha,
+ kFeaturesEGA,
+ "disk1.stk", "intro.tot", 0
+ },
+ {
+ {
"gob3",
"",
AD_ENTRY1s("intro.stk", "32b0f57f5ae79a9ae97e8011df38af42", 157084),
diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp
index 580696523f..4b659f51de 100644
--- a/engines/gob/draw.cpp
+++ b/engines/gob/draw.cpp
@@ -107,6 +107,9 @@ Draw::Draw(GobEngine *vm) : _vm(vm) {
_cursorHotspotXVar = -1;
_cursorHotspotYVar = -1;
+ _cursorHotspotX = -1;
+ _cursorHotspotY = -1;
+
_cursorAnim = 0;
for (int i = 0; i < 40; i++) {
_cursorAnimLow[i] = 0;
diff --git a/engines/gob/draw.h b/engines/gob/draw.h
index 57faefa314..393822c33a 100644
--- a/engines/gob/draw.h
+++ b/engines/gob/draw.h
@@ -133,6 +133,9 @@ public:
int32 _cursorHotspotXVar;
int32 _cursorHotspotYVar;
+ int32 _cursorHotspotX;
+ int32 _cursorHotspotY;
+
SurfacePtr _cursorSprites;
SurfacePtr _cursorSpritesBack;
SurfacePtr _scummvmCursor;
diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp
index 064c74958a..8cb88b522c 100644
--- a/engines/gob/draw_v1.cpp
+++ b/engines/gob/draw_v1.cpp
@@ -112,6 +112,9 @@ void Draw_v1::animateCursor(int16 cursor) {
if (_cursorHotspotXVar != -1) {
newX -= hotspotX = (uint16) VAR(_cursorIndex + _cursorHotspotXVar);
newY -= hotspotY = (uint16) VAR(_cursorIndex + _cursorHotspotYVar);
+ } else if (_cursorHotspotX != -1) {
+ newX -= hotspotX = _cursorHotspotX;
+ newY -= hotspotY = _cursorHotspotY;
}
_scummvmCursor->clear();
diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp
index 151ed42526..6e64d6fd06 100644
--- a/engines/gob/draw_v2.cpp
+++ b/engines/gob/draw_v2.cpp
@@ -138,6 +138,9 @@ void Draw_v2::animateCursor(int16 cursor) {
if (_cursorHotspotXVar != -1) {
newX -= hotspotX = (uint16) VAR(_cursorIndex + _cursorHotspotXVar);
newY -= hotspotY = (uint16) VAR(_cursorIndex + _cursorHotspotYVar);
+ } else if (_cursorHotspotX != -1) {
+ newX -= hotspotX = _cursorHotspotX;
+ newY -= hotspotY = _cursorHotspotY;
}
_scummvmCursor->clear();
diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp
index 7b43e9c4d7..502a440005 100644
--- a/engines/gob/game.cpp
+++ b/engines/gob/game.cpp
@@ -583,7 +583,11 @@ void Game::playTot(int16 function) {
WRITE_VAR(13, _vm->_global->_useMouse);
WRITE_VAR(14, _vm->_global->_soundFlags);
WRITE_VAR(15, _vm->_global->_fakeVideoMode);
- WRITE_VAR(16, _vm->_global->_language);
+
+ if (_vm->getGameType() == kGameTypeGeisha)
+ WRITE_VAR(57, _vm->_global->_language);
+ else
+ WRITE_VAR(16, _vm->_global->_language);
// WORKAROUND: Inca2 seems to depend on that variable to be cleared
if (_vm->getGameType() == kGameTypeInca2)
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index 7bb7928406..51a117b7ec 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -422,6 +422,7 @@ bool GobEngine::initGameParts() {
_map = new Map_v1(this);
_goblin = new Goblin_v1(this);
_scenery = new Scenery_v1(this);
+ _saveLoad = new SaveLoad_Geisha(this, _targetName.c_str());
break;
case kGameTypeFascination:
diff --git a/engines/gob/hotspots.cpp b/engines/gob/hotspots.cpp
index f3647af76e..5e0af847de 100644
--- a/engines/gob/hotspots.cpp
+++ b/engines/gob/hotspots.cpp
@@ -202,6 +202,8 @@ Hotspots::Hotspots(GobEngine *vm) : _vm(vm) {
_currentKey = 0;
_currentIndex = 0;
_currentId = 0;
+ _currentX = 0;
+ _currentY = 0;
}
Hotspots::~Hotspots() {
@@ -385,6 +387,8 @@ void Hotspots::push(uint8 all, bool force) {
backup.key = _currentKey;
backup.id = _currentId;
backup.index = _currentIndex;
+ backup.x = _currentX;
+ backup.y = _currentY;
backup.hotspots = new Hotspot[size];
@@ -415,6 +419,8 @@ void Hotspots::push(uint8 all, bool force) {
_currentKey = 0;
_currentId = 0;
_currentIndex = 0;
+ _currentX = 0;
+ _currentY = 0;
_stack.push(backup);
}
@@ -445,6 +451,8 @@ void Hotspots::pop() {
_currentKey = backup.key;
_currentId = backup.id;
_currentIndex = backup.index;
+ _currentX = backup.x;
+ _currentY = backup.y;
delete[] backup.hotspots;
}
@@ -498,6 +506,9 @@ void Hotspots::enter(uint16 index) {
(spot.getState() == (kStateFilled | kStateType2)))
WRITE_VAR(17, -(spot.id & 0x0FFF));
+ _currentX = _vm->_global->_inter_mouseX;
+ _currentY = _vm->_global->_inter_mouseY;
+
if (spot.funcEnter != 0)
call(spot.funcEnter);
}
@@ -649,9 +660,22 @@ bool Hotspots::checkHotspotChanged() {
// Get the current hotspot
key = checkMouse(kTypeMove, id, index);
- if (key == _currentKey)
- // Nothing changed => nothing to do
+ uint16 mouseX = _vm->_global->_inter_mouseX;
+ uint16 mouseY = _vm->_global->_inter_mouseY;
+
+ if (key == _currentKey) {
+ // Still the same hotspot, just update the mouse position
+
+ _currentX = mouseX;
+ _currentY = mouseY;
return false;
+ }
+
+ // In Geisha, no move hotspot changes should occur when
+ // we didn't actually move the mouse
+ if (_vm->getGameType() == kGameTypeGeisha)
+ if ((mouseX == _currentX) && (mouseY == _currentY))
+ return false;
// Leave the old area
if (isValid(_currentKey, _currentId,_currentIndex))
@@ -660,6 +684,8 @@ bool Hotspots::checkHotspotChanged() {
_currentKey = key;
_currentId = id;
_currentIndex = index;
+ _currentX = mouseX;
+ _currentY = mouseY;
// Enter the new one
if (isValid(key, id, index))
@@ -775,7 +801,8 @@ uint16 Hotspots::check(uint8 handleMouse, int16 delay, uint16 &id, uint16 &index
_vm->_draw->blitCursor();
- if ((key != _currentKey) && (_vm->getGameType() != kGameTypeFascination))
+ if ((key != _currentKey) && (_vm->getGameType() != kGameTypeFascination) &&
+ (_vm->getGameType() != kGameTypeGeisha))
// If the hotspot changed, leave the old one
// Code not present in Fascination executables
leave(_currentIndex);
@@ -1348,12 +1375,12 @@ void Hotspots::evaluateNew(uint16 i, uint16 *ids, InputDesc *inputs,
inputs[inputCount].str = 0;
if ((type >= kTypeInput2NoLeave) && (type <= kTypeInput3Leave)) {
- uint16 length = _vm->_game->_script->readUint16();
+ inputs[inputCount].length = _vm->_game->_script->readUint16();
inputs[inputCount].str =
(const char *)(_vm->_game->_script->getData() + _vm->_game->_script->pos());
- _vm->_game->_script->skip(length);
+ _vm->_game->_script->skip(inputs[inputCount].length);
}
if (left == 0xFFFF) {
diff --git a/engines/gob/hotspots.h b/engines/gob/hotspots.h
index 8d26ad224e..b348f9cd70 100644
--- a/engines/gob/hotspots.h
+++ b/engines/gob/hotspots.h
@@ -158,6 +158,8 @@ private:
uint32 key;
uint32 id;
uint32 index;
+ uint16 x;
+ uint16 y;
};
struct InputDesc {
@@ -178,6 +180,8 @@ private:
uint16 _currentKey;
uint16 _currentIndex;
uint16 _currentId;
+ uint16 _currentX;
+ uint16 _currentY;
/** Add a hotspot, returning the new index. */
uint16 add(const Hotspot &hotspot);
diff --git a/engines/gob/init.cpp b/engines/gob/init.cpp
index 90c2a1602a..a61261f355 100644
--- a/engines/gob/init.cpp
+++ b/engines/gob/init.cpp
@@ -40,7 +40,7 @@
namespace Gob {
-const char *Init::_fontNames[] = { "jeulet1.let", "jeulet2.let", "jeucar1.let", "jeumath.let" };
+const char *const Init::_fontNames[] = { "jeulet1.let", "jeulet2.let", "jeucar1.let", "jeumath.let" };
Init::Init(GobEngine *vm) : _vm(vm) {
_palDesc = 0;
diff --git a/engines/gob/init.h b/engines/gob/init.h
index e8c948c72e..946a3fa4f1 100644
--- a/engines/gob/init.h
+++ b/engines/gob/init.h
@@ -41,7 +41,7 @@ public:
protected:
Video::PalDesc *_palDesc;
- static const char *_fontNames[4];
+ static const char *const _fontNames[4];
GobEngine *_vm;
void cleanup();
@@ -62,6 +62,7 @@ public:
~Init_Geisha();
void initVideo();
+ void initGame();
};
class Init_v2 : public Init_v1 {
diff --git a/engines/gob/init_geisha.cpp b/engines/gob/init_geisha.cpp
index 01081a5af6..b5bbcff400 100644
--- a/engines/gob/init_geisha.cpp
+++ b/engines/gob/init_geisha.cpp
@@ -44,4 +44,11 @@ void Init_Geisha::initVideo() {
_vm->_draw->_transparentCursor = 1;
}
+void Init_Geisha::initGame() {
+ // HACK - Since the MDY/TBR player is not working, claim we have no AdLib
+ _vm->_global->_soundFlags = 0;
+
+ Init::initGame();
+}
+
} // End of namespace Gob
diff --git a/engines/gob/init_v6.cpp b/engines/gob/init_v6.cpp
index 947556835a..6059ec89ed 100644
--- a/engines/gob/init_v6.cpp
+++ b/engines/gob/init_v6.cpp
@@ -46,9 +46,8 @@ void Init_v6::initGame() {
// WORKAROUND: The CD number detection in Urban Runner is quite daft
// (it checks CD1.ITK - CD4.ITK and the first that's found determines
- // the CD number), while its NO_CD modus wants everything in CD1.ITK.
+ // the CD number), while its NO_CD mode wants everything in CD1.ITK.
// So we just open the other ITKs, too.
- _vm->_dataIO->openArchive("CD1.ITK", false);
_vm->_dataIO->openArchive("CD2.ITK", false);
_vm->_dataIO->openArchive("CD3.ITK", false);
_vm->_dataIO->openArchive("CD4.ITK", false);
diff --git a/engines/gob/inter.h b/engines/gob/inter.h
index 84180f407d..6fd4dc2187 100644
--- a/engines/gob/inter.h
+++ b/engines/gob/inter.h
@@ -33,6 +33,11 @@
namespace Gob {
+namespace Geisha {
+ class Diving;
+ class Penetration;
+}
+
// This is to help devices with small memory (PDA, smartphones, ...)
// to save a bit of memory used by opcode names in the Gob engine.
#ifndef REDUCE_MEMORY_USAGE
@@ -337,7 +342,7 @@ protected:
class Inter_Geisha : public Inter_v1 {
public:
Inter_Geisha(GobEngine *vm);
- virtual ~Inter_Geisha() {}
+ virtual ~Inter_Geisha();
protected:
virtual void setupOpcodesDraw();
@@ -345,9 +350,12 @@ protected:
virtual void setupOpcodesGob();
void oGeisha_loadCursor(OpFuncParams &params);
+ void oGeisha_loadTot(OpFuncParams &params);
void oGeisha_goblinFunc(OpFuncParams &params);
void oGeisha_loadSound(OpFuncParams &params);
void oGeisha_checkData(OpFuncParams &params);
+ void oGeisha_readData(OpFuncParams &params);
+ void oGeisha_writeData(OpFuncParams &params);
void oGeisha_gamePenetration(OpGobParams &params);
void oGeisha_gameDiving(OpGobParams &params);
@@ -359,6 +367,10 @@ protected:
void oGeisha_caress2(OpGobParams &params);
int16 loadSound(int16 slot);
+
+private:
+ Geisha::Diving *_diving;
+ Geisha::Penetration *_penetration;
};
class Inter_v2 : public Inter_v1 {
diff --git a/engines/gob/inter_bargon.cpp b/engines/gob/inter_bargon.cpp
index c2e6a2e912..134203fa9d 100644
--- a/engines/gob/inter_bargon.cpp
+++ b/engines/gob/inter_bargon.cpp
@@ -120,7 +120,7 @@ void Inter_Bargon::oBargon_intro2(OpGobParams &params) {
SurfacePtr surface;
SoundDesc samples[4];
int16 comp[5] = { 0, 1, 2, 3, -1 };
- static const char *sndFiles[] = {"1INTROII.snd", "2INTROII.snd", "1INTRO3.snd", "2INTRO3.snd"};
+ static const char *const sndFiles[] = {"1INTROII.snd", "2INTROII.snd", "1INTRO3.snd", "2INTRO3.snd"};
surface = _vm->_video->initSurfDesc(320, 200);
_vm->_video->drawPackedSprite("2ille.ims", *surface);
@@ -169,8 +169,8 @@ void Inter_Bargon::oBargon_intro3(OpGobParams &params) {
SoundDesc samples[2];
int16 comp[3] = { 0, 1, -1 };
byte *palettes[4];
- static const char *sndFiles[] = {"1INTROIV.snd", "2INTROIV.snd"};
- static const char *palFiles[] = {"2ou2.clt", "2ou3.clt", "2ou4.clt", "2ou5.clt"};
+ static const char *const sndFiles[] = {"1INTROIV.snd", "2INTROIV.snd"};
+ static const char *const palFiles[] = {"2ou2.clt", "2ou3.clt", "2ou4.clt", "2ou5.clt"};
int32 size;
diff --git a/engines/gob/inter_geisha.cpp b/engines/gob/inter_geisha.cpp
index 658f2346f4..c5b91a484b 100644
--- a/engines/gob/inter_geisha.cpp
+++ b/engines/gob/inter_geisha.cpp
@@ -21,6 +21,10 @@
*/
#include "common/endian.h"
+#include "common/str.h"
+#include "common/translation.h"
+
+#include "gui/message.h"
#include "gob/gob.h"
#include "gob/inter.h"
@@ -30,9 +34,13 @@
#include "gob/game.h"
#include "gob/draw.h"
#include "gob/video.h"
+#include "gob/save/saveload.h"
#include "gob/sound/sound.h"
#include "gob/sound/sounddesc.h"
+#include "gob/minigames/geisha/diving.h"
+#include "gob/minigames/geisha/penetration.h"
+
namespace Gob {
#define OPCODEVER Inter_Geisha
@@ -40,7 +48,16 @@ namespace Gob {
#define OPCODEFUNC(i, x) _opcodesFunc[i]._OPCODEFUNC(OPCODEVER, x)
#define OPCODEGOB(i, x) _opcodesGob[i]._OPCODEGOB(OPCODEVER, x)
-Inter_Geisha::Inter_Geisha(GobEngine *vm) : Inter_v1(vm) {
+Inter_Geisha::Inter_Geisha(GobEngine *vm) : Inter_v1(vm),
+ _diving(0), _penetration(0) {
+
+ _diving = new Geisha::Diving(vm);
+ _penetration = new Geisha::Penetration(vm);
+}
+
+Inter_Geisha::~Inter_Geisha() {
+ delete _penetration;
+ delete _diving;
}
void Inter_Geisha::setupOpcodesDraw() {
@@ -51,9 +68,12 @@ void Inter_Geisha::setupOpcodesFunc() {
Inter_v1::setupOpcodesFunc();
OPCODEFUNC(0x03, oGeisha_loadCursor);
+ OPCODEFUNC(0x12, oGeisha_loadTot);
OPCODEFUNC(0x25, oGeisha_goblinFunc);
OPCODEFUNC(0x3A, oGeisha_loadSound);
OPCODEFUNC(0x3F, oGeisha_checkData);
+ OPCODEFUNC(0x4D, oGeisha_readData);
+ OPCODEFUNC(0x4E, oGeisha_writeData);
OPCODEGOB(0, oGeisha_gamePenetration);
OPCODEGOB(1, oGeisha_gameDiving);
@@ -74,6 +94,50 @@ void Inter_Geisha::oGeisha_loadCursor(OpFuncParams &params) {
o1_loadCursor(params);
}
+struct TOTTransition {
+ const char *to;
+ const char *from;
+ int32 offset;
+};
+
+static const TOTTransition kTOTTransitions[] = {
+ {"chambre.tot", "photo.tot" , 1801},
+ {"mo.tot" , "chambre.tot", 13580},
+ {"chambre.tot", "mo.tot" , 564},
+ {"hard.tot" , "chambre.tot", 13917},
+ {"carte.tot" , "hard.tot" , 17926},
+ {"chambre.tot", "carte.tot" , 14609},
+ {"chambre.tot", "mo.tot" , 3658},
+ {"streap.tot" , "chambre.tot", 14652},
+ {"bonsai.tot" , "porte.tot" , 2858},
+ {"lit.tot" , "napa.tot" , 3380},
+ {"oko.tot" , "chambre.tot", 14146},
+ {"chambre.tot", "oko.tot" , 2334}
+};
+
+void Inter_Geisha::oGeisha_loadTot(OpFuncParams &params) {
+ o1_loadTot(params);
+
+ // WORKAROUND: Geisha often displays text while it loads a new TOT.
+ // Back in the days, this took long enough so that the text
+ // could be read. Since this isn't the case anymore, we'll
+ // wait for the user to press a key or click the mouse.
+ bool needWait = false;
+
+ for (int i = 0; i < ARRAYSIZE(kTOTTransitions); i++)
+ if ((_vm->_game->_script->pos() == kTOTTransitions[i].offset) &&
+ (_vm->_game->_totToLoad == kTOTTransitions[i].to) &&
+ (_vm->_game->_curTotFile == kTOTTransitions[i].from)) {
+
+ needWait = true;
+ break;
+ }
+
+ if (needWait)
+ while (!_vm->_util->keyPressed())
+ _vm->_util->longDelay(1);
+}
+
void Inter_Geisha::oGeisha_loadSound(OpFuncParams &params) {
loadSound(-1);
}
@@ -114,47 +178,109 @@ int16 Inter_Geisha::loadSound(int16 slot) {
}
void Inter_Geisha::oGeisha_checkData(OpFuncParams &params) {
- const char *file = _vm->_game->_script->evalString();
- int16 varOff = _vm->_game->_script->readVarIndex();
+ Common::String file = _vm->_game->_script->evalString();
+ int16 varOff = _vm->_game->_script->readVarIndex();
+
+ file.toLowercase();
+ if (file.hasSuffix(".0ot"))
+ file.setChar('t', file.size() - 3);
+
+ bool exists = false;
- Common::String fileName(file);
+ SaveLoad::SaveMode mode = _vm->_saveLoad->getSaveMode(file.c_str());
+ if (mode == SaveLoad::kSaveModeNone) {
- fileName.toLowercase();
- if (fileName.hasSuffix(".0ot"))
- fileName.setChar('t', fileName.size() - 3);
+ exists = _vm->_dataIO->hasFile(file);
+ if (!exists)
+ warning("File \"%s\" not found", file.c_str());
- if (!_vm->_dataIO->hasFile(fileName)) {
- warning("File \"%s\" not found", fileName.c_str());
- WRITE_VAR_OFFSET(varOff, (uint32) -1);
- } else
- WRITE_VAR_OFFSET(varOff, 50); // "handle" between 50 and 128 = in archive
+ } else if (mode == SaveLoad::kSaveModeSave)
+ exists = _vm->_saveLoad->getSize(file.c_str()) >= 0;
+ else if (mode == SaveLoad::kSaveModeExists)
+ exists = true;
+
+ WRITE_VAR_OFFSET(varOff, exists ? 50 : (uint32)-1);
}
-void Inter_Geisha::oGeisha_gamePenetration(OpGobParams &params) {
- uint16 var1 = _vm->_game->_script->readUint16();
- uint16 var2 = _vm->_game->_script->readUint16();
- uint16 var3 = _vm->_game->_script->readUint16();
- uint16 var4 = _vm->_game->_script->readUint16();
+void Inter_Geisha::oGeisha_readData(OpFuncParams &params) {
+ const char *file = _vm->_game->_script->evalString();
+
+ uint16 dataVar = _vm->_game->_script->readVarIndex();
+
+ debugC(2, kDebugFileIO, "Read from file \"%s\" (%d)", file, dataVar);
+
+ WRITE_VAR(1, 1);
+
+ SaveLoad::SaveMode mode = _vm->_saveLoad->getSaveMode(file);
+ if (mode == SaveLoad::kSaveModeSave) {
+
+ if (!_vm->_saveLoad->load(file, dataVar, 0, 0)) {
+
+ GUI::MessageDialog dialog(_("Failed to load game state from file."));
+ dialog.runModal();
+
+ } else
+ WRITE_VAR(1, 0);
- WRITE_VAR_UINT32(var4, 0);
+ return;
- warning("Geisha Stub: Minigame \"Penetration\": %d, %d, %d, %d", var1, var2, var3, var4);
+ } else if (mode == SaveLoad::kSaveModeIgnore) {
+ WRITE_VAR(1, 0);
+ return;
+ }
- // Fudge a win for now
- WRITE_VAR_UINT32(var4, 1);
+ warning("Attempted to read from file \"%s\"", file);
}
-void Inter_Geisha::oGeisha_gameDiving(OpGobParams &params) {
- uint16 var1 = _vm->_game->_script->readUint16();
- uint16 var2 = _vm->_game->_script->readUint16();
- uint16 var3 = _vm->_game->_script->readUint16();
+void Inter_Geisha::oGeisha_writeData(OpFuncParams &params) {
+ const char *file = _vm->_game->_script->evalString();
+
+ int16 dataVar = _vm->_game->_script->readVarIndex();
+ int32 size = _vm->_game->_script->readValExpr();
+
+ debugC(2, kDebugFileIO, "Write to file \"%s\" (%d, %d bytes)", file, dataVar, size);
+
+ WRITE_VAR(1, 1);
+
+ SaveLoad::SaveMode mode = _vm->_saveLoad->getSaveMode(file);
+ if (mode == SaveLoad::kSaveModeSave) {
+
+ if (!_vm->_saveLoad->save(file, dataVar, size, 0)) {
+
+ GUI::MessageDialog dialog(_("Failed to save game state to file."));
+ dialog.runModal();
+
+ } else
+ WRITE_VAR(1, 0);
- WRITE_VAR_UINT32(var3, 1);
+ } else if (mode == SaveLoad::kSaveModeIgnore) {
+ WRITE_VAR(1, 0);
+ return;
+ } else if (mode == SaveLoad::kSaveModeNone)
+ warning("Attempted to write to file \"%s\"", file);
+
+ WRITE_VAR(1, 0);
+}
+
+void Inter_Geisha::oGeisha_gamePenetration(OpGobParams &params) {
+ uint16 var1 = _vm->_game->_script->readUint16();
+ uint16 var2 = _vm->_game->_script->readUint16();
+ uint16 var3 = _vm->_game->_script->readUint16();
+ uint16 resultVar = _vm->_game->_script->readUint16();
+
+ bool result = _penetration->play(var1, var2, var3);
+
+ WRITE_VAR_UINT32(resultVar, result ? 1 : 0);
+}
+
+void Inter_Geisha::oGeisha_gameDiving(OpGobParams &params) {
+ uint16 playerCount = _vm->_game->_script->readUint16();
+ uint16 hasPearlLocation = _vm->_game->_script->readUint16();
+ uint16 resultVar = _vm->_game->_script->readUint16();
- warning("Geisha Stub: Minigame \"Diving\": %d, %d, %d", var1, var2, var3);
+ bool result = _diving->play(playerCount, hasPearlLocation);
- // Fudge a win for now
- WRITE_VAR_UINT32(var3, 0);
+ WRITE_VAR_UINT32(resultVar, result ? 1 : 0);
}
void Inter_Geisha::oGeisha_loadTitleMusic(OpGobParams &params) {
diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp
index 589328dfdb..505993ee4d 100644
--- a/engines/gob/inter_v6.cpp
+++ b/engines/gob/inter_v6.cpp
@@ -21,7 +21,6 @@
*/
#include "common/str.h"
-#include "graphics/dither.h"
#include "gob/gob.h"
#include "gob/inter.h"
diff --git a/engines/gob/minigames/geisha/diving.cpp b/engines/gob/minigames/geisha/diving.cpp
new file mode 100644
index 0000000000..e3bc69a503
--- /dev/null
+++ b/engines/gob/minigames/geisha/diving.cpp
@@ -0,0 +1,439 @@
+/* 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 "common/list.h"
+
+#include "gob/global.h"
+#include "gob/draw.h"
+#include "gob/video.h"
+#include "gob/decfile.h"
+#include "gob/anifile.h"
+
+#include "gob/sound/sound.h"
+
+#include "gob/minigames/geisha/evilfish.h"
+#include "gob/minigames/geisha/diving.h"
+
+namespace Gob {
+
+namespace Geisha {
+
+static const int kEvilFishTypeCount = 3;
+
+static const int kEvilFishTypes[kEvilFishTypeCount][5] = {
+ { 0, 14, 8, 9, 3}, // Shark
+ {15, 1, 12, 13, 3}, // Moray
+ {16, 2, 10, 11, 3} // Ray
+};
+
+
+Diving::Diving(GobEngine *vm) : _vm(vm), _background(0),
+ _objects(0), _gui(0), _oko(0), _lungs(0), _heart(0),
+ _blackPearl(0), _whitePearlCount(0), _blackPearlCount(0) {
+
+ _blackPearl = new Surface(11, 8, 1);
+}
+
+Diving::~Diving() {
+ delete _blackPearl;
+
+ deinit();
+}
+
+bool Diving::play(uint16 playerCount, bool hasPearlLocation) {
+ init();
+ initScreen();
+ initCursor();
+
+ _vm->_draw->blitInvalidated();
+ _vm->_video->retrace();
+
+ while (!_vm->shouldQuit()) {
+ checkShots();
+ updateEvilFish();
+ updateDecorFish();
+ updateAnims();
+
+ _vm->_draw->animateCursor(1);
+
+ _vm->_draw->blitInvalidated();
+
+ _vm->_util->waitEndFrame();
+ _vm->_util->processInput();
+
+ int16 mouseX, mouseY;
+ MouseButtons mouseButtons;
+
+ int16 key = checkInput(mouseX, mouseY, mouseButtons);
+ if (key == kKeyEscape)
+ break;
+
+ if (mouseButtons == kMouseButtonsLeft)
+ shoot(mouseX, mouseY);
+
+ if ((_whitePearlCount >= 20) || (_blackPearlCount >= 2))
+ break;
+ }
+
+ deinit();
+ return _blackPearlCount >= 2;
+}
+
+void Diving::init() {
+ _background = new DECFile(_vm, "tperle.dec" , 320, 200);
+ _objects = new ANIFile(_vm, "tperle.ani" , 320);
+ _gui = new ANIFile(_vm, "tperlcpt.ani", 320);
+ _oko = new ANIFile(_vm, "tplonge.ani" , 320);
+
+ _water = new ANIObject(*_objects);
+ _lungs = new ANIObject(*_gui);
+ _heart = new ANIObject(*_gui);
+
+ _water->setAnimation(7);
+ _water->setPosition();
+ _water->setVisible(true);
+
+ _lungs->setAnimation(0);
+ _lungs->setPosition();
+ _lungs->setVisible(true);
+ _lungs->setPause(true);
+
+ _heart->setAnimation(1);
+ _heart->setPosition();
+ _heart->setVisible(true);
+ _heart->setPause(true);
+
+ for (uint i = 0; i < kEvilFishCount; i++) {
+ _evilFish[i].enterAt = 0;
+ _evilFish[i].leaveAt = 0;
+
+ _evilFish[i].evilFish = new EvilFish(*_objects, 320, 0, 0, 0, 0, 0);
+ }
+
+ for (uint i = 0; i < kDecorFishCount; i++) {
+ _decorFish[i].enterAt = 0;
+
+ _decorFish[i].decorFish = new ANIObject(*_objects);
+ }
+
+ _decorFish[0].decorFish->setAnimation( 6); // Jellyfish
+ _decorFish[0].deltaX = 0;
+
+ _decorFish[1].decorFish->setAnimation(32); // Swarm of red/green fish
+ _decorFish[1].deltaX = -6;
+
+ _decorFish[2].decorFish->setAnimation(33); // Swarm of orange fish
+ _decorFish[2].deltaX = -6;
+
+ for (uint i = 0; i < kMaxShotCount; i++) {
+ _shot[i] = new ANIObject(*_objects);
+
+ _shot[i]->setAnimation(17);
+ _shot[i]->setMode(ANIObject::kModeOnce);
+ }
+
+ Surface tmp(320, 103, 1);
+
+ _vm->_video->drawPackedSprite("tperlobj.cmp", tmp);
+
+ _blackPearl->blit(tmp, 282, 80, 292, 87, 0, 0);
+
+ _blackPearlCount = 0;
+
+ _currentShot = 0;
+
+ _anims.push_back(_water);
+ for (uint i = 0; i < kMaxShotCount; i++)
+ _anims.push_back(_shot[i]);
+ for (uint i = 0; i < kDecorFishCount; i++)
+ _anims.push_back(_decorFish[i].decorFish);
+ for (uint i = 0; i < kEvilFishCount; i++)
+ _anims.push_back(_evilFish[i].evilFish);
+ _anims.push_back(_lungs);
+ _anims.push_back(_heart);
+
+ _vm->_sound->sampleLoad(&_soundShoot , SOUND_SND, "tirgim.snd");
+ _vm->_sound->sampleLoad(&_soundBreathe , SOUND_SND, "respir.snd");
+ _vm->_sound->sampleLoad(&_soundWhitePearl, SOUND_SND, "virtou.snd");
+ _vm->_sound->sampleLoad(&_soundBlackPearl, SOUND_SND, "trouve.snd");
+}
+
+void Diving::deinit() {
+ _vm->_draw->_cursorHotspotX = -1;
+ _vm->_draw->_cursorHotspotY = -1;
+
+ _soundShoot.free();
+ _soundBreathe.free();
+ _soundWhitePearl.free();
+ _soundBlackPearl.free();
+
+ _anims.clear();
+
+ _activeShots.clear();
+
+ for (uint i = 0; i < kMaxShotCount; i++) {
+ delete _shot[i];
+
+ _shot[i] = 0;
+ }
+
+ for (uint i = 0; i < kEvilFishCount; i++) {
+ delete _evilFish[i].evilFish;
+
+ _evilFish[i].evilFish = 0;
+ }
+
+ for (uint i = 0; i < kDecorFishCount; i++) {
+ delete _decorFish[i].decorFish;
+
+ _decorFish[i].decorFish = 0;
+ }
+
+ delete _heart;
+ delete _lungs;
+ delete _water;
+
+ delete _oko;
+ delete _gui;
+ delete _objects;
+ delete _background;
+
+ _water = 0;
+ _heart = 0;
+ _lungs = 0;
+
+ _oko = 0;
+ _gui = 0;
+ _objects = 0;
+ _background = 0;
+}
+
+void Diving::initScreen() {
+ _vm->_util->setFrameRate(15);
+
+ _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
+
+ _vm->_draw->_backSurface->clear();
+ _background->draw(*_vm->_draw->_backSurface);
+
+ int16 left, top, right, bottom;
+ _lungs->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
+ _heart->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
+
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 0, 0, 319, 199);
+}
+
+void Diving::initCursor() {
+ const int index = _vm->_draw->_cursorIndex;
+
+ const int16 left = index * _vm->_draw->_cursorWidth;
+ const int16 top = 0;
+ const int16 right = left + _vm->_draw->_cursorWidth - 1;
+ const int16 bottom = _vm->_draw->_cursorHeight - 1;
+
+ _vm->_draw->_cursorSprites->fillRect(left, top, right, bottom, 0);
+
+ _objects->draw(*_vm->_draw->_cursorSprites, 31, 0, left, top);
+ _vm->_draw->_cursorAnimLow[index] = 0;
+
+ _vm->_draw->_cursorHotspotX = 8;
+ _vm->_draw->_cursorHotspotY = 8;
+}
+
+void Diving::updateEvilFish() {
+ for (uint i = 0; i < kEvilFishCount; i++) {
+ ManagedEvilFish &fish = _evilFish[i];
+
+ if (fish.evilFish->isVisible()) {
+ // Evil fishes leave on their own after 30s - 40s
+
+ fish.enterAt = 0;
+
+ if (fish.leaveAt == 0)
+ fish.leaveAt = _vm->_util->getTimeKey() + 30000 + _vm->_util->getRandom(10000);
+
+ if (_vm->_util->getTimeKey() >= fish.leaveAt)
+ fish.evilFish->leave();
+
+ } else {
+ // Evil fishes enter the screen in 2s - 10s
+
+ fish.leaveAt = 0;
+
+ if (fish.enterAt == 0)
+ fish.enterAt = _vm->_util->getTimeKey() + 2000 + _vm->_util->getRandom(8000);
+
+ if (_vm->_util->getTimeKey() >= fish.enterAt) {
+ int fishType = _vm->_util->getRandom(kEvilFishTypeCount);
+ fish.evilFish->mutate(kEvilFishTypes[fishType][0], kEvilFishTypes[fishType][1],
+ kEvilFishTypes[fishType][2], kEvilFishTypes[fishType][3],
+ kEvilFishTypes[fishType][4]);
+
+ fish.evilFish->enter((EvilFish::Direction)_vm->_util->getRandom(2),
+ 36 + _vm->_util->getRandom(3) * 40);
+ }
+ }
+ }
+}
+
+void Diving::updateDecorFish() {
+ for (uint i = 0; i < kDecorFishCount; i++) {
+ ManagedDecorFish &fish = _decorFish[i];
+
+ if (fish.decorFish->isVisible()) {
+ // Move the fish
+ int16 x, y;
+ fish.decorFish->getPosition(x, y);
+ fish.decorFish->setPosition(x + fish.deltaX, y);
+
+ // Check if the fish has left the screen
+ int16 width, height;
+ fish.decorFish->getFramePosition(x, y);
+ fish.decorFish->getFrameSize(width, height);
+
+ if ((x + width) <= 0) {
+ fish.decorFish->setVisible(false);
+ fish.decorFish->setPause(true);
+
+ fish.enterAt = 0;
+ }
+
+ } else {
+ // Decor fishes enter the screen every 0s - 10s
+
+ if (fish.enterAt == 0)
+ fish.enterAt = _vm->_util->getTimeKey() + _vm->_util->getRandom(10000);
+
+ if (_vm->_util->getTimeKey() >= fish.enterAt) {
+ fish.decorFish->rewind();
+ fish.decorFish->setPosition(320, 30 + _vm->_util->getRandom(100));
+ fish.decorFish->setVisible(true);
+ fish.decorFish->setPause(false);
+ }
+ }
+ }
+}
+
+void Diving::foundBlackPearl() {
+ _blackPearlCount++;
+
+ if (_blackPearlCount == 1) {
+ _vm->_draw->_backSurface->blit(*_blackPearl, 0, 0, 10, 7, 147, 179, 0);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 147, 179, 157, 186);
+ } else if (_blackPearlCount == 2) {
+ _vm->_draw->_backSurface->blit(*_blackPearl, 0, 0, 10, 7, 160, 179, 0);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 147, 179, 160, 186);
+ }
+}
+
+void Diving::foundWhitePearl() {
+ _whitePearlCount++;
+
+ int16 x = 54 + (_whitePearlCount - 1) * 8;
+ if (_whitePearlCount > 10)
+ x += 48;
+
+ _background->drawLayer(*_vm->_draw->_backSurface, 0, 2, x, 177, 0);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, x, 177, x + 3, 180);
+}
+
+void Diving::updateAnims() {
+ int16 left, top, right, bottom;
+
+ // Clear the previous animation frames
+ for (Common::List<ANIObject *>::iterator a = _anims.reverse_begin();
+ a != _anims.end(); --a) {
+
+ (*a)->clear(*_vm->_draw->_backSurface, left, top, right, bottom);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+ }
+
+ // Draw the current animation frames
+ for (Common::List<ANIObject *>::iterator a = _anims.begin();
+ a != _anims.end(); ++a) {
+
+ (*a)->draw(*_vm->_draw->_backSurface, left, top, right, bottom);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, left, top, right, bottom);
+
+ (*a)->advance();
+ }
+}
+
+int16 Diving::checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons) {
+ _vm->_util->getMouseState(&mouseX, &mouseY, &mouseButtons);
+
+ return _vm->_util->checkKey();
+}
+
+void Diving::shoot(int16 mouseX, int16 mouseY) {
+ // Outside the playable area?
+ if (mouseY > 157)
+ return;
+
+ // Too many shots still active?
+ if (_activeShots.size() >= kMaxShotCount)
+ return;
+
+ ANIObject &shot = *_shot[_currentShot];
+
+ shot.rewind();
+ shot.setVisible(true);
+ shot.setPause(false);
+ shot.setPosition(mouseX - 8, mouseY - 8);
+
+ _activeShots.push_back(_currentShot);
+
+ _currentShot = (_currentShot + 1) % kMaxShotCount;
+
+ _vm->_sound->blasterPlay(&_soundShoot, 1, 0);
+}
+
+void Diving::checkShots() {
+ Common::List<int>::iterator activeShot = _activeShots.begin();
+
+ while (activeShot != _activeShots.end()) {
+ ANIObject &shot = *_shot[*activeShot];
+
+ if (shot.lastFrame()) {
+ int16 x, y;
+
+ shot.getPosition(x, y);
+
+ for (uint i = 0; i < kEvilFishCount; i++) {
+ EvilFish &evilFish = *_evilFish[i].evilFish;
+
+ if (evilFish.isIn(x + 8, y + 8)) {
+ evilFish.die();
+
+ break;
+ }
+ }
+
+ activeShot = _activeShots.erase(activeShot);
+ } else
+ ++activeShot;
+ }
+}
+
+} // End of namespace Geisha
+
+} // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/diving.h b/engines/gob/minigames/geisha/diving.h
new file mode 100644
index 0000000000..e386d783d7
--- /dev/null
+++ b/engines/gob/minigames/geisha/diving.h
@@ -0,0 +1,127 @@
+/* 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.
+ *
+ */
+
+#ifndef GOB_MINIGAMES_GEISHA_DIVING_H
+#define GOB_MINIGAMES_GEISHA_DIVING_H
+
+#include "common/system.h"
+
+#include "gob/util.h"
+
+#include "gob/sound/sounddesc.h"
+
+namespace Gob {
+
+class GobEngine;
+class Surface;
+class DECFile;
+class ANIFile;
+class ANIObject;
+
+namespace Geisha {
+
+class EvilFish;
+
+/** Geisha's "Diving" minigame. */
+class Diving {
+public:
+ Diving(GobEngine *vm);
+ ~Diving();
+
+ bool play(uint16 playerCount, bool hasPearlLocation);
+
+private:
+ static const uint kEvilFishCount = 3;
+ static const uint kDecorFishCount = 3;
+ static const uint kMaxShotCount = 10;
+
+ struct ManagedEvilFish {
+ EvilFish *evilFish;
+
+ uint32 enterAt;
+ uint32 leaveAt;
+ };
+
+ struct ManagedDecorFish {
+ ANIObject *decorFish;
+
+ uint32 enterAt;
+ int8 deltaX;
+ };
+
+ GobEngine *_vm;
+
+ DECFile *_background;
+ ANIFile *_objects;
+ ANIFile *_gui;
+ ANIFile *_oko;
+
+ ANIObject *_water;
+ ANIObject *_lungs;
+ ANIObject *_heart;
+
+ ManagedEvilFish _evilFish[kEvilFishCount];
+ ManagedDecorFish _decorFish[kDecorFishCount];
+
+ ANIObject *_shot[kMaxShotCount];
+
+ Common::List<int> _activeShots;
+
+ Common::List<ANIObject *> _anims;
+
+ Surface *_blackPearl;
+
+ uint8 _whitePearlCount;
+ uint8 _blackPearlCount;
+
+ uint8 _currentShot;
+
+ SoundDesc _soundShoot;
+ SoundDesc _soundBreathe;
+ SoundDesc _soundWhitePearl;
+ SoundDesc _soundBlackPearl;
+
+
+ void init();
+ void deinit();
+
+ void initScreen();
+ void initCursor();
+
+ void foundBlackPearl();
+ void foundWhitePearl();
+
+ void updateEvilFish();
+ void updateDecorFish();
+ void updateAnims();
+
+ int16 checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons);
+
+ void shoot(int16 mouseX, int16 mouseY);
+ void checkShots();
+};
+
+} // End of namespace Geisha
+
+} // End of namespace Gob
+
+#endif // GOB_MINIGAMES_GEISHA_DIVING_H
diff --git a/engines/gob/minigames/geisha/evilfish.cpp b/engines/gob/minigames/geisha/evilfish.cpp
new file mode 100644
index 0000000000..e9503f4aed
--- /dev/null
+++ b/engines/gob/minigames/geisha/evilfish.cpp
@@ -0,0 +1,189 @@
+/* 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 "gob/minigames/geisha/evilfish.h"
+
+namespace Gob {
+
+namespace Geisha {
+
+EvilFish::EvilFish(const ANIFile &ani, uint16 screenWidth,
+ uint16 animSwimLeft, uint16 animSwimRight,
+ uint16 animTurnLeft, uint16 animTurnRight, uint16 animDie) :
+ ANIObject(ani), _screenWidth(screenWidth),
+ _animSwimLeft(animSwimLeft), _animSwimRight(animSwimRight),
+ _animTurnLeft(animTurnLeft), _animTurnRight(animTurnRight), _animDie(animDie),
+ _shouldLeave(false), _state(kStateNone) {
+
+}
+
+EvilFish::~EvilFish() {
+}
+
+bool EvilFish::isIn(int16 x, int16 y) const {
+ int16 frameX, frameY, frameWidth, frameHeight;
+ getFramePosition(frameX, frameY);
+ getFrameSize(frameWidth, frameHeight);
+
+ if ((x < frameX) || (y < frameY))
+ return false;
+ if ((x > (frameX + frameWidth)) || (y > (frameY + frameHeight)))
+ return false;
+
+ return true;
+}
+
+void EvilFish::enter(Direction from, int16 y) {
+ _shouldLeave = false;
+
+ bool left = from == kDirectionLeft;
+
+ setAnimation(left ? _animSwimLeft : _animSwimRight);
+
+ int16 width, height;
+ getFrameSize(width, height);
+
+ setPosition(left ? -width : _screenWidth, y);
+ setVisible(true);
+
+ _state = left ? kStateSwimLeft : kStateSwimRight;
+}
+
+void EvilFish::leave() {
+ if (_state == kStateNone)
+ return;
+
+ _shouldLeave = true;
+}
+
+void EvilFish::die() {
+ if ((_state == kStateNone) || (_state == kStateDie))
+ return;
+
+ int16 x, y;
+ getFramePosition(x, y);
+
+ setAnimation(_animDie);
+ setPosition(x, y);
+
+ _state = kStateDie;
+}
+
+void EvilFish::advance() {
+ if (_state == kStateNone)
+ return;
+
+ bool wasLastFrame = lastFrame();
+
+ int16 oldX, oldY;
+ getPosition(oldX, oldY);
+
+ ANIObject::advance();
+
+ int16 x, y, width, height;
+ getFramePosition(x, y);
+ getFrameSize(width, height);
+
+ switch (_state) {
+ case kStateNone:
+ break;
+
+ case kStateSwimLeft:
+ if (!_shouldLeave && (x >= _screenWidth - width)) {
+ setAnimation(_animTurnRight);
+ setPosition(x, oldY);
+ _state = kStateTurnRight;
+ }
+
+ if (_shouldLeave && (x >= _screenWidth)) {
+ setVisible(false);
+
+ _shouldLeave = false;
+ _state = kStateNone;
+ }
+ break;
+
+ case kStateSwimRight:
+ if (!_shouldLeave && (x <= 0)) {
+ setAnimation(_animTurnLeft);
+ setPosition(x, oldY);
+ _state = kStateTurnLeft;
+ }
+
+ if (_shouldLeave && (x < -width)) {
+ setVisible(false);
+
+ _shouldLeave = false;
+ _state = kStateNone;
+ }
+ break;
+
+ case kStateTurnLeft:
+ if (wasLastFrame) {
+ setAnimation(_animSwimLeft);
+ _state = kStateSwimLeft;
+ }
+ break;
+
+ case kStateTurnRight:
+ if (wasLastFrame) {
+ setAnimation(_animSwimRight);
+ _state = kStateSwimRight;
+ }
+ break;
+
+ case kStateDie:
+ if (wasLastFrame) {
+ setVisible(false);
+
+ _state = kStateNone;
+ }
+ break;
+ }
+}
+
+void EvilFish::mutate(uint16 animSwimLeft, uint16 animSwimRight,
+ uint16 animTurnLeft, uint16 animTurnRight, uint16 animDie) {
+
+ _animSwimLeft = animSwimLeft;
+ _animSwimRight = animSwimRight;
+ _animTurnLeft = animTurnLeft;
+ _animTurnRight = animTurnRight;
+ _animDie = animDie;
+
+ switch (_state) {
+ case kStateSwimLeft:
+ setAnimation(_animSwimLeft);
+ break;
+
+ case kStateSwimRight:
+ setAnimation(_animSwimRight);
+ break;
+
+ default:
+ break;
+ }
+}
+
+} // End of namespace Geisha
+
+} // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/evilfish.h b/engines/gob/minigames/geisha/evilfish.h
new file mode 100644
index 0000000000..223645f47f
--- /dev/null
+++ b/engines/gob/minigames/geisha/evilfish.h
@@ -0,0 +1,90 @@
+/* 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.
+ *
+ */
+
+#ifndef GOB_MINIGAMES_GEISHA_EVILFISH_H
+#define GOB_MINIGAMES_GEISHA_EVILFISH_H
+
+#include "gob/aniobject.h"
+
+namespace Gob {
+
+namespace Geisha {
+
+/** An "evil" fish in Geisha's "Diving" minigame. */
+class EvilFish : public ANIObject {
+public:
+ enum Direction {
+ kDirectionLeft = 0,
+ kDirectionRight = 1
+ };
+
+ EvilFish(const ANIFile &ani, uint16 screenWidth,
+ uint16 animSwimLeft, uint16 animSwimRight,
+ uint16 animTurnLeft, uint16 animTurnRight, uint16 animDie);
+ ~EvilFish();
+
+ /** Are there coordinates within the fish's sprite? */
+ bool isIn(int16 x, int16 y) const;
+
+ /** Enter from this direction / screen edge. */
+ void enter(Direction from, int16 y);
+ /** Leave the screen in the current direction. */
+ void leave();
+
+ /** Kill the fish. */
+ void die();
+
+ /** Advance the animation to the next frame. */
+ void advance();
+
+ /** Change the fish's animations, effectively making it a different fish type. */
+ void mutate(uint16 animSwimLeft, uint16 animSwimRight,
+ uint16 animTurnLeft, uint16 animTurnRight, uint16 animDie);
+
+private:
+ enum State {
+ kStateNone,
+ kStateSwimLeft,
+ kStateSwimRight,
+ kStateTurnLeft,
+ kStateTurnRight,
+ kStateDie
+ };
+
+ uint16 _screenWidth;
+
+ uint16 _animSwimLeft;
+ uint16 _animSwimRight;
+ uint16 _animTurnLeft;
+ uint16 _animTurnRight;
+ uint16 _animDie;
+
+ bool _shouldLeave;
+
+ State _state;
+};
+
+} // End of namespace Geisha
+
+} // End of namespace Gob
+
+#endif // GOB_MINIGAMES_GEISHA_EVILFISH_H
diff --git a/engines/gob/minigames/geisha/penetration.cpp b/engines/gob/minigames/geisha/penetration.cpp
new file mode 100644
index 0000000000..121a45bc40
--- /dev/null
+++ b/engines/gob/minigames/geisha/penetration.cpp
@@ -0,0 +1,106 @@
+/* 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 "gob/global.h"
+#include "gob/util.h"
+#include "gob/draw.h"
+#include "gob/video.h"
+#include "gob/decfile.h"
+#include "gob/anifile.h"
+
+#include "gob/minigames/geisha/penetration.h"
+
+namespace Gob {
+
+namespace Geisha {
+
+static const byte kPalette[48] = {
+ 0x16, 0x16, 0x16,
+ 0x12, 0x14, 0x16,
+ 0x34, 0x00, 0x25,
+ 0x1D, 0x1F, 0x22,
+ 0x24, 0x27, 0x2A,
+ 0x2C, 0x0D, 0x22,
+ 0x2B, 0x2E, 0x32,
+ 0x12, 0x09, 0x20,
+ 0x3D, 0x3F, 0x00,
+ 0x3F, 0x3F, 0x3F,
+ 0x00, 0x00, 0x00,
+ 0x15, 0x15, 0x3F,
+ 0x25, 0x22, 0x2F,
+ 0x1A, 0x14, 0x28,
+ 0x3F, 0x00, 0x00,
+ 0x15, 0x3F, 0x15
+};
+
+Penetration::Penetration(GobEngine *vm) : _vm(vm), _background(0), _objects(0) {
+ _background = new Surface(320, 200, 1);
+}
+
+Penetration::~Penetration() {
+ deinit();
+
+ delete _background;
+}
+
+bool Penetration::play(uint16 var1, uint16 var2, uint16 var3) {
+ init();
+ initScreen();
+
+ _vm->_draw->blitInvalidated();
+ _vm->_video->retrace();
+ while (!_vm->_util->keyPressed() && !_vm->shouldQuit())
+ _vm->_util->longDelay(1);
+
+ deinit();
+ return true;
+}
+
+void Penetration::init() {
+ _background->clear();
+
+ _vm->_video->drawPackedSprite("hyprmef2.cmp", *_background);
+
+ _objects = new ANIFile(_vm, "tcite.ani", 320);
+}
+
+void Penetration::deinit() {
+ delete _objects;
+
+ _objects = 0;
+}
+
+void Penetration::initScreen() {
+ _vm->_util->setFrameRate(15);
+
+ memcpy(_vm->_draw->_vgaPalette , kPalette, 48);
+ memcpy(_vm->_draw->_vgaSmallPalette, kPalette, 48);
+
+ _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
+
+ _vm->_draw->_backSurface->blit(*_background);
+ _vm->_draw->dirtiedRect(_vm->_draw->_backSurface, 0, 0, 319, 199);
+}
+
+} // End of namespace Geisha
+
+} // End of namespace Gob
diff --git a/engines/gob/minigames/geisha/penetration.h b/engines/gob/minigames/geisha/penetration.h
new file mode 100644
index 0000000000..c346a7bf5a
--- /dev/null
+++ b/engines/gob/minigames/geisha/penetration.h
@@ -0,0 +1,61 @@
+/* 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.
+ *
+ */
+
+#ifndef GOB_MINIGAMES_GEISHA_PENETRATION_H
+#define GOB_MINIGAMES_GEISHA_PENETRATION_H
+
+#include "common/system.h"
+
+namespace Gob {
+
+class GobEngine;
+class Surface;
+class ANIFile;
+
+namespace Geisha {
+
+/** Geisha's "Penetration" minigame. */
+class Penetration {
+public:
+ Penetration(GobEngine *vm);
+ ~Penetration();
+
+ bool play(uint16 var1, uint16 var2, uint16 var3);
+
+private:
+ GobEngine *_vm;
+
+ Surface *_background;
+ ANIFile *_objects;
+
+
+ void init();
+ void deinit();
+
+ void initScreen();
+};
+
+} // End of namespace Geisha
+
+} // End of namespace Gob
+
+#endif // GOB_MINIGAMES_GEISHA_PENETRATION_H
diff --git a/engines/gob/module.mk b/engines/gob/module.mk
index b85c387734..bf040c5428 100644
--- a/engines/gob/module.mk
+++ b/engines/gob/module.mk
@@ -1,10 +1,13 @@
MODULE := engines/gob
MODULE_OBJS := \
+ anifile.o \
+ aniobject.o \
console.o \
dataio.o \
databases.o \
dbase.o \
+ decfile.o \
detection.o \
draw.o \
draw_v1.o \
@@ -53,6 +56,7 @@ MODULE_OBJS := \
mult_v2.o \
palanim.o \
resources.o \
+ rxyfile.o \
scenery.o \
scenery_v1.o \
scenery_v2.o \
@@ -69,6 +73,9 @@ MODULE_OBJS := \
demos/demoplayer.o \
demos/scnplayer.o \
demos/batplayer.o \
+ minigames/geisha/evilfish.o \
+ minigames/geisha/diving.o \
+ minigames/geisha/penetration.o \
save/savefile.o \
save/savehandler.o \
save/saveload.o \
@@ -77,6 +84,7 @@ MODULE_OBJS := \
save/saveload_v4.o \
save/saveload_v6.o \
save/saveload_v7.o \
+ save/saveload_geisha.o \
save/saveload_fascin.o \
save/saveload_inca2.o \
save/saveload_playtoons.o \
diff --git a/engines/gob/rxyfile.cpp b/engines/gob/rxyfile.cpp
new file mode 100644
index 0000000000..5311eece0f
--- /dev/null
+++ b/engines/gob/rxyfile.cpp
@@ -0,0 +1,82 @@
+/* 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 "common/stream.h"
+
+#include "gob/rxyfile.h"
+
+namespace Gob {
+
+RXYFile::RXYFile(Common::SeekableReadStream &rxy) : _width(0), _height(0) {
+ load(rxy);
+}
+
+RXYFile::~RXYFile() {
+}
+
+uint RXYFile::size() const {
+ return _coords.size();
+}
+
+uint16 RXYFile::getWidth() const {
+ return _width;
+}
+
+uint16 RXYFile::getHeight() const {
+ return _height;
+}
+
+uint16 RXYFile::getRealCount() const {
+ return _realCount;
+}
+
+const RXYFile::Coordinates &RXYFile::operator[](uint i) const {
+ assert(i < _coords.size());
+
+ return _coords[i];
+}
+
+void RXYFile::load(Common::SeekableReadStream &rxy) {
+ if (rxy.size() < 2)
+ return;
+
+ rxy.seek(0);
+
+ _realCount = rxy.readUint16LE();
+
+ uint16 count = (rxy.size() - 2) / 8;
+
+ _coords.resize(count);
+ for (CoordArray::iterator c = _coords.begin(); c != _coords.end(); ++c) {
+ c->left = rxy.readUint16LE();
+ c->right = rxy.readUint16LE();
+ c->top = rxy.readUint16LE();
+ c->bottom = rxy.readUint16LE();
+
+ if (c->left != 0xFFFF) {
+ _width = MAX<uint16>(_width , c->right + 1);
+ _height = MAX<uint16>(_height, c->bottom + 1);
+ }
+ }
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/rxyfile.h b/engines/gob/rxyfile.h
new file mode 100644
index 0000000000..828f8b73c7
--- /dev/null
+++ b/engines/gob/rxyfile.h
@@ -0,0 +1,76 @@
+/* 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.
+ *
+ */
+
+#ifndef GOB_RXYFILE_H
+#define GOB_RXYFILE_H
+
+#include "common/system.h"
+#include "common/array.h"
+
+namespace Common {
+ class SeekableReadStream;
+}
+
+namespace Gob {
+
+/** A RXY file, containing relative sprite coordinates.
+ *
+ * Used in hardcoded "actiony" parts of gob games.
+ */
+class RXYFile {
+public:
+ struct Coordinates {
+ uint16 left;
+ uint16 top;
+ uint16 right;
+ uint16 bottom;
+ };
+
+ RXYFile(Common::SeekableReadStream &rxy);
+ ~RXYFile();
+
+ uint size() const;
+
+ uint16 getWidth () const;
+ uint16 getHeight() const;
+
+ uint16 getRealCount() const;
+
+ const Coordinates &operator[](uint i) const;
+
+private:
+ typedef Common::Array<Coordinates> CoordArray;
+
+ CoordArray _coords;
+
+ uint16 _realCount;
+
+ uint16 _width;
+ uint16 _height;
+
+
+ void load(Common::SeekableReadStream &rxy);
+};
+
+} // End of namespace Gob
+
+#endif // GOB_RXYFILE_H
diff --git a/engines/gob/save/saveload.h b/engines/gob/save/saveload.h
index 4d51a5b51c..66b3482bac 100644
--- a/engines/gob/save/saveload.h
+++ b/engines/gob/save/saveload.h
@@ -71,6 +71,60 @@ protected:
virtual const char *getDescription(const char *fileName) const;
};
+/** Save/Load class for Geisha. */
+class SaveLoad_Geisha : public SaveLoad {
+public:
+ SaveLoad_Geisha(GobEngine *vm, const char *targetName);
+ virtual ~SaveLoad_Geisha();
+
+ SaveMode getSaveMode(const char *fileName) const;
+
+protected:
+ static const uint32 kSlotCount = 7;
+ static const uint32 kSlotSize = 44;
+
+ static const uint32 kSaveFileSize = kSlotCount * kSlotSize;
+
+ struct SaveFile {
+ const char *sourceName;
+ SaveMode mode;
+ SaveHandler *handler;
+ const char *description;
+ };
+
+ /** Handles the save slots. */
+ class GameHandler : public SaveHandler {
+ public:
+ GameHandler(GobEngine *vm, const Common::String &target);
+ ~GameHandler();
+
+ int32 getSize();
+ bool load(int16 dataVar, int32 size, int32 offset);
+ bool save(int16 dataVar, int32 size, int32 offset);
+
+ private:
+ /** Slot file construction. */
+ class File : public SlotFileIndexed {
+ public:
+ File(GobEngine *vm, const Common::String &base);
+ ~File();
+
+ int getSlot(int32 offset) const;
+ int getSlotRemainder(int32 offset) const;
+ };
+
+ File _file;
+ };
+
+ static SaveFile _saveFiles[];
+
+ SaveHandler *getHandler(const char *fileName) const;
+ const char *getDescription(const char *fileName) const;
+
+ const SaveFile *getSaveFile(const char *fileName) const;
+ SaveFile *getSaveFile(const char *fileName);
+};
+
/** Save/Load class for Gobliins 2, Ween: The Prophecy and Bargon Attack. */
class SaveLoad_v2 : public SaveLoad {
public:
diff --git a/engines/gob/save/saveload_geisha.cpp b/engines/gob/save/saveload_geisha.cpp
new file mode 100644
index 0000000000..3414c12dda
--- /dev/null
+++ b/engines/gob/save/saveload_geisha.cpp
@@ -0,0 +1,215 @@
+/* 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 "gob/save/saveload.h"
+#include "gob/save/saveconverter.h"
+#include "gob/inter.h"
+#include "gob/variables.h"
+
+namespace Gob {
+
+SaveLoad_Geisha::SaveFile SaveLoad_Geisha::_saveFiles[] = {
+ {"save.inf", kSaveModeSave, 0, "savegame"}
+};
+
+
+SaveLoad_Geisha::GameHandler::File::File(GobEngine *vm, const Common::String &base) :
+ SlotFileIndexed(vm, SaveLoad_Geisha::kSlotCount, base, "s") {
+
+}
+
+SaveLoad_Geisha::GameHandler::File::~File() {
+}
+
+int SaveLoad_Geisha::GameHandler::File::getSlot(int32 offset) const {
+ return 0;
+}
+
+int SaveLoad_Geisha::GameHandler::File::getSlotRemainder(int32 offset) const {
+ return 0;
+}
+
+
+SaveLoad_Geisha::GameHandler::GameHandler(GobEngine *vm, const Common::String &target) :
+ SaveHandler(vm), _file(vm, target) {
+
+}
+
+SaveLoad_Geisha::GameHandler::~GameHandler() {
+}
+
+int32 SaveLoad_Geisha::GameHandler::getSize() {
+ if (_file.getSlotMax() == 0)
+ return -1;
+
+ return SaveLoad_Geisha::kSaveFileSize;
+}
+
+bool SaveLoad_Geisha::GameHandler::load(int16 dataVar, int32 size, int32 offset) {
+ if ((size != 0) || (offset != 0)) {
+ warning("Invalid loading procedure: %d, %d, %d", dataVar, size, offset);
+ return false;
+ }
+
+ memset(_vm->_inter->_variables->getAddressOff8(dataVar), 0, SaveLoad_Geisha::kSaveFileSize);
+
+ for (uint32 slot = 0; slot < SaveLoad_Geisha::kSlotCount;
+ slot++, dataVar += SaveLoad_Geisha::kSlotSize) {
+
+ if (!_file.exists(slot))
+ continue;
+
+ Common::String slotFile = _file.build(slot);
+ if (slotFile.empty())
+ return false;
+
+ SaveReader reader(2, slot, slotFile);
+ if (!reader.load()) {
+ warning("Save slot %d contains corrupted save", slot);
+ continue;
+ }
+
+ SavePartInfo info(20, (uint32) _vm->getGameType(), 0,
+ _vm->getEndianness(), _vm->_inter->_variables->getSize());
+ SavePartVars vars(_vm, SaveLoad_Geisha::kSlotSize);
+
+ if (!reader.readPart(0, &info) || !reader.readPart(1, &vars)) {
+ warning("Save slot %d contains corrupted save", slot);
+ continue;
+ }
+
+ if (!vars.writeInto(dataVar, 0, SaveLoad_Geisha::kSlotSize)) {
+ warning("Save slot %d contains corrupted save", slot);
+ continue;
+ }
+ }
+
+ return true;
+}
+
+bool SaveLoad_Geisha::GameHandler::save(int16 dataVar, int32 size, int32 offset) {
+ if (((uint32)size != SaveLoad_Geisha::kSaveFileSize) || (offset != 0)) {
+ warning("Invalid saving procedure: %d, %d, %d", dataVar, size, offset);
+ return false;
+ }
+
+ for (uint32 slot = 0; slot < SaveLoad_Geisha::kSlotCount;
+ slot++, dataVar += SaveLoad_Geisha::kSlotSize) {
+
+ const byte *slotData = _vm->_inter->_variables->getAddressOff8(dataVar);
+
+ // Check of the slot's data is empty
+ bool empty = true;
+ for (uint32 j = 0; j < SaveLoad_Geisha::kSlotSize; j++) {
+ if (slotData[j] != 0) {
+ empty = false;
+ break;
+ }
+ }
+
+ // Don't save empty slots
+ if (empty)
+ continue;
+
+ Common::String slotFile = _file.build(slot);
+ if (slotFile.empty())
+ return false;
+
+ SaveWriter writer(2, slot, slotFile);
+
+ SavePartInfo info(20, (uint32) _vm->getGameType(), 0,
+ _vm->getEndianness(), _vm->_inter->_variables->getSize());
+ SavePartVars vars(_vm, SaveLoad_Geisha::kSlotSize);
+
+ info.setDesc(Common::String::format("Geisha, slot %d", slot).c_str());
+ if (!vars.readFrom(dataVar, 0, SaveLoad_Geisha::kSlotSize))
+ return false;
+
+ if (!writer.writePart(0, &info))
+ return false;
+ if (!writer.writePart(1, &vars))
+ return false;
+ }
+
+ return true;
+}
+
+
+SaveLoad_Geisha::SaveLoad_Geisha(GobEngine *vm, const char *targetName) :
+ SaveLoad(vm) {
+
+ _saveFiles[0].handler = new GameHandler(vm, targetName);
+}
+
+SaveLoad_Geisha::~SaveLoad_Geisha() {
+ for (int i = 0; i < ARRAYSIZE(_saveFiles); i++)
+ delete _saveFiles[i].handler;
+}
+
+const SaveLoad_Geisha::SaveFile *SaveLoad_Geisha::getSaveFile(const char *fileName) const {
+ fileName = stripPath(fileName);
+
+ for (int i = 0; i < ARRAYSIZE(_saveFiles); i++)
+ if (!scumm_stricmp(fileName, _saveFiles[i].sourceName))
+ return &_saveFiles[i];
+
+ return 0;
+}
+
+SaveLoad_Geisha::SaveFile *SaveLoad_Geisha::getSaveFile(const char *fileName) {
+ fileName = stripPath(fileName);
+
+ for (int i = 0; i < ARRAYSIZE(_saveFiles); i++)
+ if (!scumm_stricmp(fileName, _saveFiles[i].sourceName))
+ return &_saveFiles[i];
+
+ return 0;
+}
+
+SaveHandler *SaveLoad_Geisha::getHandler(const char *fileName) const {
+ const SaveFile *saveFile = getSaveFile(fileName);
+
+ if (saveFile)
+ return saveFile->handler;
+
+ return 0;
+}
+
+const char *SaveLoad_Geisha::getDescription(const char *fileName) const {
+ const SaveFile *saveFile = getSaveFile(fileName);
+
+ if (saveFile)
+ return saveFile->description;
+
+ return 0;
+}
+
+SaveLoad::SaveMode SaveLoad_Geisha::getSaveMode(const char *fileName) const {
+ const SaveFile *saveFile = getSaveFile(fileName);
+
+ if (saveFile)
+ return saveFile->mode;
+
+ return kSaveModeNone;
+}
+
+} // End of namespace Gob
diff --git a/engines/gob/sound/sound.cpp b/engines/gob/sound/sound.cpp
index 212116f689..bfe0394390 100644
--- a/engines/gob/sound/sound.cpp
+++ b/engines/gob/sound/sound.cpp
@@ -330,7 +330,7 @@ void Sound::adlibPlayBgMusic() {
if (!_adlPlayer)
_adlPlayer = new ADLPlayer(*_vm->_mixer);
- static const char *tracksMac[] = {
+ static const char *const tracksMac[] = {
// "musmac1.adl", // TODO: This track isn't played correctly at all yet
"musmac2.adl",
"musmac3.adl",
@@ -339,7 +339,7 @@ void Sound::adlibPlayBgMusic() {
"musmac6.adl"
};
- static const char *tracksWin[] = {
+ static const char *const tracksWin[] = {
"musmac1.mid",
"musmac2.mid",
"musmac3.mid",
@@ -434,6 +434,8 @@ void Sound::blasterPlay(SoundDesc *sndDesc, int16 repCount,
debugC(1, kDebugSound, "SoundBlaster: Playing sample (%d, %d, %d)",
repCount, frequency, fadeLength);
+ blasterStopComposition();
+
_blaster->playSample(*sndDesc, repCount, frequency, fadeLength);
}
@@ -534,7 +536,7 @@ void Sound::cdPlayBgMusic() {
if (!_cdrom)
return;
- static const char *tracks[][2] = {
+ static const char *const tracks[][2] = {
{"avt00.tot", "mine"},
{"avt001.tot", "nuit"},
{"avt002.tot", "campagne"},
@@ -571,7 +573,7 @@ void Sound::cdPlayMultMusic() {
if (!_cdrom)
return;
- static const char *tracks[][6] = {
+ static const char *const tracks[][6] = {
{"avt005.tot", "fra1", "all1", "ang1", "esp1", "ita1"},
{"avt006.tot", "fra2", "all2", "ang2", "esp2", "ita2"},
{"avt012.tot", "fra3", "all3", "ang3", "esp3", "ita3"},
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index 6d83745602..7f9c6131fd 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -20,6 +20,10 @@
*
*/
+#include "common/stream.h"
+#include "common/events.h"
+
+#include "graphics/palette.h"
#include "gob/gob.h"
#include "gob/util.h"
@@ -31,10 +35,6 @@
#include "gob/videoplayer.h"
#include "gob/sound/sound.h"
-#include "common/events.h"
-
-#include "graphics/palette.h"
-
namespace Gob {
Util::Util(GobEngine *vm) : _vm(vm) {
@@ -257,6 +257,18 @@ bool Util::checkKey(int16 &key) {
return true;
}
+bool Util::keyPressed() {
+ int16 key = checkKey();
+ if (key)
+ return true;
+
+ int16 x, y;
+ MouseButtons buttons;
+
+ getMouseState(&x, &y, &buttons);
+ return buttons != kMouseButtonsNone;
+}
+
void Util::getMouseState(int16 *pX, int16 *pY, MouseButtons *pButtons) {
Common::Point mouse = g_system->getEventManager()->getMousePos();
*pX = mouse.x + _vm->_video->_scrollOffsetX - _vm->_video->_screenDeltaX;
@@ -518,6 +530,11 @@ void Util::deleteList(List *list) {
}
char *Util::setExtension(char *str, const char *ext) {
+ assert(str && ext);
+
+ if (str[0] == '\0')
+ return str;
+
char *dot = strrchr(str, '.');
if (dot)
*dot = '\0';
@@ -527,6 +544,9 @@ char *Util::setExtension(char *str, const char *ext) {
}
Common::String Util::setExtension(const Common::String &str, const Common::String &ext) {
+ if (str.empty())
+ return str;
+
const char *dot = strrchr(str.c_str(), '.');
if (dot)
return Common::String(str.c_str(), dot - str.c_str()) + ext;
@@ -534,6 +554,23 @@ Common::String Util::setExtension(const Common::String &str, const Common::Strin
return str + ext;
}
+Common::String Util::readString(Common::SeekableReadStream &stream, int n) {
+ Common::String str;
+
+ char c;
+ while (n-- > 0) {
+ if ((c = stream.readByte()) == '\0')
+ break;
+
+ str += c;
+ }
+
+ if (n > 0)
+ stream.skip(n);
+
+ return str;
+}
+
/* NOT IMPLEMENTED */
void Util::checkJoystick() {
_vm->_global->_useJoystick = 0;
diff --git a/engines/gob/util.h b/engines/gob/util.h
index a6a689c1d2..4228dac768 100644
--- a/engines/gob/util.h
+++ b/engines/gob/util.h
@@ -23,8 +23,13 @@
#ifndef GOB_UTIL_H
#define GOB_UTIL_H
+#include "common/str.h"
#include "common/keyboard.h"
+namespace Common {
+ class SeekableReadStream;
+}
+
namespace Gob {
class GobEngine;
@@ -103,6 +108,7 @@ public:
int16 getKey();
int16 checkKey();
bool checkKey(int16 &key);
+ bool keyPressed();
void getMouseState(int16 *pX, int16 *pY, MouseButtons *pButtons);
void setMousePos(int16 x, int16 y);
@@ -131,6 +137,9 @@ public:
static char *setExtension(char *str, const char *ext);
static Common::String setExtension(const Common::String &str, const Common::String &ext);
+ /** Read a constant-length string out of a stream. */
+ static Common::String readString(Common::SeekableReadStream &stream, int n);
+
Util(GobEngine *vm);
protected:
diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp
index 651c9a3154..221f5ab3c9 100644
--- a/engines/gob/videoplayer.cpp
+++ b/engines/gob/videoplayer.cpp
@@ -61,7 +61,7 @@ void VideoPlayer::Video::close() {
}
-const char *VideoPlayer::_extensions[] = { "IMD", "IMD", "VMD", "RMD", "SMD" };
+const char *const VideoPlayer::_extensions[] = { "IMD", "IMD", "VMD", "RMD", "SMD" };
VideoPlayer::VideoPlayer(GobEngine *vm) : _vm(vm), _needBlit(false),
_noCursorSwitch(false), _woodruffCohCottWorkaround(false) {
@@ -262,7 +262,7 @@ void VideoPlayer::waitSoundEnd(int slot) {
video->decoder->finishSound();
- while(video->decoder->isSoundPlaying())
+ while (video->decoder->isSoundPlaying())
_vm->_util->longDelay(1);
}
diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h
index 373832939a..bc7cb48768 100644
--- a/engines/gob/videoplayer.h
+++ b/engines/gob/videoplayer.h
@@ -167,7 +167,7 @@ private:
static const int kVideoSlotCount = 32;
- static const char *_extensions[];
+ static const char *const _extensions[];
GobEngine *_vm;
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index 7f477c41fa..ca896a8d21 100644
--- a/engines/groovie/roq.cpp
+++ b/engines/groovie/roq.cpp
@@ -43,9 +43,6 @@
namespace Groovie {
ROQPlayer::ROQPlayer(GroovieEngine *vm) :
-#ifdef DITHER
- _dither(NULL),
-#endif
VideoPlayer(vm), _codingTypeCount(0),
_fg(&_vm->_graphicsMan->_foreground), _bg(&_vm->_graphicsMan->_background) {
@@ -55,38 +52,13 @@ ROQPlayer::ROQPlayer(GroovieEngine *vm) :
if (_vm->_mode8bit) {
byte pal[256 * 3];
-#ifdef DITHER
- // Initialize to a black palette
- memset(pal, 0, 256 * 3);
-
- // Build a basic color palette
- for (int r = 0; r < 4; r++) {
- for (int g = 0; g < 4; g++) {
- for (int b = 0; b < 4; b++) {
- byte col = (r << 4) | (g << 2) | (b << 0);
- pal[3 * col + 0] = r << 6;
- pal[3 * col + 1] = g << 6;
- pal[3 * col + 2] = b << 6;
- }
- }
- }
-
- // Initialize the dithering algorithm
- _paletteLookup = new Graphics::PaletteLUT(8, Graphics::PaletteLUT::kPaletteYUV);
- _paletteLookup->setPalette(pal, Graphics::PaletteLUT::kPaletteRGB, 8);
- for (int i = 0; (i < 64) && !_vm->shouldQuit(); i++) {
- debug("Groovie::ROQ: Building palette table: %02d/63", i);
- _paletteLookup->buildNext();
- }
-#else // !DITHER
// Set a grayscale palette
for (int i = 0; i < 256; i++) {
pal[(i * 3) + 0] = i;
pal[(i * 3) + 1] = i;
pal[(i * 3) + 2] = i;
}
-#endif // DITHER
_syst->getPaletteManager()->setPalette(pal, 0, 256);
}
@@ -98,12 +70,6 @@ ROQPlayer::~ROQPlayer() {
delete _currBuf;
_prevBuf->free();
delete _prevBuf;
-
-#ifdef DITHER
- // Free the dithering algorithm
- delete _dither;
- delete _paletteLookup;
-#endif
}
uint16 ROQPlayer::loadInternal() {
@@ -147,22 +113,13 @@ uint16 ROQPlayer::loadInternal() {
}
void ROQPlayer::buildShowBuf() {
-#ifdef DITHER
- // Start a new frame dithering
- _dither->newFrame();
-#endif
-
for (int line = 0; line < _bg->h; line++) {
byte *out = (byte *)_bg->getBasePtr(0, line);
byte *in = (byte *)_currBuf->getBasePtr(0, line / _scaleY);
for (int x = 0; x < _bg->w; x++) {
if (_vm->_mode8bit) {
-#ifdef DITHER
- *out = _dither->dither(*in, *(in + 1), *(in + 2), x);
-#else
// Just use the luminancy component
*out = *in;
-#endif // DITHER
#ifdef USE_RGB_COLOR
} else {
// Do the format conversion (YUV -> RGB -> Screen format)
@@ -178,9 +135,6 @@ void ROQPlayer::buildShowBuf() {
if (!(x % _scaleX))
in += _currBuf->format.bytesPerPixel;
}
-#ifdef DITHER
- _dither->nextLine();
-#endif
}
// Swap buffers
@@ -349,11 +303,6 @@ bool ROQPlayer::processBlockInfo(ROQBlockHeader &blockHeader) {
*ptr2++ = 128;
}
-#ifdef DITHER
- // Reset the dithering algorithm with the new width
- delete _dither;
- _dither = new Graphics::SierraLight(width * _scaleX, _paletteLookup);
-#endif
}
return true;
diff --git a/engines/groovie/roq.h b/engines/groovie/roq.h
index ddb307065c..c5d3f255d3 100644
--- a/engines/groovie/roq.h
+++ b/engines/groovie/roq.h
@@ -25,12 +25,6 @@
#include "groovie/player.h"
-//#define DITHER
-
-#ifdef DITHER
-#include "graphics/dither.h"
-#endif
-
namespace Groovie {
class GroovieEngine;
@@ -89,11 +83,6 @@ private:
bool _dirty;
byte _alpha;
-#ifdef DITHER
- // Dithering
- Graphics::PaletteLUT *_paletteLookup;
- Graphics::SierraLight *_dither;
-#endif
};
} // End of Groovie namespace
diff --git a/engines/hugo/object.cpp b/engines/hugo/object.cpp
index e5c7b4bf90..bc99abf410 100644
--- a/engines/hugo/object.cpp
+++ b/engines/hugo/object.cpp
@@ -283,7 +283,7 @@ void ObjectHandler::freeObjects() {
free(_uses);
}
- for(int16 i = 0; i < _objCount; i++) {
+ for (int16 i = 0; i < _objCount; i++) {
free(_objects[i].stateDataIndex);
_objects[i].stateDataIndex = 0;
}
diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp
index 38a8e4e3ff..bbf6c39f13 100644
--- a/engines/hugo/parser.cpp
+++ b/engines/hugo/parser.cpp
@@ -449,7 +449,7 @@ const char *Parser::findVerb() const {
*/
void Parser::showDosInventory() const {
debugC(1, kDebugParser, "showDosInventory()");
- static const char *blanks = " ";
+ static const char *const blanks = " ";
uint16 index = 0, len1 = 0, len2 = 0;
for (int i = 0; i < _vm->_object->_numObj; i++) { // Find widths of 2 columns
diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp
index dc20ca117d..384b3ace8f 100644
--- a/engines/hugo/schedule.cpp
+++ b/engines/hugo/schedule.cpp
@@ -297,7 +297,7 @@ void Scheduler::readAct(Common::ReadStream &in, act &curAct) {
curAct.a3.timer = in.readSint16BE();
curAct.a3.promptIndex = in.readSint16BE();
numSubAct = in.readUint16BE();
- curAct.a3.responsePtr = (int *) malloc(sizeof(int) * numSubAct);
+ curAct.a3.responsePtr = (int *)malloc(sizeof(int) * numSubAct);
for (int k = 0; k < numSubAct; k++)
curAct.a3.responsePtr[k] = in.readSint16BE();
curAct.a3.actPassIndex = in.readUint16BE();
@@ -566,7 +566,7 @@ void Scheduler::loadActListArr(Common::ReadStream &in) {
for (int i = 0; i < numElem; i++) {
numSubElem = in.readUint16BE();
if (varnt == _vm->_gameVariant)
- _actListArr[i] = (act *) malloc(sizeof(act) * (numSubElem + 1));
+ _actListArr[i] = (act *)malloc(sizeof(act) * (numSubElem + 1));
for (int j = 0; j < numSubElem; j++) {
if (varnt == _vm->_gameVariant) {
readAct(in, _actListArr[i][j]);
@@ -1557,7 +1557,7 @@ void Scheduler_v1d::decodeString(char *line) {
debugC(1, kDebugSchedule, "decodeString(%s)", line);
uint16 linelength = strlen(line);
- for(uint16 i = 0; i < linelength; i++) {
+ for (uint16 i = 0; i < linelength; i++) {
line[i] = (line[i] + _cypher.c_str()[i % _cypher.size()]) % '~';
if (line[i] < ' ')
line[i] += ' ';
diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp
index 79ec066b7f..9dcd7d346a 100644
--- a/engines/hugo/sound.cpp
+++ b/engines/hugo/sound.cpp
@@ -269,37 +269,45 @@ void SoundHandler::pcspkr_player() {
static const uint16 pcspkrSharps[8] = {1279, 1171, 2150, 1916, 1755, 1611, 1435}; // The sharps, A# to B#
static const uint16 pcspkrFlats[8] = {1435, 1279, 2342, 2150, 1916, 1755, 1611}; // The flats, Ab to Bb
- _vm->getTimerManager()->removeTimerProc(&loopPlayer);
- _vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / 9, this, "hugoSoundLoop");
-
+ // Does the user not want any sound?
if (!_vm->_config.soundFl || !_vm->_mixer->isReady())
- return; // Poo! User doesn't want sound!
+ return;
+ // Is there no song?
if (!_DOSSongPtr)
return;
- if (!*_DOSSongPtr) // Song has finished
+ // Did we reach the end of the song?
+ if (!*_DOSSongPtr)
return;
- if (!--_pcspkrTimer) { // timer zero, stop note
+ // Update the timer.
+ _pcspkrTimer--;
+
+ // Check the timer state..
+ if (!_pcspkrTimer) {
+ // A note just finished, stop the sound (if any) and return.
_speakerStream->stop();
return;
- } else if (_pcspkrTimer >= 0) { // Note still going
+ } else if (_pcspkrTimer > 0) {
+ // A (rest or normal) note is still playing, return.
return;
}
- // Time to play next note
+ // The timer is <0, time to play the next note.
bool cmdNote = true;
do {
switch (*_DOSSongPtr) {
- case 'O': // Switch to new octave 1..7
+ case 'O':
+ // Switch to new octave 0..7
_DOSSongPtr++;
_pcspkrOctave = *_DOSSongPtr - '0';
if ((_pcspkrOctave < 0) || (_pcspkrOctave > 7))
error("pcspkr_player() - Bad octave");
_DOSSongPtr++;
break;
- case 'L': // Switch to new duration (in ticks)
+ case 'L':
+ // Switch to new duration (in ticks)
_DOSSongPtr++;
_pcspkrNoteDuration = *_DOSSongPtr - '0';
if (_pcspkrNoteDuration < 0)
@@ -308,32 +316,39 @@ void SoundHandler::pcspkr_player() {
_DOSSongPtr++;
break;
case '<':
- case '^': // Move up an octave
- _pcspkrOctave++;
+ case '^':
+ // Move up an octave
_DOSSongPtr++;
+ _pcspkrOctave++;
break;
case '>':
- case 'v': // Move down an octave
- _pcspkrOctave--;
+ case 'v':
+ // Move down an octave
_DOSSongPtr++;
+ _pcspkrOctave--;
break;
default:
+ // Not a command, probably a note; so we should stop
+ // processing commands and move onward now.
cmdNote = false;
break;
}
} while (cmdNote);
switch (*_DOSSongPtr) {
- case 'A': // The notes.
+ case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
- uint16 count; // Value to set timer chip to for note
- count = pcspkrNotes[*_DOSSongPtr - 'A'];
- switch (_DOSSongPtr[1]) { // Check for sharp or flat (#, -)
+ // Play a note.
+
+ // First, what frequency does this note get played at?
+ // We must check for sharp or flat (#, -).
+ uint16 count;
+ switch (_DOSSongPtr[1]) {
case '#':
count = pcspkrSharps[*_DOSSongPtr++ - 'A'];
break;
@@ -341,17 +356,22 @@ void SoundHandler::pcspkr_player() {
count = pcspkrFlats[*_DOSSongPtr++ - 'A'];
break;
default:
+ count = pcspkrNotes[*_DOSSongPtr - 'A'];
break;
}
- if (_pcspkrOctave > 3) // Adjust for octave
+ // Adjust for the octave if needed.
+ if (_pcspkrOctave > 3)
count /= (1 << (_pcspkrOctave - 3));
else if (_pcspkrOctave < 3)
count *= (1 << (3 - _pcspkrOctave));
- _speakerStream->play(Audio::PCSpeaker::kWaveFormSaw, kHugoCNT / count, (int32) ((1 + _pcspkrNoteDuration) * _vm->_normalTPS) * 8);
+
+ // Start a note playing (we will stop it when the timer expires).
+ _speakerStream->play(Audio::PCSpeaker::kWaveFormSquare, kHugoCNT / count, -1);
_pcspkrTimer = _pcspkrNoteDuration;
_DOSSongPtr++;
break;
- case '.': // A rest note
+ case '.':
+ // Play a 'rest note' by being silent for a bit.
_speakerStream->stop();
_pcspkrTimer = _pcspkrNoteDuration;
_DOSSongPtr++;
@@ -370,7 +390,7 @@ void SoundHandler::loadIntroSong(Common::ReadStream &in) {
}
void SoundHandler::initPcspkrPlayer() {
- _vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / 9, this, "hugoSoundLoop");
+ _vm->getTimerManager()->installTimerProc(&loopPlayer, 1000000 / _vm->_normalTPS, this, "hugoSoundLoop");
}
} // End of namespace Hugo
diff --git a/engines/kyra/animator_mr.cpp b/engines/kyra/animator_mr.cpp
index 6414b99ffd..31c5cd1a53 100644
--- a/engines/kyra/animator_mr.cpp
+++ b/engines/kyra/animator_mr.cpp
@@ -445,7 +445,7 @@ void KyraEngine_MR::showIdleAnim() {
if (!_nextIdleType && !talkObjectsInCurScene()) {
randomSceneChat();
} else {
- static const char *facingTable[] = {
+ static const char *const facingTable[] = {
"A", "R", "R", "FR", "FX", "FL", "L", "L"
};
diff --git a/engines/kyra/detection.cpp b/engines/kyra/detection.cpp
index 0a49483f12..68eb08210e 100644
--- a/engines/kyra/detection.cpp
+++ b/engines/kyra/detection.cpp
@@ -187,6 +187,7 @@ void KyraMetaEngine::removeSaveState(const char *target, int slot) const {
SaveStateDescriptor KyraMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
Common::String filename = Kyra::KyraEngine_v1::getSavegameFilename(target, slot);
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename);
+ const bool lolGame = ConfMan.getDomain(target)->getVal("gameid").equalsIgnoreCase("lol");
if (in) {
Kyra::KyraEngine_v1::SaveHeader header;
@@ -198,14 +199,13 @@ SaveStateDescriptor KyraMetaEngine::querySaveMetaInfos(const char *target, int s
if (error == Kyra::KyraEngine_v1::kRSHENoError) {
SaveStateDescriptor desc(slot, header.description);
- bool lolGame = ConfMan.getDomain(target)->getVal("gameid").equalsIgnoreCase("lol");
-
// Slot 0 is used for the 'restart game' save in all three Kyrandia games, thus
// we prevent it from being deleted.
desc.setDeletableFlag(slot != 0 || lolGame);
// We don't allow quick saves (slot 990 till 998) to be overwritten.
- // The same goes for the 'Autosave', which is slot 999.
+ // The same goes for the 'Autosave', which is slot 999. Slot 0 will also
+ // be protected in Kyra 1-3, since it's the 'restart game' save.
desc.setWriteProtectedFlag((slot == 0 && !lolGame) || slot >= 990);
desc.setThumbnail(header.thumbnail);
@@ -213,7 +213,14 @@ SaveStateDescriptor KyraMetaEngine::querySaveMetaInfos(const char *target, int s
}
}
- return SaveStateDescriptor();
+ SaveStateDescriptor desc(slot, Common::String());
+
+ // We don't allow quick saves (slot 990 till 998) to be overwritten.
+ // The same goes for the 'Autosave', which is slot 999. Slot 0 will also
+ // be protected in Kyra 1-3, since it's the 'restart game' save.
+ desc.setWriteProtectedFlag((slot == 0 && !lolGame) || slot >= 990);
+
+ return desc;
}
#if PLUGIN_ENABLED_DYNAMIC(KYRA)
diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp
index b82099f058..4497ab8019 100644
--- a/engines/kyra/kyra_hof.cpp
+++ b/engines/kyra/kyra_hof.cpp
@@ -857,7 +857,7 @@ void KyraEngine_HoF::loadOptionsBuffer(const char *file) {
void KyraEngine_HoF::loadChapterBuffer(int chapter) {
char tempString[14];
- static const char *chapterFilenames[] = {
+ static const char *const chapterFilenames[] = {
"CH1.XXX", "CH2.XXX", "CH3.XXX", "CH4.XXX", "CH5.XXX"
};
@@ -1087,7 +1087,7 @@ void KyraEngine_HoF::resetScaleTable() {
}
void KyraEngine_HoF::setScaleTableItem(int item, int data) {
- if (item >= 1 || item <= 15)
+ if (item >= 1 && item <= 15)
_scaleTable[item-1] = (data << 8) / 100;
}
@@ -1096,7 +1096,7 @@ int KyraEngine_HoF::getScale(int x, int y) {
}
void KyraEngine_HoF::setDrawLayerTableEntry(int entry, int data) {
- if (entry >= 1 || entry <= 15)
+ if (entry >= 1 && entry <= 15)
_drawLayerTable[entry-1] = data;
}
@@ -1413,7 +1413,7 @@ void KyraEngine_HoF::runIdleScript(int script) {
setNextIdleAnimTimer();
} else {
// FIXME: move this to staticres.cpp?
- static const char *idleScriptFiles[] = {
+ static const char *const idleScriptFiles[] = {
"_IDLHAIR.EMC", "_IDLDUST.EMC", "_IDLLEAN.EMC", "_IDLDIRT.EMC", "_IDLTOSS.EMC", "_IDLNOSE.EMC",
"_IDLBRSH.EMC", "_Z3IDLE.EMC", "_Z4IDLE.EMC", "_Z6IDLE.EMC", "_Z7IDLE.EMC", "_Z8IDLE.EMC"
};
diff --git a/engines/kyra/kyra_hof.h b/engines/kyra/kyra_hof.h
index 2561171598..916cac0c9d 100644
--- a/engines/kyra/kyra_hof.h
+++ b/engines/kyra/kyra_hof.h
@@ -566,8 +566,8 @@ protected:
// -
char _internStringBuf[200];
- static const char *_languageExtension[];
- static const char *_scriptLangExt[];
+ static const char *const _languageExtension[];
+ static const char *const _scriptLangExt[];
// character
bool _useCharPal;
diff --git a/engines/kyra/kyra_mr.h b/engines/kyra/kyra_mr.h
index ec76340638..473c0371dc 100644
--- a/engines/kyra/kyra_mr.h
+++ b/engines/kyra/kyra_mr.h
@@ -659,7 +659,7 @@ private:
// resource specific
private:
- static const char *_languageExtension[];
+ static const char *const _languageExtension[];
static const int _languageExtensionSize;
int loadLanguageFile(const char *file, uint8 *&buffer);
diff --git a/engines/kyra/module.mk b/engines/kyra/module.mk
index 4708041cf7..abd535ee29 100644
--- a/engines/kyra/module.mk
+++ b/engines/kyra/module.mk
@@ -96,3 +96,10 @@ endif
# Include common rules
include $(srcdir)/rules.mk
+
+ifeq ($(BACKEND), maemo)
+#ugly workaround, screen.cpp crashes gcc version 3.4.4 (CodeSourcery ARM 2005q3-2) with anything but -O3
+$(MODULE)/screen.o: $(MODULE)/screen.cpp
+ $(MKDIR) $(*D)/$(DEPDIR)
+ $(CXX) -Wp,-MMD,"$(*D)/$(DEPDIR)/$(*F).d",-MQ,"$@",-MP $(CXXFLAGS) -O3 $(CPPFLAGS) -c $(<) -o $*.o
+endif
diff --git a/engines/kyra/sequences_mr.cpp b/engines/kyra/sequences_mr.cpp
index d546d9c25b..76badb63f5 100644
--- a/engines/kyra/sequences_mr.cpp
+++ b/engines/kyra/sequences_mr.cpp
@@ -57,7 +57,7 @@ void KyraEngine_MR::showBadConscience() {
talkObject.x = 30;
talkObject.y = 30;
- static const char *animFilenames[] = {
+ static const char *const animFilenames[] = {
"GUNFL00.WSA", "GUNFL01.WSA", "GUNFL02.WSA", "GUNFL03.WSA", "GUNFL04.WSA", "GUNFL05.WSA", "GUNFL06.WSA", "GUNFL07.WSA",
"GUNFR00.WSA", "GUNFR01.WSA", "GUNFR02.WSA", "GUNFR03.WSA", "GUNFR04.WSA", "GUNFR05.WSA", "GUNFR06.WSA", "GUNFR07.WSA"
};
@@ -128,7 +128,7 @@ void KyraEngine_MR::showGoodConscience() {
talkObject.x = 30;
talkObject.y = 30;
- static const char *animFilenames[] = {
+ static const char *const animFilenames[] = {
"STUFL00.WSA", "STUFL02.WSA", "STUFL04.WSA", "STUFL03.WSA", "STUFL01.WSA",
"STUFR00.WSA", "STUFR02.WSA", "STUFR04.WSA", "STUFR03.WSA", "STUFR01.WSA"
};
diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp
index 12c980486c..8976eba99c 100644
--- a/engines/kyra/sound_adlib.cpp
+++ b/engines/kyra/sound_adlib.cpp
@@ -318,7 +318,6 @@ private:
//
// _unkValue1 - Unknown. Used for updating _unkValue2
// _unkValue2 - Unknown. Used for updating _unkValue4
- // _unkValue3 - Unknown. Used for updating _unkValue2
// _unkValue4 - Unknown. Used for updating _unkValue5
// _unkValue5 - Unknown. Used for controlling updateCallback24().
// _unkValue6 - Unknown. Rhythm section volume?
@@ -357,7 +356,7 @@ private:
uint8 _unkValue1;
uint8 _unkValue2;
- uint8 _unkValue3;
+ uint8 _callbackTimer;
uint8 _unkValue4;
uint8 _unkValue5;
uint8 _unkValue6;
@@ -395,7 +394,7 @@ private:
static const uint8 _regOffset[];
static const uint16 _unkTable[];
- static const uint8 *_unkTable2[];
+ static const uint8 *const _unkTable2[];
static const uint8 _unkTable2_1[];
static const uint8 _unkTable2_2[];
static const uint8 _unkTable2_3[];
@@ -434,7 +433,7 @@ AdLibDriver::AdLibDriver(Audio::Mixer *mixer, bool v2) {
_tempo = 0;
_soundTrigger = 0;
- _unkValue3 = 0xFF;
+ _callbackTimer = 0xFF;
_unkValue1 = _unkValue2 = _unkValue4 = _unkValue5 = 0;
_unkValue6 = _unkValue7 = _unkValue8 = _unkValue9 = _unkValue10 = 0;
_unkValue11 = _unkValue12 = _unkValue13 = _unkValue14 = _unkValue15 =
@@ -635,9 +634,9 @@ void AdLibDriver::callback() {
setupPrograms();
executePrograms();
- uint8 temp = _unkValue3;
- _unkValue3 += _tempo;
- if (_unkValue3 < temp) {
+ uint8 temp = _callbackTimer;
+ _callbackTimer += _tempo;
+ if (_callbackTimer < temp) {
if (!(--_unkValue2)) {
_unkValue2 = _unkValue1;
++_unkValue4;
@@ -791,6 +790,11 @@ void AdLibDriver::executePrograms() {
noteOn(channel);
setupDuration(param, channel);
if (param) {
+ // We need to make sure we are always running the
+ // effects after this. Otherwise some sounds are
+ // wrong. Like the sfx when bumping into a wall in
+ // LoL.
+ result = 1;
channel.dataptr = dataptr;
break;
}
@@ -1114,11 +1118,11 @@ void AdLibDriver::primaryEffect1(Channel &channel) {
return;
// Initialize unk1 to the current frequency
- uint16 unk1 = ((channel.regBx & 3) << 8) | channel.regAx;
+ int16 unk1 = ((channel.regBx & 3) << 8) | channel.regAx;
// This is presumably to shift the "note on" bit so far to the left
// that it won't be affected by any of the calculations below.
- uint16 unk2 = ((channel.regBx & 0x20) << 8) | (channel.regBx & 0x1C);
+ int16 unk2 = ((channel.regBx & 0x20) << 8) | (channel.regBx & 0x1C);
int16 unk3 = (int16)channel.unk30;
@@ -1470,7 +1474,7 @@ int AdLibDriver::update_setPriority(uint8 *&dataptr, Channel &channel, uint8 val
int AdLibDriver::updateCallback23(uint8 *&dataptr, Channel &channel, uint8 value) {
value >>= 1;
_unkValue1 = _unkValue2 = value;
- _unkValue3 = 0xFF;
+ _callbackTimer = 0xFF;
_unkValue4 = _unkValue5 = 0;
return 0;
}
@@ -2074,7 +2078,7 @@ const uint16 AdLibDriver::_unkTable[] = {
// These tables are currently only used by updateCallback46(), which only ever
// uses the first element of one of the sub-tables.
-const uint8 *AdLibDriver::_unkTable2[] = {
+const uint8 *const AdLibDriver::_unkTable2[] = {
AdLibDriver::_unkTable2_1,
AdLibDriver::_unkTable2_2,
AdLibDriver::_unkTable2_1,
@@ -2297,8 +2301,8 @@ void SoundAdLibPC::playTrack(uint8 track) {
}
void SoundAdLibPC::haltTrack() {
- unk1();
- unk2();
+ playSoundEffect(0);
+ playSoundEffect(0);
//_vm->_system->delayMillis(3 * 60);
}
@@ -2402,8 +2406,8 @@ void SoundAdLibPC::internalLoadFile(Common::String file) {
return;
}
- unk2();
- unk1();
+ playSoundEffect(0);
+ playSoundEffect(0);
_driver->callback(8, int(-1));
_soundDataPtr = 0;
@@ -2435,13 +2439,4 @@ void SoundAdLibPC::internalLoadFile(Common::String file) {
_soundFileLoaded = file;
}
-void SoundAdLibPC::unk1() {
- playSoundEffect(0);
- //_vm->_system->delayMillis(5 * 60);
-}
-
-void SoundAdLibPC::unk2() {
- playSoundEffect(0);
-}
-
} // End of namespace Kyra
diff --git a/engines/kyra/sound_adlib.h b/engines/kyra/sound_adlib.h
index 962df40de8..c09fec997e 100644
--- a/engines/kyra/sound_adlib.h
+++ b/engines/kyra/sound_adlib.h
@@ -83,9 +83,6 @@ private:
void play(uint8 track);
- void unk1();
- void unk2();
-
AdLibDriver *_driver;
bool _v2;
diff --git a/engines/kyra/staticres.cpp b/engines/kyra/staticres.cpp
index f6d59922b1..e03369f700 100644
--- a/engines/kyra/staticres.cpp
+++ b/engines/kyra/staticres.cpp
@@ -794,8 +794,8 @@ void KyraEngine_LoK::initStaticResource() {
}
// audio data tables
- static const char *tIntro98[] = { "INTRO%d.DAT" };
- static const char *tIngame98[] = { "KYRAM%d.DAT" };
+ static const char *const tIntro98[] = { "INTRO%d.DAT" };
+ static const char *const tIngame98[] = { "KYRAM%d.DAT" };
// FIXME: It seems Kyra1 MAC CD includes AdLib and MIDI music and sfx, thus we enable
// support for those for now. (Based on patch #2767489 "Support for Mac Kyrandia 1 CD" by satz).
@@ -1011,13 +1011,13 @@ void KyraEngine_HoF::initStaticResource() {
_sequenceSoundList = tmpSndLst;
// assign music data
- static const char *fmtMusicFileListIntro[] = { "intro%d.twn" };
- static const char *fmtMusicFileListFinale[] = { "finale%d.twn" };
- static const char *fmtMusicFileListIngame[] = { "km%02d.twn" };
+ static const char *const fmtMusicFileListIntro[] = { "intro%d.twn" };
+ static const char *const fmtMusicFileListFinale[] = { "finale%d.twn" };
+ static const char *const fmtMusicFileListIngame[] = { "km%02d.twn" };
- static const char *pc98MusicFileListIntro[] = { "intro%d.86" };
- static const char *pc98MusicFileListFinale[] = { "finale%d.86" };
- static const char *pc98MusicFileListIngame[] = { "km%02d.86" };
+ static const char *const pc98MusicFileListIntro[] = { "intro%d.86" };
+ static const char *const pc98MusicFileListFinale[] = { "finale%d.86" };
+ static const char *const pc98MusicFileListIngame[] = { "km%02d.86" };
memset(_soundData, 0, sizeof(_soundData));
if (_flags.platform == Common::kPlatformPC) {
@@ -1387,7 +1387,7 @@ const int GUI_v2::_sliderBarsPosition[] = {
const uint8 KyraEngine_HoF::_seqTextColorPresets[] = { 0x01, 0x01, 0x00, 0x3f, 0x3f, 0x3f };
-const char *KyraEngine_HoF::_languageExtension[] = {
+const char *const KyraEngine_HoF::_languageExtension[] = {
"ENG",
"FRE",
"GER",/*,
@@ -1396,7 +1396,7 @@ const char *KyraEngine_HoF::_languageExtension[] = {
"JPN",
};
-const char *KyraEngine_HoF::_scriptLangExt[] = {
+const char *const KyraEngine_HoF::_scriptLangExt[] = {
"EMC",
"FMC",
"GMC",/*,
@@ -1885,7 +1885,7 @@ const uint8 KyraEngine_HoF::_rainbowRoomData[] = {
// kyra 3 static res
-const char *KyraEngine_MR::_languageExtension[] = {
+const char *const KyraEngine_MR::_languageExtension[] = {
"TRE",
"TRF",
"TRG"/*,
diff --git a/engines/kyra/staticres_lol.cpp b/engines/kyra/staticres_lol.cpp
index ca35569afa..bf838cd572 100644
--- a/engines/kyra/staticres_lol.cpp
+++ b/engines/kyra/staticres_lol.cpp
@@ -261,13 +261,13 @@ void StaticResource::freeButtonDefs(void *&ptr, int &size) {
void LoLEngine::initStaticResource() {
// assign music data
- static const char *pcMusicFileListIntro[] = { "LOREINTR" };
- static const char *pcMusicFileListFinale[] = { "LOREFINL" };
- static const char *pcMusicFileListIngame[] = { "LORE%02d%c" };
+ static const char *const pcMusicFileListIntro[] = { "LOREINTR" };
+ static const char *const pcMusicFileListFinale[] = { "LOREFINL" };
+ static const char *const pcMusicFileListIngame[] = { "LORE%02d%c" };
- static const char *pc98MusicFileListIntro[] = { 0, "lore84.86", "lore82.86", 0, 0, 0, "lore83.86", "lore81.86" };
- static const char *pc98MusicFileListFinale[] = { 0, 0, "lore85.86", "lore86.86", "lore87.86" };
- static const char *pc98MusicFileListIngame[] = { "lore%02d.86" };
+ static const char *const pc98MusicFileListIntro[] = { 0, "lore84.86", "lore82.86", 0, 0, 0, "lore83.86", "lore81.86" };
+ static const char *const pc98MusicFileListFinale[] = { 0, 0, "lore85.86", "lore86.86", "lore87.86" };
+ static const char *const pc98MusicFileListIngame[] = { "lore%02d.86" };
memset(_soundData, 0, sizeof(_soundData));
if (_flags.platform == Common::kPlatformPC) {
diff --git a/engines/kyra/text_hof.cpp b/engines/kyra/text_hof.cpp
index 4406f3ec41..4a52d7d740 100644
--- a/engines/kyra/text_hof.cpp
+++ b/engines/kyra/text_hof.cpp
@@ -194,7 +194,7 @@ void KyraEngine_HoF::objectChat(const char *str, int object, int vocHigh, int vo
assert(_mainCharacter.facing * 3 + chatType < ARRAYSIZE(talkScriptTable));
int script = talkScriptTable[_mainCharacter.facing * 3 + chatType];
- static const char *chatScriptFilenames[] = {
+ static const char *const chatScriptFilenames[] = {
"_Z1FSTMT.EMC",
"_Z1FQUES.EMC",
"_Z1FEXCL.EMC",
diff --git a/engines/kyra/text_mr.cpp b/engines/kyra/text_mr.cpp
index fd4a00b73c..b680e9c6f9 100644
--- a/engines/kyra/text_mr.cpp
+++ b/engines/kyra/text_mr.cpp
@@ -216,7 +216,7 @@ void KyraEngine_MR::objectChat(const char *str, int object, int vocHigh, int voc
0x08, 0x09, 0x0A, 0x0B
};
- static const char *talkFilenameTable[] = {
+ static const char *const talkFilenameTable[] = {
"MTFL00S.EMC", "MTFL00Q.EMC", "MTFL00E.EMC", "MTFL00T.EMC",
"MTFR00S.EMC", "MTFR00Q.EMC", "MTFR00E.EMC", "MTFR00T.EMC",
"MTL00S.EMC", "MTL00Q.EMC", "MTL00E.EMC", "MTL00T.EMC",
diff --git a/engines/lastexpress/entities/francois.cpp b/engines/lastexpress/entities/francois.cpp
index 6bbe740730..2b170d93a3 100644
--- a/engines/lastexpress/entities/francois.cpp
+++ b/engines/lastexpress/entities/francois.cpp
@@ -221,7 +221,7 @@ IMPLEMENT_FUNCTION(9, Francois, function9)
case 1:
getObjects()->update(kObjectCompartmentD, kEntityPlayer, kObjectLocation2, kCursorKeepValue, kCursorKeepValue);
- break;
+ // Fallback to next case
case 2:
getData()->location = kLocationOutsideCompartment;
@@ -257,7 +257,7 @@ IMPLEMENT_FUNCTION(10, Francois, function10)
case 1:
getObjects()->update(kObjectCompartmentD, kEntityPlayer, kObjectLocation2, kCursorKeepValue, kCursorKeepValue);
getSavePoints()->push(kEntityFrancois, kEntityMmeBoutarel, kAction102484312);
- break;
+ // Fallback to next case
case 2:
getData()->location = kLocationInsideCompartment;
diff --git a/engines/lastexpress/game/entities.cpp b/engines/lastexpress/game/entities.cpp
index f6bb2030f0..1b31339b7b 100644
--- a/engines/lastexpress/game/entities.cpp
+++ b/engines/lastexpress/game/entities.cpp
@@ -753,50 +753,48 @@ label_nosequence:
if (!data->sequence)
goto label_nosequence;
- if (data->frame->getInfo()->field_30 > data->field_49B + 1 || (data->direction == kDirectionLeft && data->sequence->count() == 1)) {
+ if (data->frame->getInfo()->field_30 > (data->field_49B + 1) || (data->direction == kDirectionLeft && data->sequence->count() == 1)) {
++data->field_49B;
- INCREMENT_DIRECTION_COUNTER();
- return;
- }
+ } else {
+ if (data->frame->getInfo()->field_30 > data->field_49B && !data->frame->getInfo()->keepPreviousFrame) {
+ ++data->field_49B;
+ } else {
+ if (data->frame->getInfo()->keepPreviousFrame == 1)
+ keepPreviousFrame = true;
- if (data->frame->getInfo()->field_30 > data->field_49B && !data->frame->getInfo()->keepPreviousFrame) {
- ++data->field_49B;
- INCREMENT_DIRECTION_COUNTER();
- return;
- }
+ // Increment current frame
+ ++data->currentFrame;
- if (data->frame->getInfo()->keepPreviousFrame == 1)
- keepPreviousFrame = true;
+ if (data->currentFrame > (int16)(data->sequence->count() - 1) || (data->field_4A9 && checkSequenceFromPosition(entityIndex))) {
- // Increment current frame
- ++data->currentFrame;
+ if (data->direction == kDirectionLeft) {
+ data->currentFrame = 0;
+ } else {
+ keepPreviousFrame = true;
+ drawNextSequence(entityIndex);
- if (data->currentFrame > (int16)(data->sequence->count() - 1) || (data->field_4A9 && checkSequenceFromPosition(entityIndex))) {
+ if (getFlags()->flag_entities_0 || data->doProcessEntity)
+ return;
- if (data->direction == kDirectionLeft) {
- data->currentFrame = 0;
- } else {
- keepPreviousFrame = true;
- drawNextSequence(entityIndex);
+ if (!data->sequence2) {
+ updateEntityPosition(entityIndex);
+ data->doProcessEntity = false;
+ return;
+ }
- if (getFlags()->flag_entities_0 || data->doProcessEntity)
- return;
+ copySequenceData(entityIndex);
+ }
- if (!data->sequence2) {
- updateEntityPosition(entityIndex);
- data->doProcessEntity = false;
- return;
}
- copySequenceData(entityIndex);
- }
+ processFrame(entityIndex, keepPreviousFrame, false);
+ if (getFlags()->flag_entities_0 || data->doProcessEntity)
+ return;
+ }
}
- processFrame(entityIndex, keepPreviousFrame, false);
-
- if (!getFlags()->flag_entities_0 && !data->doProcessEntity)
- INCREMENT_DIRECTION_COUNTER();
+ INCREMENT_DIRECTION_COUNTER();
}
void Entities::computeCurrentFrame(EntityIndex entityIndex) const {
@@ -1109,9 +1107,8 @@ void Entities::processFrame(EntityIndex entityIndex, bool keepPreviousFrame, boo
// Get new frame info
FrameInfo *info = data->sequence->getFrameInfo((uint16)data->currentFrame);
- if (data->frame && data->frame->getInfo()->subType != kFrameType3)
- if (!info->field_2E || keepPreviousFrame)
- getScenes()->setCoordinates(data->frame);
+ if (data->frame && data->frame->getInfo()->subType != kFrameType3 && (!info->field_2E || keepPreviousFrame))
+ getScenes()->setCoordinates(data->frame);
// Update position
if (info->entityPosition) {
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index f38bac6e12..96e5e088ab 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -1673,6 +1673,12 @@ void Hotspot::doTalkTo(HotspotData *hotspot) {
faceHotspot(hotspot);
endAction();
+ // WORKAROUND: Fix crash when talking when an ask conversation is active
+ if (_data->talkDestCharacterId != 0) {
+ // Don't allow the talk to start
+ return;
+ }
+
uint16 sequenceOffset = res.getHotspotAction(hotspot->actionsOffset, TALK_TO);
if (sequenceOffset >= 0x8000) {
showMessage(sequenceOffset);
diff --git a/engines/made/screenfx.cpp b/engines/made/screenfx.cpp
index bdc36c87d7..77220a0ff5 100644
--- a/engines/made/screenfx.cpp
+++ b/engines/made/screenfx.cpp
@@ -58,11 +58,6 @@ ScreenEffects::~ScreenEffects() {
}
void ScreenEffects::run(int16 effectNum, Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
- // Workaround: we set up the final palette beforehand, to reduce CPU usage during the screen effect.
- // The visual difference is not noticeable, but CPU load is much much less (as palette updates are very expensive).
- // The palette changes in the effects have been removed, where applicable, to reduce CPU load
- setPalette(palette);
-
// TODO: Put effect functions into an array
switch (effectNum) {
@@ -188,6 +183,28 @@ void ScreenEffects::setBlendedPalette(byte *palette, byte *newPalette, int color
}
}
+void ScreenEffects::startBlendedPalette(byte *palette, byte *newPalette, int colorCount, int16 maxValue) {
+ _blendedPaletteStatus._palette = palette;
+ _blendedPaletteStatus._newPalette = newPalette;
+ _blendedPaletteStatus._colorCount = colorCount;
+ _blendedPaletteStatus._maxValue = maxValue;
+ _blendedPaletteStatus._incr = maxValue / 10; // ~10 palette updates
+ _blendedPaletteStatus._value = 0;
+ // Don't do anything if the two palettes are identical
+ _blendedPaletteStatus._active = memcmp(palette, newPalette, colorCount * 3) != 0;
+}
+
+void ScreenEffects::stepBlendedPalette() {
+ if (_blendedPaletteStatus._active && _blendedPaletteStatus._value < _blendedPaletteStatus._maxValue) {
+ setBlendedPalette(_blendedPaletteStatus._palette, _blendedPaletteStatus._newPalette,
+ _blendedPaletteStatus._colorCount, _blendedPaletteStatus._value, _blendedPaletteStatus._maxValue);
+ if (_blendedPaletteStatus._value == _blendedPaletteStatus._maxValue)
+ _blendedPaletteStatus._value++;
+ else
+ _blendedPaletteStatus._value = MIN<int16>(_blendedPaletteStatus._value + _blendedPaletteStatus._incr, _blendedPaletteStatus._maxValue);
+ }
+}
+
void ScreenEffects::copyFxRect(Graphics::Surface *surface, int16 x1, int16 y1, int16 x2, int16 y2) {
// TODO: Clean up
@@ -273,71 +290,78 @@ void ScreenEffects::vfx00(Graphics::Surface *surface, byte *palette, byte *newPa
}
void ScreenEffects::vfx01(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 312);
for (int x = 0; x < 320; x += 8) {
_screen->copyRectToScreen((const byte*)surface->getBasePtr(x, 0), surface->pitch, x, 0, 8, 200);
- //setBlendedPalette(palette, newPalette, colorCount, x, 312); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
void ScreenEffects::vfx02(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 312);
for (int x = 312; x >= 0; x -= 8) {
_screen->copyRectToScreen((const byte*)surface->getBasePtr(x, 0), surface->pitch, x, 0, 8, 200);
- //setBlendedPalette(palette, newPalette, colorCount, 312 - x, 312); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
void ScreenEffects::vfx03(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 190);
for (int y = 0; y < 200; y += 10) {
_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y), surface->pitch, 0, y, 320, 10);
- //setBlendedPalette(palette, newPalette, colorCount, y, 190); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
void ScreenEffects::vfx04(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 190);
for (int y = 190; y >= 0; y -= 10) {
_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y), surface->pitch, 0, y, 320, 10);
- //setBlendedPalette(palette, newPalette, colorCount, 190 - y, 190); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
void ScreenEffects::vfx05(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 90);
for (int y = 0; y < 100; y += 10) {
_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, y + 100), surface->pitch, 0, y + 100, 320, 10);
_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, 90 - y), surface->pitch, 0, 90 - y, 320, 10);
- //setBlendedPalette(palette, newPalette, colorCount, y, 90); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Curtain open" effect
void ScreenEffects::vfx06(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 152);
for (int x = 0; x < 160; x += 8) {
_screen->copyRectToScreen((const byte*)surface->getBasePtr(x + 160, 0), surface->pitch, x + 160, 0, 8, 200);
_screen->copyRectToScreen((const byte*)surface->getBasePtr(152 - x, 0), surface->pitch, 152 - x, 0, 8, 200);
- //setBlendedPalette(palette, newPalette, colorCount, x, 152); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Curtain close" effect
void ScreenEffects::vfx07(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 152);
for (int x = 152; x >= 0; x -= 8) {
_screen->copyRectToScreen((const byte*)surface->getBasePtr(x + 160, 0), surface->pitch, x + 160, 0, 8, 200);
_screen->copyRectToScreen((const byte*)surface->getBasePtr(152 - x, 0), surface->pitch, 152 - x, 0, 8, 200);
- //setBlendedPalette(palette, newPalette, colorCount, 152 - x, 152); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Screen slide in" right to left
@@ -346,7 +370,7 @@ void ScreenEffects::vfx08(Graphics::Surface *surface, byte *palette, byte *newPa
_screen->copyRectToScreen((const byte*)surface->getBasePtr(0, 0), surface->pitch, 320 - x, 0, x, 200);
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Checkerboard" effect
@@ -365,77 +389,84 @@ void ScreenEffects::vfx09(Graphics::Surface *surface, byte *palette, byte *newPa
// "Screen wipe in", left to right
void ScreenEffects::vfx10(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 368);
for (int x = -56; x < 312; x += 8) {
copyFxRect(surface, x, 0, x + 64, 200);
- //setBlendedPalette(palette, newPalette, colorCount, x + 56, 368); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Screen wipe in", right to left
void ScreenEffects::vfx11(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 368);
for (int x = 312; x > -56; x -= 8) {
copyFxRect(surface, x, 0, x + 64, 200);
- //setBlendedPalette(palette, newPalette, colorCount, x + 56, 368); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Screen wipe in", top to bottom
void ScreenEffects::vfx12(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 260);
for (int y = -70; y < 312; y += 10) {
copyFxRect(surface, 0, y, 320, y + 80);
- //setBlendedPalette(palette, newPalette, colorCount, y + 70, 260); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Screen wipe in", bottom to top
void ScreenEffects::vfx13(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
+ startBlendedPalette(palette, newPalette, colorCount, 260);
for (int y = 312; y > -70; y -= 10) {
copyFxRect(surface, 0, y, 320, y + 80);
- //setBlendedPalette(palette, newPalette, colorCount, y + 70, 260); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Screen open" effect
void ScreenEffects::vfx14(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
int16 x = 8, y = 5;
+ startBlendedPalette(palette, newPalette, colorCount, 27);
for (int i = 0; i < 27; i++) {
copyFxRect(surface, 160 - x, 100 - y, 160 + x, 100 + y);
x += 8;
y += 5;
- //setBlendedPalette(palette, newPalette, colorCount, i, 27); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
void ScreenEffects::vfx15(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
int16 x = 8;
+ startBlendedPalette(palette, newPalette, colorCount, 27);
for (int i = 0; i < 27; i++) {
copyFxRect(surface, 160 - x, 0, 160 + x, 200);
x += 8;
- //setBlendedPalette(palette, newPalette, colorCount, i, 27); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
void ScreenEffects::vfx16(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount) {
int16 y = 8;
+ startBlendedPalette(palette, newPalette, colorCount, 27);
for (int i = 0; i < 27; i++) {
copyFxRect(surface, 0, 100 - y, 320, 100 + y);
y += 5;
- //setBlendedPalette(palette, newPalette, colorCount, i, 27); // original behavior
+ stepBlendedPalette();
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// Palette fadeout/fadein
@@ -448,16 +479,12 @@ void ScreenEffects::vfx17(Graphics::Surface *surface, byte *palette, byte *newPa
memcpy(tempPalette, palette, 768);
- // We reduce the number of palette updates by the following factor (e.g. a factor of 5 would mean 5
- // times less updates). This is done to reduce CPU load while performing the very expensive full
- // screen palette changes. The original behavior is to set factor to 1.
- int factor = 5;
-
// Fade out to black
memset(palette, 0, 768);
- for (int i = 0; i < 50 / factor; i++) {
- setBlendedPalette(palette, newPalette, colorCount, i * factor, 50);
- _screen->updateScreenAndWait(25 * factor);
+ startBlendedPalette(palette, newPalette, colorCount, 50);
+ for (int i = 0; i < 50; i++) {
+ stepBlendedPalette();
+ _screen->updateScreenAndWait(25);
}
_screen->setRGBPalette(palette, 0, colorCount);
@@ -467,9 +494,10 @@ void ScreenEffects::vfx17(Graphics::Surface *surface, byte *palette, byte *newPa
// Fade from black to palette
memset(newPalette, 0, 768);
- for (int i = 0; i < 50 / factor; i++) {
- setBlendedPalette(palette, newPalette, colorCount, i * factor, 50);
- _screen->updateScreenAndWait(25 * factor);
+ startBlendedPalette(palette, newPalette, colorCount, 50);
+ for (int i = 0; i < 50; i++) {
+ stepBlendedPalette();
+ _screen->updateScreenAndWait(25);
}
_screen->setRGBPalette(palette, 0, colorCount);
@@ -484,7 +512,7 @@ void ScreenEffects::vfx18(Graphics::Surface *surface, byte *palette, byte *newPa
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Screen slide in" top to bottom
@@ -494,7 +522,7 @@ void ScreenEffects::vfx19(Graphics::Surface *surface, byte *palette, byte *newPa
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
// "Screen slide in" bottom to top
@@ -504,7 +532,7 @@ void ScreenEffects::vfx20(Graphics::Surface *surface, byte *palette, byte *newPa
_screen->updateScreenAndWait(25);
}
- //setPalette(palette); // original behavior
+ setPalette(palette);
}
} // End of namespace Made
diff --git a/engines/made/screenfx.h b/engines/made/screenfx.h
index 793fcba2d6..6011da7d6f 100644
--- a/engines/made/screenfx.h
+++ b/engines/made/screenfx.h
@@ -34,6 +34,14 @@
namespace Made {
+struct BlendedPaletteStatus {
+ bool _active;
+ byte *_palette, *_newPalette;
+ int _colorCount;
+ int16 _value, _maxValue, _incr;
+ int cnt;
+};
+
class ScreenEffects {
public:
ScreenEffects(Screen *screen);
@@ -47,8 +55,12 @@ private:
static const byte vfxOffsIndexTable[8];
const byte *vfxOffsTablePtr;
int16 vfxX1, vfxY1, vfxWidth, vfxHeight;
+ BlendedPaletteStatus _blendedPaletteStatus;
+
void setPalette(byte *palette);
void setBlendedPalette(byte *palette, byte *newPalette, int colorCount, int16 value, int16 maxValue);
+ void startBlendedPalette(byte *palette, byte *newPalette, int colorCount, int16 maxValue);
+ void stepBlendedPalette();
void copyFxRect(Graphics::Surface *surface, int16 x1, int16 y1, int16 x2, int16 y2);
void vfx00(Graphics::Surface *surface, byte *palette, byte *newPalette, int colorCount);
diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp
index cbd17e0b86..8c72c9875e 100644
--- a/engines/mohawk/cursors.cpp
+++ b/engines/mohawk/cursors.cpp
@@ -199,12 +199,10 @@ void MacCursorManager::setCursor(uint16 id) {
if (!stream)
stream = _resFork->getResource(MKTAG('C','U','R','S'), id);
- if (stream) {
+ if (stream)
setMacCursor(stream);
- delete stream;
- } else {
+ else
setDefaultCursor();
- }
}
LivingBooksCursorManager_v2::LivingBooksCursorManager_v2() {
diff --git a/engines/mohawk/detection_tables.h b/engines/mohawk/detection_tables.h
index a587d06760..25ca9cd916 100644
--- a/engines/mohawk/detection_tables.h
+++ b/engines/mohawk/detection_tables.h
@@ -700,6 +700,22 @@ static const MohawkGameDescription gameDescriptions[] = {
0
},
+ // From afholman in bug #3309306
+ {
+ {
+ "lbsampler",
+ "v3",
+ AD_ENTRY1("outline", "8397cea6bed1ff90029f7602ef37684d"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ Common::GUIO_NONE
+ },
+ GType_LIVINGBOOKSV3,
+ 0,
+ "Living Books Sampler"
+ },
+
{
{
"maggiesfa",
@@ -1221,7 +1237,7 @@ static const MohawkGameDescription gameDescriptions[] = {
AD_ENTRY1("OUTLINE", "159c18b663c58d1aa17ad5e1ab1f0e12"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
+ ADGF_UNSTABLE,
Common::GUIO_NONE
},
GType_LIVINGBOOKSV3,
@@ -1605,6 +1621,23 @@ static const MohawkGameDescription gameDescriptions[] = {
"Living Books Player"
},
+ // Arthur Birthday (English) Version 2.0 Windows(R) August 8, 1997
+ // From jacecen in bug #3413119
+ {
+ {
+ "arthurbday",
+ "",
+ AD_ENTRY1("Outline", "3b793adf2b303722e0fb6c632f94e1fb"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ Common::GUIO_NONE
+ },
+ GType_LIVINGBOOKSV3,
+ 0,
+ 0
+ },
+
{
{
"arthurbday",
@@ -1977,6 +2010,23 @@ static const MohawkGameDescription gameDescriptions[] = {
"FIGHT.EXE"
},
+ // The Berenstain Bears Get in a Fight (English and Spanish) Version 1.0 1995
+ // From jacecen in bug #3413119
+ {
+ {
+ "bearfight",
+ "",
+ AD_ENTRY1("FIGHT.512", "e313242a4cba2fffcd8cded5ca23c68a"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ Common::GUIO_NONE
+ },
+ GType_LIVINGBOOKSV1,
+ 0,
+ "FIGHT.EXE"
+ },
+
{
{
"bearfight",
diff --git a/engines/mohawk/graphics.cpp b/engines/mohawk/graphics.cpp
index 35c9d478d8..c4326d175f 100644
--- a/engines/mohawk/graphics.cpp
+++ b/engines/mohawk/graphics.cpp
@@ -672,12 +672,50 @@ void MystGraphics::simulatePreviousDrawDelay(const Common::Rect &dest) {
_nextAllowedDrawTime = time + _constantDrawDelay + dest.height() * dest.width() / _proportionalDrawDelay;
}
+void MystGraphics::copyBackBufferToScreenWithSaturation(int16 saturation) {
+ Graphics::Surface *screen = _vm->_system->lockScreen();
+
+ for (uint16 y = 0; y < _viewport.height(); y++)
+ for (uint16 x = 0; x < _viewport.width(); x++) {
+ uint32 color;
+ uint8 r, g, b;
+
+ if (_pixelFormat.bytesPerPixel == 2)
+ color = *(const uint16 *)_backBuffer->getBasePtr(x, y);
+ else
+ color = *(const uint32 *)_backBuffer->getBasePtr(x, y);
+
+ _pixelFormat.colorToRGB(color, r, g, b);
+
+ r = CLIP<int16>((int16)r - saturation, 0, 255);
+ g = CLIP<int16>((int16)g - saturation, 0, 255);
+ b = CLIP<int16>((int16)b - saturation, 0, 255);
+
+ color = _pixelFormat.RGBToColor(r, g, b);
+
+ if (_pixelFormat.bytesPerPixel == 2) {
+ uint16 *dst = (uint16 *)screen->getBasePtr(x, y);
+ *dst = color;
+ } else {
+ uint32 *dst = (uint32 *)screen->getBasePtr(x, y);
+ *dst = color;
+ }
+ }
+
+ _vm->_system->unlockScreen();
+ _vm->_system->updateScreen();
+}
+
void MystGraphics::fadeToBlack() {
- // TODO: Implement
+ for (int16 i = 0; i < 256; i += 32) {
+ copyBackBufferToScreenWithSaturation(i);
+ }
}
void MystGraphics::fadeFromBlack() {
- // TODO: Implement
+ for (int16 i = 256; i >= 0; i -= 32) {
+ copyBackBufferToScreenWithSaturation(i);
+ }
}
#endif // ENABLE_MYST
diff --git a/engines/mohawk/graphics.h b/engines/mohawk/graphics.h
index 96357bbff1..463608a2aa 100644
--- a/engines/mohawk/graphics.h
+++ b/engines/mohawk/graphics.h
@@ -136,6 +136,7 @@ protected:
MohawkSurface *decodeImage(uint16 id);
MohawkEngine *getVM() { return (MohawkEngine *)_vm; }
void simulatePreviousDrawDelay(const Common::Rect &dest);
+ void copyBackBufferToScreenWithSaturation(int16 saturation);
private:
MohawkEngine_Myst *_vm;
diff --git a/engines/mohawk/myst_stacks/channelwood.cpp b/engines/mohawk/myst_stacks/channelwood.cpp
index 0dd69a673a..9ca47cc92a 100644
--- a/engines/mohawk/myst_stacks/channelwood.cpp
+++ b/engines/mohawk/myst_stacks/channelwood.cpp
@@ -159,6 +159,16 @@ uint16 Channelwood::getVar(uint16 var) {
return ((_state.waterValveStates & 0xe2) == 0x80) ? 1 : 0;
case 30: // Door State
return _doorOpened;
+ case 31: // Water flowing in pipe fork ?
+ // 0 -> keep sound.
+ // 1 -> not flowing.
+ // 2 --> flowing.
+ if ((_state.waterValveStates & 0xe2) == 0x82) // From left.
+ return 2;
+ if ((_state.waterValveStates & 0xf4) == 0xa0) // From right.
+ return 1;
+
+ return 0;
case 32: // Sound - Water Flowing in Pipe to Book Room Elevator
return ((_state.waterValveStates & 0xf8) == 0xb0 && _state.pipeState) ? 1 : 0;
case 33: // Channelwood Lower Walkway to Upper Walkway Spiral Stair Upper Door State
diff --git a/engines/mohawk/myst_stacks/demo.cpp b/engines/mohawk/myst_stacks/demo.cpp
index c9e806655e..fbad7dc384 100644
--- a/engines/mohawk/myst_stacks/demo.cpp
+++ b/engines/mohawk/myst_stacks/demo.cpp
@@ -84,7 +84,10 @@ void Demo::o_stopIntro(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
void Demo::o_fadeFromBlack(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Fade from black", op);
- _vm->_gfx->fadeFromBlack();
+
+ // FIXME: This glitches when enabled. The backbuffer is drawn to screen,
+ // and then the fading occurs, causing the background to appear for one frame.
+ // _vm->_gfx->fadeFromBlack();
}
void Demo::o_fadeToBlack(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -101,14 +104,14 @@ void Demo::returnToMenu_run() {
switch (_returnToMenuStep){
case 0:
_vm->_gfx->fadeToBlack();
- _vm->changeToCard(2003, true);
+ _vm->changeToCard(2003, false);
_vm->_gfx->fadeFromBlack();
_returnToMenuStep++;
break;
case 1:
_vm->_gfx->fadeToBlack();
- _vm->changeToCard(2001, true);
+ _vm->changeToCard(2001, false);
_vm->_gfx->fadeFromBlack();
_vm->_cursor->showCursor();
diff --git a/engines/mohawk/myst_stacks/dni.cpp b/engines/mohawk/myst_stacks/dni.cpp
index cf28945c71..2ced265f02 100644
--- a/engines/mohawk/myst_stacks/dni.cpp
+++ b/engines/mohawk/myst_stacks/dni.cpp
@@ -106,7 +106,7 @@ void Dni::o_handPage(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
if (_globals.ending == 1 && _vm->_video->getElapsedTime(atrus) > (uint)Audio::Timestamp(0, 6801, 600).msecs()) {
_globals.ending = 2;
_globals.heldPage = 0;
- _vm->_cursor->setCursor(kDefaultMystCursor);
+ _vm->setMainCursor(kDefaultMystCursor);
// Play movie end (atrus leaving)
_vm->_video->setVideoBounds(atrus, Audio::Timestamp(0, 14813, 600), Audio::Timestamp(0xFFFFFFFF));
diff --git a/engines/mohawk/myst_stacks/myst.cpp b/engines/mohawk/myst_stacks/myst.cpp
index 66492d1200..b67b333a85 100644
--- a/engines/mohawk/myst_stacks/myst.cpp
+++ b/engines/mohawk/myst_stacks/myst.cpp
@@ -1350,8 +1350,10 @@ void Myst::o_generatorButtonPressed(uint16 op, uint16 var, uint16 argc, uint16 *
if (_state.generatorVoltage)
_vm->_sound->replaceSoundMyst(8297);
- else
+ else {
_vm->_sound->replaceSoundMyst(9297);
+ _vm->_sound->stopBackgroundMyst();
+ }
} else {
if (_generatorVoltage)
_vm->_sound->replaceSoundMyst(6297);
diff --git a/engines/mohawk/myst_stacks/preview.cpp b/engines/mohawk/myst_stacks/preview.cpp
index 1b72c85d96..31e22bb8c5 100644
--- a/engines/mohawk/myst_stacks/preview.cpp
+++ b/engines/mohawk/myst_stacks/preview.cpp
@@ -85,7 +85,10 @@ void Preview::o_fadeToBlack(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
void Preview::o_fadeFromBlack(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Fade from black", op);
- _vm->_gfx->fadeFromBlack();
+
+ // FIXME: This glitches when enabled. The backbuffer is drawn to screen,
+ // and then the fading occurs, causing the background to appear for one frame.
+ // _vm->_gfx->fadeFromBlack();
}
void Preview::o_stayHere(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
@@ -99,6 +102,7 @@ void Preview::o_stayHere(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
void Preview::o_speechStop(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
debugC(kDebugScript, "Opcode %d: Speech stop", op);
+ _vm->_sound->stopSound(3001);
_speechRunning = false;
_globals.currentAge = 2;
}
@@ -143,7 +147,7 @@ void Preview::speech_run() {
case 2: // Go to Myst
if (_currentCue >= 2) {
_vm->_gfx->fadeToBlack();
- _vm->changeToCard(3002, true);
+ _vm->changeToCard(3002, false);
_vm->_gfx->fadeFromBlack();
_speechStep++;
@@ -186,7 +190,7 @@ void Preview::speech_run() {
break;
_vm->_gfx->fadeToBlack();
- _vm->changeToCard(3005, true);
+ _vm->changeToCard(3005, false);
_vm->_gfx->fadeFromBlack();
_speechNextTime = time + 1000;
_speechStep++;
diff --git a/engines/mohawk/myst_stacks/slides.cpp b/engines/mohawk/myst_stacks/slides.cpp
index 943cb90071..794793e49c 100644
--- a/engines/mohawk/myst_stacks/slides.cpp
+++ b/engines/mohawk/myst_stacks/slides.cpp
@@ -63,7 +63,7 @@ void Slides::runPersistentScripts() {
// Used on Cards...
if (_vm->_system->getMillis() > _nextCardTime) {
_vm->_gfx->fadeToBlack();
- _vm->changeToCard(_nextCardID, true);
+ _vm->changeToCard(_nextCardID, false);
_vm->_gfx->fadeFromBlack();
}
}
diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp
index 48d84ed101..c351551e36 100644
--- a/engines/parallaction/gfxbase.cpp
+++ b/engines/parallaction/gfxbase.cpp
@@ -55,17 +55,14 @@ const char *GfxObj::getName() const {
return _name;
}
-
uint GfxObj::getNum() {
return _frames->getNum();
}
-
void GfxObj::getRect(uint f, Common::Rect &r) {
_frames->getRect(f, r);
}
-
byte *GfxObj::getData(uint f) {
return _frames->getData(f);
}
@@ -77,7 +74,6 @@ uint GfxObj::getSize(uint f) {
return _frames->getSize(f);
}
-
void GfxObj::setFlags(uint32 flags) {
_flags |= flags;
}
@@ -108,6 +104,7 @@ void Gfx::resetSceneDrawList() {
}
GfxObj* Gfx::loadAnim(const char *name) {
+ debugC(1, kDebugGraphics, "Gfx::loadAnim(\"%s\")", name);
Frames* frames = _disk->loadFrames(name);
assert(frames);
@@ -146,7 +143,6 @@ GfxObj* Gfx::loadDoor(const char *name) {
return obj;
}
-
void Gfx::freeLocationObjects() {
freeDialogueObjects();
freeLabels();
@@ -157,6 +153,7 @@ void Gfx::freeCharacterObjects() {
}
void BackgroundInfo::loadGfxObjMask(const char *name, GfxObj *obj) {
+ debugC(1, kDebugGraphics, "BackgroundInfo::loadGfxObjMask(\"%s\")", name);
Common::Rect rect;
obj->getRect(0, rect);
@@ -180,6 +177,7 @@ void Gfx::showGfxObj(GfxObj* obj, bool visible) {
if (!obj) {
return;
}
+ debugC(1, kDebugGraphics, "Gfx::showGfxObj(\"%s\", visible:%d)", obj->getName(), visible ? 1 : 0);
if (visible) {
obj->setFlags(kGfxObjVisible);
@@ -188,27 +186,27 @@ void Gfx::showGfxObj(GfxObj* obj, bool visible) {
}
if (obj->_hasMask) {
+ debugC(1, kDebugGraphics, "\tHas Mask");
_backgroundInfo->toggleMaskPatch(obj->_maskId, obj->x, obj->y, visible);
}
if (obj->_hasPath) {
+ debugC(1, kDebugGraphics, "\tHas Path");
_backgroundInfo->togglePathPatch(obj->_pathId, obj->x, obj->y, visible);
}
}
-
-
bool compareZ(const GfxObj* a1, const GfxObj* a2) {
return (a1->z == a2->z) ? (a1->_prog < a2->_prog) : (a1->z < a2->z);
}
void Gfx::sortScene() {
+ debugC(3, kDebugGraphics, "Gfx::sortScene()");
GfxObjArray::iterator first = _sceneObjects.begin();
GfxObjArray::iterator last = _sceneObjects.end();
Common::sort(first, last, compareZ);
}
-
void Gfx::drawGfxObject(GfxObj *obj, Graphics::Surface &surf) {
if (!obj->isVisible()) {
return;
@@ -236,16 +234,13 @@ void Gfx::drawGfxObject(GfxObj *obj, Graphics::Surface &surf) {
}
-
void Gfx::drawText(Font *font, Graphics::Surface* surf, uint16 x, uint16 y, const char *text, byte color) {
byte *dst = (byte*)surf->getBasePtr(x, y);
font->setColor(color);
font->drawString(dst, surf->w, text);
}
-
void Gfx::unpackBlt(const Common::Rect& r, byte *data, uint size, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor) {
-
byte *d = _unpackedBitmap;
uint pixelsLeftInLine = r.width();
@@ -273,7 +268,6 @@ void Gfx::unpackBlt(const Common::Rect& r, byte *data, uint size, Graphics::Surf
blt(r, _unpackedBitmap, surf, z, scale, transparentColor);
}
-
void Gfx::bltMaskScale(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor) {
if (scale == 100) {
// use optimized path
@@ -301,7 +295,6 @@ void Gfx::bltMaskScale(const Common::Rect& r, byte *data, Graphics::Surface *sur
dstRect.clip(clipper);
if (!dstRect.isValidRect()) return;
-
// clipped source rectangle
Common::Rect srcRect;
srcRect.left = (dstRect.left - scaledLeft) * 100 / scale;
@@ -448,10 +441,8 @@ void Gfx::bltNoMaskNoScale(const Common::Rect& r, byte *data, Graphics::Surface
}
}
-
void Gfx::blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor) {
bltMaskScale(r, data, surf, z, scale, transparentColor);
}
-
} // namespace Parallaction
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp
index 22406013a1..fe21732f03 100644
--- a/engines/parallaction/objects.cpp
+++ b/engines/parallaction/objects.cpp
@@ -220,7 +220,11 @@ bool Zone::hitRect(int x, int y) const {
if (_right < _left || _bottom < _top) {
return false;
}
- return Common::Rect(_left, _top, _right, _bottom).contains(x, y);
+
+ Common::Rect r(_left, _top, _right + 1, _bottom + 1);
+ r.grow(-1);
+
+ return r.contains(x, y);
}
Dialogue::Dialogue() {
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index a37c4439a1..2fffc9071c 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -899,22 +899,23 @@ void CharacterName::bind(const char *name) {
_dummy = IS_DUMMY_CHARACTER(name);
if (!_dummy) {
- if (!strstr(name, "donna")) {
+ if (!strcmp(name, "donna")) {
_engineFlags &= ~kEngineTransformedDonna;
- } else
- if (_engineFlags & kEngineTransformedDonna) {
- _suffix = _suffixTras;
} else {
- const char *s = strstr(name, "tras");
- if (s) {
- _engineFlags |= kEngineTransformedDonna;
+ if (_engineFlags & kEngineTransformedDonna) {
_suffix = _suffixTras;
- end = s;
+ } else {
+ const char *s = strstr(name, "tras");
+ if (s) {
+ _engineFlags |= kEngineTransformedDonna;
+ _suffix = _suffixTras;
+ end = s;
+ }
+ }
+ if (IS_MINI_CHARACTER(name)) {
+ _prefix = _prefixMini;
+ begin = name + 4;
}
- }
- if (IS_MINI_CHARACTER(name)) {
- _prefix = _prefixMini;
- begin = name+4;
}
}
diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp
index 100b608172..a73f1558e8 100644
--- a/engines/parallaction/parser_ns.cpp
+++ b/engines/parallaction/parser_ns.cpp
@@ -1334,6 +1334,21 @@ void LocationParser_ns::parseGetData(ZonePtr z) {
obj->x = z->getX();
obj->y = z->getY();
obj->_prog = _zoneProg;
+
+ // WORKAROUND for script bug #2969913
+ // The katana object has the same default z index (kGfxObjGetZ or -100)
+ // as the cripta object (the safe) - a script bug.
+ // Game scripts do not set an explicit z for the katana (as it isn't an
+ // animation), but rather rely on the draw order to draw it over the
+ // safe. In this particular case, the safe is added to the scene after
+ // the katana, thus it is drawn over the katana. We explicitly set the
+ // z index of the katana to be higher than the safe, so that the katana
+ // is drawn correctly over it.
+ // This is a regression from the graphics rewrite (commits be2c5d3,
+ // 3c2c16c and 44906f5).
+ if (!scumm_stricmp(obj->getName(), "katana"))
+ obj->z = 0;
+
bool visible = (z->_flags & kFlagsRemove) == 0;
_vm->_gfx->showGfxObj(obj, visible);
data->_gfxobj = obj;
diff --git a/engines/queen/graphics.cpp b/engines/queen/graphics.cpp
index d9a8a10d70..fbb72fde44 100644
--- a/engines/queen/graphics.cpp
+++ b/engines/queen/graphics.cpp
@@ -1201,7 +1201,7 @@ void BamScene::updateCarAnimation() {
}
void BamScene::updateFightAnimation() {
- static const BamDataBlock *fightDataBlocks[] = {
+ static const BamDataBlock *const fightDataBlocks[] = {
_fight1Data,
_fight2Data,
_fight3Data
diff --git a/engines/queen/input.cpp b/engines/queen/input.cpp
index 5a04b0f8a4..30bf681e63 100644
--- a/engines/queen/input.cpp
+++ b/engines/queen/input.cpp
@@ -30,7 +30,7 @@
namespace Queen {
-const char *Input::_commandKeys[] = {
+const char *const Input::_commandKeys[] = {
"ocmglptu", // English
"osbgpnre", // German
"ofdnepau", // French
diff --git a/engines/queen/input.h b/engines/queen/input.h
index 93e2bde638..0aa04dd026 100644
--- a/engines/queen/input.h
+++ b/engines/queen/input.h
@@ -141,7 +141,7 @@ private:
const char *_currentCommandKeys;
//! command keys for all languages
- static const char *_commandKeys[];
+ static const char *const _commandKeys[];
//! verbs matching the command keys
static const Verb _verbKeys[];
diff --git a/engines/queen/musicdata.cpp b/engines/queen/musicdata.cpp
index d3974dcdbf..a046355446 100644
--- a/engines/queen/musicdata.cpp
+++ b/engines/queen/musicdata.cpp
@@ -1495,7 +1495,7 @@ const TuneData Sound::_tune[] = {
{ { 77, 1017, 0 }, { 0, 0 }, 1, 0 }
};
-const char *Sound::_sfxName[] = {
+const char *const Sound::_sfxName[] = {
/* 1 - Door Open (standard) */
"116Bssss",
diff --git a/engines/queen/resource.cpp b/engines/queen/resource.cpp
index d837a63cb5..84043fa3af 100644
--- a/engines/queen/resource.cpp
+++ b/engines/queen/resource.cpp
@@ -30,7 +30,7 @@
namespace Queen {
-const char *Resource::_tableFilename = "queen.tbl";
+const char *const Resource::_tableFilename = "queen.tbl";
const RetailGameVersion Resource::_gameVersions[] = {
{ "PEM10", 1, 0x00000008, 22677657 },
diff --git a/engines/queen/resource.h b/engines/queen/resource.h
index 5c6746e92f..ef8e463631 100644
--- a/engines/queen/resource.h
+++ b/engines/queen/resource.h
@@ -158,7 +158,7 @@ protected:
static const RetailGameVersion *detectGameVersionFromSize(uint32 size);
//! resource table filename (queen.tbl)
- static const char *_tableFilename;
+ static const char *const _tableFilename;
//! known FOTAQ versions
static const RetailGameVersion _gameVersions[];
diff --git a/engines/queen/sound.h b/engines/queen/sound.h
index 2aabb0d73b..371500f356 100644
--- a/engines/queen/sound.h
+++ b/engines/queen/sound.h
@@ -104,7 +104,7 @@ public:
static const SongData _song[];
static const TuneData _tuneDemo[];
static const TuneData _tune[];
- static const char *_sfxName[];
+ static const char *const _sfxName[];
static const int16 _jungleList[];
protected:
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index fe37ed8995..994b35cbf8 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -324,6 +324,7 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) {
}
Interface::~Interface() {
+ _vm->getTimerManager()->removeTimerProc(&saveReminderCallback);
}
void Interface::saveReminderCallback(void *refCon) {
diff --git a/engines/saga/script.cpp b/engines/saga/script.cpp
index f4902b6c11..96746b538c 100644
--- a/engines/saga/script.cpp
+++ b/engines/saga/script.cpp
@@ -26,6 +26,7 @@
#include "saga/gfx.h"
#include "saga/console.h"
+#include "saga/animation.h"
#include "saga/script.h"
#include "saga/interface.h"
#include "saga/itedata.h"
@@ -941,6 +942,18 @@ void Script::opSpeak(SCRIPTOP_PARAMS) {
return;
}
+#ifdef ENABLE_IHNM
+ // WORKAROUND for script bug #3358007 in IHNM. When the zeppelin is landing
+ // and the player attempts to exit from the right door in room 13, the game
+ // scripts change to scene 5, but do not clear the cutaway that appears
+ // before Gorrister's speech starts, resulting in a deadlock. We do this
+ // manually here.
+ if (_vm->getGameId() == GID_IHNM && _vm->_scene->currentChapterNumber() == 1 &&
+ _vm->_scene->currentSceneNumber() == 5 && _vm->_anim->hasCutaway()) {
+ _vm->_anim->returnFromCutaway();
+ }
+#endif
+
int stringsCount = scriptS->readByte();
uint16 actorId = scriptS->readUint16LE();
uint16 speechFlags = scriptS->readByte();
diff --git a/engines/saga/sthread.cpp b/engines/saga/sthread.cpp
index afd528f4b5..6e5cc68ae6 100644
--- a/engines/saga/sthread.cpp
+++ b/engines/saga/sthread.cpp
@@ -102,9 +102,8 @@ void Script::wakeUpThreadsDelayed(int waitType, int sleepTime) {
void Script::executeThreads(uint msec) {
ScriptThreadList::iterator threadIterator;
- if (_vm->_interface->_statusTextInput) {
+ if (_vm->_interface->_statusTextInput)
return;
- }
threadIterator = _threadList.begin();
@@ -129,11 +128,10 @@ void Script::executeThreads(uint msec) {
switch (thread._waitType) {
case kWaitTypeDelay:
- if (thread._sleepTime < msec) {
+ if (thread._sleepTime < msec)
thread._sleepTime = 0;
- } else {
+ else
thread._sleepTime -= msec;
- }
if (thread._sleepTime == 0)
thread._flags &= ~kTFlagWaiting;
@@ -141,11 +139,9 @@ void Script::executeThreads(uint msec) {
case kWaitTypeWalk:
{
- ActorData *actor;
- actor = (ActorData *)thread._threadObj;
- if (actor->_currentAction == kActionWait) {
+ ActorData *actor = (ActorData *)thread._threadObj;
+ if (actor->_currentAction == kActionWait)
thread._flags &= ~kTFlagWaiting;
- }
}
break;
@@ -157,9 +153,8 @@ void Script::executeThreads(uint msec) {
}
if (!(thread._flags & kTFlagWaiting)) {
- if (runThread(thread)) {
+ if (runThread(thread))
break;
- }
}
++threadIterator;
diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index 33ca3a6c9c..56da696592 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -296,8 +296,10 @@ Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, R
sierraId == "mg" || sierraId == "pq" ||
sierraId == "jones" ||
sierraId == "cardgames" || sierraId == "solitare" ||
- sierraId == "hoyle3" || sierraId == "hoyle4")
+ sierraId == "hoyle4")
demoThreshold = 40;
+ if (sierraId == "hoyle3")
+ demoThreshold = 45; // cnick-kq has 42 scripts. The actual hoyle 3 demo has 27.
if (sierraId == "fp" || sierraId == "gk" || sierraId == "pq4")
demoThreshold = 150;
@@ -310,8 +312,11 @@ Common::String convertSierraGameId(Common::String sierraId, uint32 *gameFlags, R
return "cnick-lsl";
if (sierraId == "sq4" && resources->size() == 34)
return "cnick-sq";
-
- // TODO: cnick-kq, cnick-laurabow and cnick-longbow (their resources can't be read)
+ if (sierraId == "hoyle3" && resources->size() == 42)
+ return "cnick-kq";
+ if (sierraId == "rh budget" && resources->size() == 39)
+ return "cnick-longbow";
+ // TODO: cnick-laurabow (the name of the game object contains junk)
// Handle Astrochicken 1 (SQ3) and 2 (SQ4)
if (sierraId == "sq3" && resources->size() == 20)
diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h
index a3dd305222..455223a086 100644
--- a/engines/sci/detection_tables.h
+++ b/engines/sci/detection_tables.h
@@ -91,7 +91,7 @@ static const struct ADGameDescription SciGameDescriptions[] = {
AD_LISTEND},
Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO, GUIO_NOSPEECH },
- // Castle of Dr. Brain - English DOS Floppy EGA (from omer_mor, bug report #3035349)
+ // Castle of Dr. Brain - English DOS 5.25" Floppy EGA (from omer_mor, bug report #3035349)
{"castlebrain", "EGA", {
{"resource.map", 0, "88d106f945f7fd9d1aeda961cfec38a9", 2646},
{"resource.000", 0, "6e125f4ce3f4f5c35f2617c7b66c6e21", 25325},
@@ -104,6 +104,16 @@ static const struct ADGameDescription SciGameDescriptions[] = {
AD_LISTEND},
Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+ // Castle of Dr. Brain - English DOS 3.5" Floppy EGA (from nozomi77, bug report #3405307)
+ {"castlebrain", "EGA", {
+ {"resource.map", 0, "dfcf23e36cb81223bdf11166aaf90754", 2730},
+ {"resource.000", 0, "27ec5fa09cd12a7fd16e86d96a2ed245", 300857},
+ {"resource.001", 0, "6e0020a9f9bef9a9d65943dc013f14b5", 222108},
+ {"resource.002", 0, "de2f182529efaad2c4b510b452ab77ac", 633662},
+ {"resource.003", 0, "38b4b37febc6b4f5061c461a283df148", 430388},
+ AD_LISTEND},
+ Common::EN_ANY, Common::kPlatformPC, 0, GUIO_NOSPEECH },
+
// Castle of Dr. Brain - English DOS Floppy (from jvprat)
// Executable scanning reports "1.000.044", Floppy label reports "1.0, 10.30.91", VERSION file reports "1.000"
// SCI interpreter version 1.000.510
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 8fb6322f55..a83a026762 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -488,8 +488,15 @@ bool Kernel::signatureMatch(const uint16 *sig, int argc, const reg_t *argv) {
if ((type & SIG_IS_INVALID) && (!(curSig & SIG_IS_INVALID)))
return false; // pointer is invalid and signature doesn't allow that?
- if (!((type & ~SIG_IS_INVALID) & curSig))
- return false; // type mismatch
+ if (!((type & ~SIG_IS_INVALID) & curSig)) {
+ if ((type & ~SIG_IS_INVALID) == SIG_TYPE_ERROR && (curSig & SIG_IS_INVALID)) {
+ // Type is unknown (error - usually because of a deallocated object or
+ // stale pointer) and the signature allows invalid pointers. In this case,
+ // ignore the invalid pointer.
+ } else {
+ return false; // type mismatch
+ }
+ }
if (!(curSig & SIG_MORE_MAY_FOLLOW)) {
sig++;
diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index ff3c67c84b..b605908dc1 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -476,6 +476,7 @@ reg_t kSetLanguage(EngineState *s, int argc, reg_t *argv);
reg_t kScrollWindow(EngineState *s, int argc, reg_t *argv);
reg_t kSetFontRes(EngineState *s, int argc, reg_t *argv);
reg_t kFont(EngineState *s, int argc, reg_t *argv);
+reg_t kBitmap(EngineState *s, int argc, reg_t *argv);
#endif
reg_t kDoSoundInit(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 0c5d4e680d..d3adcaccbf 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -546,6 +546,7 @@ static SciKernelMapEntry s_kernelMap[] = {
{ MAP_CALL(ScrollWindow), SIG_EVERYWHERE, "(.*)", NULL, NULL },
{ MAP_CALL(SetFontRes), SIG_EVERYWHERE, "ii", NULL, NULL },
{ MAP_CALL(Font), SIG_EVERYWHERE, "i(.*)", NULL, NULL },
+ { MAP_CALL(Bitmap), SIG_EVERYWHERE, "(.*)", NULL, NULL },
// SCI2.1 Empty Functions
@@ -564,6 +565,9 @@ static SciKernelMapEntry s_kernelMap[] = {
// just use GetConfig and mark this one as empty, like the DOS version does.
{ MAP_EMPTY(GetSierraProfileInt), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+ // Debug function called whenever the current room changes
+ { MAP_EMPTY(NewRoom), SIG_EVERYWHERE, "(.*)", NULL, NULL },
+
// Unused / debug SCI2.1 unused functions, always mapped to kDummy
// The debug functions are called from the inbuilt debugger or polygon
@@ -593,7 +597,6 @@ static SciKernelMapEntry s_kernelMap[] = {
// UpdateLine - used by LSL6
// SetPalStyleRange - 2 integer parameters, start and end. All styles from start-end
// (inclusive) are set to 0
- // NewRoom - 1 integer parameter, the current room number
// MorphOn - used by SQ6, script 900, the datacorder reprogramming puzzle (from room 270)
// SetHotRectangles - used by Phantasmagoria 1
#endif
@@ -602,7 +605,7 @@ static SciKernelMapEntry s_kernelMap[] = {
};
/** Default kernel name table. */
-static const char *s_defaultKernelNames[] = {
+static const char *const s_defaultKernelNames[] = {
/*0x00*/ "Load",
/*0x01*/ "UnLoad",
/*0x02*/ "ScriptID",
@@ -751,7 +754,7 @@ static const char *s_defaultKernelNames[] = {
// NOTE: 0x72-0x79, 0x85-0x86, 0x88 are from the GK2 demo (which has debug support) and are
// just Dummy in other SCI2 games.
-static const char *sci2_default_knames[] = {
+static const char *const sci2_default_knames[] = {
/*0x00*/ "Load",
/*0x01*/ "UnLoad",
/*0x02*/ "ScriptID",
@@ -916,7 +919,7 @@ static const char *sci2_default_knames[] = {
/*0x9f*/ "MessageBox"
};
-static const char *sci21_default_knames[] = {
+static const char *const sci21_default_knames[] = {
/*0x00*/ "Load",
/*0x01*/ "UnLoad",
/*0x02*/ "ScriptID",
@@ -1059,7 +1062,7 @@ static const char *sci21_default_knames[] = {
/*0x8b*/ "SetPalStyleRange",
/*0x8c*/ "AddPicAt",
/*0x8d*/ "MessageBox", // SCI3, was Dummy in SCI2.1
- /*0x8e*/ "NewRoom",
+ /*0x8e*/ "NewRoom", // debug function
/*0x8f*/ "Dummy",
/*0x90*/ "Priority",
/*0x91*/ "MorphOn",
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 1bd6754ca5..0c73125bdb 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -578,11 +578,15 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
game_description = dialog->getResultString();
if (game_description.empty()) {
// create our own description for the saved game, the user didnt enter it
+ #if defined(USE_SAVEGAME_TIMESTAMP)
TimeDate curTime;
g_system->getTimeAndDate(curTime);
curTime.tm_year += 1900; // fixup year
curTime.tm_mon++; // fixup month
- game_description = Common::String::format("%02d.%02d.%04d / %02d:%02d:%02d", curTime.tm_mday, curTime.tm_mon, curTime.tm_year, curTime.tm_hour, curTime.tm_min, curTime.tm_sec);
+ game_description = Common::String::format("%04d.%02d.%02d / %02d:%02d:%02d", curTime.tm_year, curTime.tm_mon, curTime.tm_mday, curTime.tm_hour, curTime.tm_min, curTime.tm_sec);
+ #else
+ game_description = Common::String::format("Save %d", savegameId + 1);
+ #endif
}
delete dialog;
g_sci->_soundCmd->pauseAll(false); // unpause music ( we can't have it paused during save)
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 36de767464..9f309aeab7 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -49,6 +49,7 @@
#include "sci/graphics/text16.h"
#include "sci/graphics/view.h"
#ifdef ENABLE_SCI32
+#include "sci/graphics/text32.h"
#include "sci/graphics/frameout.h"
#include "sci/video/robot_decoder.h"
#endif
@@ -1321,10 +1322,10 @@ reg_t kRepaintPlane(EngineState *s, int argc, reg_t *argv) {
reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv) {
reg_t planeObj = argv[0];
GuiResourceId pictureId = argv[1].toUint16();
- int16 forWidth = argv[2].toSint16();
- // argv[3] seems to be 0 most of the time
+ int16 pictureX = argv[2].toSint16();
+ int16 pictureY = argv[3].toSint16();
- g_sci->_gfxFrameout->kernelAddPicAt(planeObj, forWidth, pictureId);
+ g_sci->_gfxFrameout->kernelAddPicAt(planeObj, pictureId, pictureX, pictureY);
return s->r_acc;
}
@@ -1333,12 +1334,7 @@ reg_t kGetHighPlanePri(EngineState *s, int argc, reg_t *argv) {
}
reg_t kFrameOut(EngineState *s, int argc, reg_t *argv) {
- // This kernel call likely seems to be doing the screen updates,
- // as its called right after a view is updated
-
- // TODO
g_sci->_gfxFrameout->kernelFrameout();
-
return NULL_REG;
}
@@ -1380,15 +1376,19 @@ reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) {
}
reg_t kCreateTextBitmap(EngineState *s, int argc, reg_t *argv) {
- // TODO: argument 0 is usually 0, and arguments 1 and 2 are usually 1
switch (argv[0].toUint16()) {
case 0: {
if (argc != 4) {
warning("kCreateTextBitmap(0): expected 4 arguments, got %i", argc);
return NULL_REG;
}
- //reg_t object = argv[3];
- //Common::String text = s->_segMan->getString(readSelector(s->_segMan, object, SELECTOR(text)));
+ reg_t object = argv[3];
+ Common::String text = s->_segMan->getString(readSelector(s->_segMan, object, SELECTOR(text)));
+ debugC(kDebugLevelStrings, "kCreateTextBitmap case 0 (%04x:%04x, %04x:%04x, %04x:%04x)",
+ PRINT_REG(argv[1]), PRINT_REG(argv[2]), PRINT_REG(argv[3]));
+ debugC(kDebugLevelStrings, "%s", text.c_str());
+ // TODO: arguments 1 and 2
+ g_sci->_gfxText32->createTextBitmap(object);
break;
}
case 1: {
@@ -1396,8 +1396,11 @@ reg_t kCreateTextBitmap(EngineState *s, int argc, reg_t *argv) {
warning("kCreateTextBitmap(0): expected 2 arguments, got %i", argc);
return NULL_REG;
}
- //reg_t object = argv[1];
- //Common::String text = s->_segMan->getString(readSelector(s->_segMan, object, SELECTOR(text)));
+ reg_t object = argv[1];
+ Common::String text = s->_segMan->getString(readSelector(s->_segMan, object, SELECTOR(text)));
+ debugC(kDebugLevelStrings, "kCreateTextBitmap case 1 (%04x:%04x)", PRINT_REG(argv[1]));
+ debugC(kDebugLevelStrings, "%s", text.c_str());
+ g_sci->_gfxText32->createTextBitmap(object);
break;
}
default:
@@ -1667,6 +1670,95 @@ reg_t kFont(EngineState *s, int argc, reg_t *argv) {
return s->r_acc;
}
+reg_t kBitmap(EngineState *s, int argc, reg_t *argv) {
+ // Used for bitmap operations in SCI2.1 and SCI3.
+ // This is the SCI2.1 version, the functionality seems to have changed in SCI3.
+
+ switch (argv[0].toUint16()) {
+ case 0: // init bitmap surface
+ {
+ // 6 params, called e.g. from TextView::init() in Torin's Passage,
+ // script 64890 and TransView::init() in script 64884
+ uint16 width = argv[1].toUint16();
+ uint16 height = argv[2].toUint16();
+ uint16 skip = argv[3].toUint16();
+ uint16 back = argv[4].toUint16();
+ uint16 width2 = (argc >= 6) ? argv[5].toUint16() : 0;
+ uint16 height2 = (argc >= 7) ? argv[6].toUint16() : 0;
+ uint16 transparent = (argc >= 8) ? argv[7].toUint16() : 0;
+ warning("kBitmap(0): width %d, height %d, skip %d, back %d, width2 %d, height2 %d, transparent %d",
+ width, height, skip, back, width2, height2, transparent);
+ // returns a pointer to a bitmap
+ }
+ break;
+ case 1: // dispose bitmap surface
+ // 1 param, bitmap pointer, called e.g. from MenuItem::dispose
+ // in Torin's Passage, script 64893
+ warning("kBitmap(1), bitmap ptr %04x:%04x", PRINT_REG(argv[1]));
+ break;
+ case 2: // dispose bitmap surface, with extra param
+ // 2 params, called e.g. from MenuItem::dispose in Torin's Passage,
+ // script 64893
+ warning("kBitmap(2), unk1 %d, bitmap ptr %04x:%04x", argv[1].toUint16(), PRINT_REG(argv[2]));
+ break;
+ case 3: // tiled surface
+ {
+ // 6 params, called e.g. from TiledBitmap::resize() in Torin's Passage,
+ // script 64869
+ reg_t bitmapPtr = argv[1]; // obtained from kBitmap(0)
+ // The tiled view seems to always have 2 loops.
+ // These loops need to have 1 cel in loop 0 and 8 cels in loop 1.
+ uint16 view = argv[2].toUint16(); // vTiles selector
+ uint16 loop = argv[3].toUint16();
+ uint16 cel = argv[4].toUint16();
+ uint16 x = argv[5].toUint16();
+ uint16 y = argv[6].toUint16();
+ warning("kBitmap(3): bitmap ptr %04x:%04x, view %d, loop %d, cel %d, x %d, y %d",
+ PRINT_REG(bitmapPtr), view, loop, cel, x, y);
+ }
+ break;
+ case 4: // process text
+ {
+ // 13 params, called e.g. from TextButton::createBitmap() in Torin's Passage,
+ // script 64894
+ reg_t bitmapPtr = argv[1]; // obtained from kBitmap(0)
+ Common::String text = s->_segMan->getString(argv[2]);
+ // unk3
+ // unk4
+ // unk5
+ // unk6
+ // skip?
+ // back?
+ uint16 font = argv[9].toUint16();
+ uint16 mode = argv[10].toUint16();
+ // unk
+ uint16 dimmed = argv[12].toUint16();
+ warning("kBitmap(4): bitmap ptr %04x:%04x, font %d, mode %d, dimmed %d - text: \"%s\"",
+ PRINT_REG(bitmapPtr), font, mode, dimmed, text.c_str());
+ }
+ break;
+ case 5:
+ {
+ // 6 params, called e.g. from TextView::init() and TextView::draw()
+ // in Torin's Passage, script 64890
+ reg_t bitmapPtr = argv[1]; // obtained from kBitmap(0)
+ uint16 unk1 = argv[2].toUint16(); // unknown, usually 0, judging from scripts?
+ uint16 unk2 = argv[3].toUint16(); // unknown, usually 0, judging from scripts?
+ uint16 width = argv[4].toUint16(); // width - 1
+ uint16 height = argv[5].toUint16(); // height - 1
+ uint16 back = argv[6].toUint16();
+ warning("kBitmap(5): bitmap ptr %04x:%04x, unk1 %d, unk2 %d, width %d, height %d, back %d",
+ PRINT_REG(bitmapPtr), unk1, unk2, width, height, back);
+ }
+ break;
+ default:
+ kStub(s, argc, argv);
+ break;
+ }
+
+ return s->r_acc;
+}
+
#endif
} // End of namespace Sci
diff --git a/engines/sci/engine/kmath.cpp b/engines/sci/engine/kmath.cpp
index ef795d7e2f..7570856dff 100644
--- a/engines/sci/engine/kmath.cpp
+++ b/engines/sci/engine/kmath.cpp
@@ -37,6 +37,14 @@ reg_t kRandom(EngineState *s, int argc, reg_t *argv) {
// some codes in sq4 are also random and 5 digit (if i remember correctly)
const uint16 fromNumber = argv[0].toUint16();
const uint16 toNumber = argv[1].toUint16();
+ // Some scripts may request a range in the reverse order (from largest
+ // to smallest). An example can be found in Longbow, room 710, where a
+ // random number is requested from 119 to 83. In this case, we're
+ // supposed to return toNumber (determined by the KQ5CD disasm).
+ // Fixes bug #3413020.
+ if (fromNumber > toNumber)
+ return make_reg(0, toNumber);
+
uint16 range = toNumber - fromNumber + 1;
// calculating range is exactly how sierra sci did it and is required for hoyle 4
// where we get called with kRandom(0, -1) and we are supposed to give back values from 0 to 0
diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp
index e6837242e4..a32480c168 100644
--- a/engines/sci/engine/kmisc.cpp
+++ b/engines/sci/engine/kmisc.cpp
@@ -54,8 +54,33 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
uint32 neededSleep = 30;
- // WORKAROUNDS:
+ // WORKAROUNDS for scripts that are polling too quickly in scenes that
+ // are not animating much
switch (g_sci->getGameId()) {
+ case GID_CASTLEBRAIN:
+ // In Castle of Dr. Brain, memory color matching puzzle in the first
+ // room (room 100), the game scripts constantly poll the state of each
+ // stone when the user clicks on one. Since the scene is not animating
+ // much, this results in activating and deactivating each stone very
+ // quickly (together with its associated tone sound), depending on how
+ // low it is in the animate list. This worked somewhat in older PCs, but
+ // not in modern computers. We throttle the scene in order to allow the
+ // stones to display, otherwise the game scripts reset them too soon.
+ // Fixes bug #3127824.
+ if (s->currentRoomNumber() == 100) {
+ s->_throttleTrigger = true;
+ neededSleep = 60;
+ }
+ break;
+ case GID_ICEMAN:
+ // In ICEMAN the submarine control room is not animating much, so it
+ // runs way too fast. We calm it down even more, otherwise fighting
+ // against other submarines is almost impossible.
+ if (s->currentRoomNumber() == 27) {
+ s->_throttleTrigger = true;
+ neededSleep = 60;
+ }
+ break;
case GID_LSL3:
// LSL3 calculates a machinespeed variable during game startup
// (right after the filthy questions). This one would go through w/o
@@ -65,21 +90,12 @@ reg_t kGameIsRestarting(EngineState *s, int argc, reg_t *argv) {
if (s->currentRoomNumber() == 290)
s->_throttleTrigger = true;
break;
- case GID_ICEMAN:
- // In ICEMAN the submarine control room is not animating much, so it runs way too fast
- // we calm it down even more otherwise especially fighting against other submarines
- // is almost impossible
- if (s->currentRoomNumber() == 27) {
- s->_throttleTrigger = true;
- neededSleep = 60;
- }
- break;
case GID_SQ4:
// In SQ4 (floppy and CD) the sequel police appear way too quickly in
// the Skate-o-rama rooms, resulting in all sorts of timer issues, like
// #3109139 (which occurs because a police officer instantly teleports
// just before Roger exits and shoots him). We throttle these scenes a
- // bit more, in order to prevent timer bugs related to the sequel police
+ // bit more, in order to prevent timer bugs related to the sequel police.
if (s->currentRoomNumber() == 405 || s->currentRoomNumber() == 406 ||
s->currentRoomNumber() == 410 || s->currentRoomNumber() == 411) {
s->_throttleTrigger = true;
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 783845bb76..1a9359bb26 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -201,8 +201,8 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
char xfer;
int i;
int startarg;
- int str_leng = 0; /* Used for stuff like "%13s" */
- int unsigned_var = 0;
+ int strLength = 0; /* Used for stuff like "%13s" */
+ bool unsignedVar = false;
if (position.segment)
startarg = 2;
@@ -236,7 +236,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
mode = 0;
} else {
mode = 1;
- str_leng = 0;
+ strLength = 0;
}
} else if (mode == 1) { /* xfer != '%' */
char fillchar = ' ';
@@ -256,22 +256,22 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
else if (isdigit(static_cast<unsigned char>(xfer)) || (xfer == '-'))
source--; // Go to start of length argument
- str_leng = strtol(source, &destp, 10);
+ strLength = strtol(source, &destp, 10);
if (destp > source)
source = destp;
- if (str_leng < 0) {
+ if (strLength < 0) {
align = ALIGN_LEFT;
- str_leng = -str_leng;
+ strLength = -strLength;
} else if (align != ALIGN_CENTER)
align = ALIGN_RIGHT;
xfer = *source++;
} else
- str_leng = 0;
+ strLength = 0;
- assert((target - targetbuf) + str_leng + 1 <= maxsize);
+ assert((target - targetbuf) + strLength + 1 <= maxsize);
switch (xfer) {
case 's': { /* Copy string */
@@ -286,7 +286,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
Common::String tempsource = g_sci->getKernel()->lookupText(reg,
arguments[paramindex + 1]);
int slen = strlen(tempsource.c_str());
- int extralen = str_leng - slen;
+ int extralen = strLength - slen;
assert((target - targetbuf) + extralen <= maxsize);
if (extralen < 0)
extralen = 0;
@@ -342,7 +342,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
case 'c': { /* insert character */
assert((target - targetbuf) + 2 <= maxsize);
if (align >= 0)
- while (str_leng-- > 1)
+ while (strLength-- > 1)
*target++ = ' '; /* Format into the text */
char argchar = arguments[paramindex++];
if (argchar)
@@ -353,8 +353,14 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
case 'x':
case 'u':
- unsigned_var = 1;
+ unsignedVar = true;
case 'd': { /* Copy decimal */
+ // In the new SCI2 kString function, %d is used for unsigned
+ // integers. An example is script 962 in Shivers - it uses %d
+ // to create file names.
+ if (getSciVersion() >= SCI_VERSION_2)
+ unsignedVar = true;
+
/* int templen; -- unused atm */
const char *format_string = "%d";
@@ -362,14 +368,14 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
format_string = "%x";
int val = arguments[paramindex];
- if (!unsigned_var)
+ if (!unsignedVar)
val = (int16)arguments[paramindex];
target += sprintf(target, format_string, val);
paramindex++;
assert((target - targetbuf) <= maxsize);
- unsigned_var = 0;
+ unsignedVar = false;
mode = 0;
}
@@ -384,7 +390,7 @@ reg_t kFormat(EngineState *s, int argc, reg_t *argv) {
if (align) {
int written = target - writestart;
- int padding = str_leng - written;
+ int padding = strLength - written;
if (padding > 0) {
if (align > 0) {
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index e43c7097ed..c30518ab42 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -626,12 +626,8 @@ void SoundCommandParser::reconstructPlayList() {
const MusicList::iterator end = _music->getPlayListEnd();
for (MusicList::iterator i = _music->getPlayListStart(); i != end; ++i) {
- if ((*i)->resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, (*i)->resourceId))) {
- (*i)->soundRes = new SoundResource((*i)->resourceId, _resMan, _soundVersion);
- _music->soundInitSnd(*i);
- } else {
- (*i)->soundRes = 0;
- }
+ initSoundResource(*i);
+
if ((*i)->status == kSoundPlaying) {
// Sync the sound object's selectors related to playing with the stored
// ones in the playlist, as they may have been invalidated when loading.
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 3a18fbc68f..ad3f4fb788 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -31,6 +31,8 @@
namespace Sci {
+//#define VM_DEBUG_SEND
+
// This table is only used for debugging. Don't include it for devices
// with not enough available memory (e.g. phones), where REDUCE_MEMORY_USAGE
// is defined
@@ -618,12 +620,13 @@ void debugSelectorCall(reg_t send_obj, Selector selector, int argc, StackPtr arg
#ifdef VM_DEBUG_SEND
debugN("Send to %04x:%04x (%s), selector %04x (%s):", PRINT_REG(send_obj),
- s->_segMan->getObjectName(send_obj), selector,
+ segMan->getObjectName(send_obj), selector,
g_sci->getKernel()->getSelectorName(selector).c_str());
#endif // VM_DEBUG_SEND
switch (selectorType) {
case kSelectorNone:
+ debugN("\n");
break;
case kSelectorVariable:
#ifdef VM_DEBUG_SEND
diff --git a/engines/sci/engine/static_selectors.cpp b/engines/sci/engine/static_selectors.cpp
index cca4c47be8..8f3337743d 100644
--- a/engines/sci/engine/static_selectors.cpp
+++ b/engines/sci/engine/static_selectors.cpp
@@ -102,18 +102,28 @@ static const char * const sci2Selectors[] = {
#endif
static const SelectorRemap sciSelectorRemap[] = {
- { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "moveDone", 170 },
- { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "points", 316 },
- { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "flags", 368 },
- { SCI_VERSION_1_EARLY, SCI_VERSION_1_LATE, "nodePtr", 44 },
- { SCI_VERSION_1_LATE, SCI_VERSION_1_LATE, "cantBeHere", 57 },
- { SCI_VERSION_1_EARLY, SCI_VERSION_1_LATE, "topString", 101 },
- { SCI_VERSION_1_EARLY, SCI_VERSION_1_LATE, "flags", 102 },
+ { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "moveDone", 170 },
+ { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "points", 316 },
+ { SCI_VERSION_0_EARLY, SCI_VERSION_0_LATE, "flags", 368 },
+ { SCI_VERSION_1_EARLY, SCI_VERSION_1_LATE, "nodePtr", 44 },
+ { SCI_VERSION_1_LATE, SCI_VERSION_1_LATE, "cantBeHere", 57 },
+ { SCI_VERSION_1_EARLY, SCI_VERSION_1_LATE, "topString", 101 },
+ { SCI_VERSION_1_EARLY, SCI_VERSION_1_LATE, "flags", 102 },
// SCI1.1
- { SCI_VERSION_1_1, SCI_VERSION_1_1, "nodePtr", 41 },
- { SCI_VERSION_1_1, SCI_VERSION_1_1, "cantBeHere", 54 },
- { SCI_VERSION_1_1, SCI_VERSION_2_1, "-info-",4103 },
- { SCI_VERSION_NONE, SCI_VERSION_NONE, 0, 0 }
+ { SCI_VERSION_1_1, SCI_VERSION_1_1, "nodePtr", 41 },
+ { SCI_VERSION_1_1, SCI_VERSION_1_1, "cantBeHere", 54 },
+ // The following are not really needed. They've only been defined to
+ // ease game debugging.
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-objID-", 4096 },
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-size-", 4097 },
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-propDict-", 4098 },
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-methDict-", 4099 },
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-classScript-", 4100 },
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-script-", 4101 },
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-super-", 4102 },
+ //
+ { SCI_VERSION_1_1, SCI_VERSION_2_1, "-info-", 4103 },
+ { SCI_VERSION_NONE, SCI_VERSION_NONE, 0, 0 }
};
struct ClassReference {
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 274b0bbbc9..7c22b48ece 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -41,7 +41,6 @@ namespace Sci {
const reg_t NULL_REG = {0, 0};
const reg_t SIGNAL_REG = {0, SIGNAL_OFFSET};
const reg_t TRUE_REG = {0, 1};
-//#define VM_DEBUG_SEND
// Enable the define below to have the VM abort on cases where a conditional
// statement is followed by an unconditional jump (which will most likely lead
// to an infinite loop). Aids in detecting script bugs such as #3040722.
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 968afcb11c..ac8d5fa262 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -209,15 +209,9 @@ const SciWorkaroundEntry kDeviceInfo_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, call,index, workaround
const SciWorkaroundEntry kDisplay_workarounds[] = {
{ GID_ISLANDBRAIN, 300, 300, 0, "geneDude", "show", -1, 0, { WORKAROUND_IGNORE, 0 } }, // when looking at the gene explanation chart - a parameter is an object
- { GID_PQ1, 500, 500, 0, "endInter", "changeState", 0x3e8, 0, { WORKAROUND_IGNORE, 0 } }, // restoring a game at the map scene (bug #3389579)
- { GID_PQ1, 500, 500, 0, "endInter", "changeState", 0x46b, 0, { WORKAROUND_IGNORE, 0 } }, // restoring a game at the map scene (bug #3389579)
{ GID_PQ2, 23, 23, 0, "rm23Script", "elements", 0x4ae, 0, { WORKAROUND_IGNORE, 0 } }, // when looking at the 2nd page of pate's file - 0x75 as id
{ GID_PQ2, 23, 23, 0, "rm23Script", "elements", 0x4c1, 0, { WORKAROUND_IGNORE, 0 } }, // when looking at the 2nd page of pate's file - 0x75 as id (another pq2 version, bug #3043904)
{ GID_QFG1, 11, 11, 0, "battle", "<noname90>", -1, 0, { WORKAROUND_IGNORE, 0 } }, // DEMO: When entering battle, 0x75 as id
- { GID_QFG3, -1, 47, 0, "barterWin", "open", 0x1426, 0, { WORKAROUND_IGNORE, 0 } }, // sometimes when talking with a vendor that can be bartered with, the wrong local variable is checked and the variable contents are wrong - bug #3292251
- { GID_QFG3, -1, 47, 0, "barterIcon", "show", 0x135c, 0, { WORKAROUND_IGNORE, 0 } }, // sometimes when talking with a vendor that can be bartered with, the wrong local variable is checked and the variable contents are wrong - bug #3292251
- { GID_SQ1, -1, 700, 0, "arcadaRegion", "doit", -1, 0, { WORKAROUND_IGNORE, 0 } }, // restoring in some rooms of the arcada (right at the start)
- { GID_SQ1, 44, 44, 0, "spinDone", "changeState",0x13b0, 0, { WORKAROUND_IGNORE, 0 } }, // restoring a game at the slot machine in Ulence Flats (bug #3308087)
{ GID_SQ4, 397, 0, 0, "", "export 12", -1, 0, { WORKAROUND_IGNORE, 0 } }, // FLOPPY: when going into the computer store (bug #3044044)
{ GID_SQ4, 391, 391, 0, "doCatalog", "mode", 0x84, 0, { WORKAROUND_IGNORE, 0 } }, // CD: clicking on catalog in roboter sale - a parameter is an object
{ GID_SQ4, 391, 391, 0, "choosePlug", "changeState", -1, 0, { WORKAROUND_IGNORE, 0 } }, // CD: ordering connector in roboter sale - a parameter is an object
@@ -285,10 +279,7 @@ const SciWorkaroundEntry kGraphSaveBox_workarounds[] = {
// gameID, room,script,lvl, object-name, method-name, call,index, workaround
const SciWorkaroundEntry kGraphRestoreBox_workarounds[] = {
- { GID_LSL6, -1, 86, 0, "LL6Inv", "show", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // happens when restoring, is called with hunk segment, but hunk is not allocated at that time
- // ^^ TODO: check, if this is really a script error or an issue with our restore code
{ GID_LSL6, -1, 86, 0, "LL6Inv", "hide", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // happens during the game, gets called with 1 extra parameter
- { GID_SQ5, 850, 850, 0, NULL, "changeState", -1, 0, { WORKAROUND_STILLCALL, 0 } }, // happens while playing Battle Cruiser (invalid segment) - bug #3056811
SCI_WORKAROUNDENTRY_TERMINATOR
};
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index ec49a38814..57c65aa6e0 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -227,8 +227,10 @@ void GfxCursor::kernelSetView(GuiResourceId viewNum, int loopNum, int celNum, Co
// Game, newPosition, validRect
static const SciCursorSetPositionWorkarounds setPositionWorkarounds[] = {
{ GID_ISLANDBRAIN, 84, 109, 46, 76, 174, 243 }, // island of dr. brain / game menu
+ { GID_ISLANDBRAIN,143, 135, 57, 102, 163, 218 },// island of dr. brain / pause menu within copy protection
{ GID_LSL5, 23, 171, 0, 0, 26, 320 }, // larry 5 / skip forward helper
{ GID_QFG1VGA, 64, 174, 40, 37, 74, 284 }, // Quest For Glory 1 VGA / run/walk/sleep sub-menu
+ { GID_QFG3, 70, 170, 40, 61, 81, 258 }, // Quest For Glory 3 / run/walk/sleep sub-menu
{ (SciGameId)0, -1, -1, -1, -1, -1, -1 }
};
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 11948d5d38..6bd310f1a0 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -43,6 +43,7 @@
#include "sci/graphics/paint32.h"
#include "sci/graphics/palette.h"
#include "sci/graphics/picture.h"
+#include "sci/graphics/text32.h"
#include "sci/graphics/frameout.h"
#include "sci/video/robot_decoder.h"
@@ -197,12 +198,13 @@ void GfxFrameout::kernelDeletePlane(reg_t object) {
}
}
-void GfxFrameout::addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX) {
+void GfxFrameout::addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX, uint16 startY) {
PlanePictureEntry newPicture;
newPicture.object = object;
newPicture.pictureId = pictureId;
newPicture.picture = new GfxPicture(_resMan, _coordAdjuster, 0, _screen, _palette, pictureId, false);
newPicture.startX = startX;
+ newPicture.startY = startY;
newPicture.pictureCels = 0;
_planePictures.push_back(newPicture);
}
@@ -274,9 +276,8 @@ int16 GfxFrameout::kernelGetHighPlanePri() {
return readSelectorValue(g_sci->getEngineState()->_segMan, _planes.back().object, SELECTOR(priority));
}
-// TODO: No idea yet how to implement this
-void GfxFrameout::kernelAddPicAt(reg_t planeObj, int16 forWidth, GuiResourceId pictureId) {
- addPlanePicture(planeObj, pictureId, forWidth);
+void GfxFrameout::kernelAddPicAt(reg_t planeObj, GuiResourceId pictureId, int16 pictureX, int16 pictureY) {
+ addPlanePicture(planeObj, pictureId, pictureX, pictureY);
}
bool sortHelper(const FrameoutEntry* entry1, const FrameoutEntry* entry2) {
@@ -316,44 +317,6 @@ void GfxFrameout::sortPlanes() {
Common::sort(_planes.begin(), _planes.end(), planeSortHelper);
}
-static int16 GetLongest(const char *text, int16 maxWidth, GfxFont *font) {
- uint16 curChar = 0;
- int16 maxChars = 0, curCharCount = 0;
- uint16 width = 0;
-
- while (width <= maxWidth) {
- curChar = (*(const byte *)text++);
-
- switch (curChar) {
- // We need to add 0xD, 0xA and 0xD 0xA to curCharCount and then exit
- // which means, we split text like
- // 'Mature, experienced software analyst available.' 0xD 0xA
- // 'Bug installation a proven speciality. "No version too clean."' (normal game text, this is from lsl2)
- // and 0xA '-------' 0xA (which is the official sierra subtitle separator)
- // Sierra did it the same way.
- case 0xD:
- // Check, if 0xA is following, if so include it as well
- if ((*(const unsigned char *)text) == 0xA)
- curCharCount++;
- // it's meant to pass through here
- case 0xA:
- curCharCount++;
- // and it's also meant to pass through here
- case 0:
- return curCharCount;
- case ' ':
- maxChars = curCharCount; // return count up to (but not including) breaking space
- break;
- }
- if (width + font->getCharWidth(curChar) > maxWidth)
- break;
- width += font->getCharWidth(curChar);
- curCharCount++;
- }
-
- return maxChars;
-}
-
void GfxFrameout::kernelFrameout() {
if (g_sci->_robotDecoder->isVideoLoaded()) {
bool skipVideo = false;
@@ -440,6 +403,7 @@ void GfxFrameout::kernelFrameout() {
picEntry->y = planePicture->getSci32celY(pictureCelNr);
picEntry->x = planePicture->getSci32celX(pictureCelNr);
picEntry->picStartX = pictureIt->startX;
+ picEntry->picStartY = pictureIt->startY;
picEntry->priority = planePicture->getSci32celPriority(pictureCelNr);
@@ -462,8 +426,9 @@ void GfxFrameout::kernelFrameout() {
itemEntry->y = ((itemEntry->y * _screen->getHeight()) / scriptsRunningHeight);
itemEntry->x = ((itemEntry->x * _screen->getWidth()) / scriptsRunningWidth);
itemEntry->picStartX = ((itemEntry->picStartX * _screen->getWidth()) / scriptsRunningWidth);
+ itemEntry->picStartY = ((itemEntry->picStartY * _screen->getHeight()) / scriptsRunningHeight);
- // Out of view
+ // Out of view horizontally (sanity checks)
int16 pictureCelStartX = itemEntry->picStartX + itemEntry->x;
int16 pictureCelEndX = pictureCelStartX + itemEntry->picture->getSci32celWidth(itemEntry->celNo);
int16 planeStartX = it->planeOffsetX;
@@ -473,6 +438,9 @@ void GfxFrameout::kernelFrameout() {
if (pictureCelStartX > planeEndX)
continue;
+ // Out of view vertically (sanity checks)
+ // TODO
+
int16 pictureOffsetX = it->planeOffsetX;
int16 pictureX = itemEntry->x;
if ((it->planeOffsetX) || (itemEntry->picStartX)) {
@@ -484,6 +452,7 @@ void GfxFrameout::kernelFrameout() {
}
}
+ // TODO: pictureOffsetY
itemEntry->picture->drawSci32Vga(itemEntry->celNo, pictureX, itemEntry->y, pictureOffsetX, it->planePictureMirrored);
// warning("picture cel %d %d", itemEntry->celNo, itemEntry->priority);
@@ -578,62 +547,25 @@ void GfxFrameout::kernelFrameout() {
}
} else {
// Most likely a text entry
- // This draws text the "SCI0-SCI11" way. In SCI2, text is prerendered in kCreateTextBitmap
- // TODO: rewrite this the "SCI2" way (i.e. implement the text buffer to draw inside kCreateTextBitmap)
if (lookupSelector(_segMan, itemEntry->object, SELECTOR(text), NULL, NULL) == kSelectorVariable) {
- reg_t stringObject = readSelector(_segMan, itemEntry->object, SELECTOR(text));
-
- // The object in the text selector of the item can be either a raw string
- // or a Str object. In the latter case, we need to access the object's data
- // selector to get the raw string.
- if (_segMan->isHeapObject(stringObject))
- stringObject = readSelector(_segMan, stringObject, SELECTOR(data));
-
- Common::String text = _segMan->getString(stringObject);
- GfxFont *font = _cache->getFont(readSelectorValue(_segMan, itemEntry->object, SELECTOR(font)));
- bool dimmed = readSelectorValue(_segMan, itemEntry->object, SELECTOR(dimmed));
- uint16 foreColor = readSelectorValue(_segMan, itemEntry->object, SELECTOR(fore));
-
- itemEntry->y = ((itemEntry->y * _screen->getHeight()) / scriptsRunningHeight);
- itemEntry->x = ((itemEntry->x * _screen->getWidth()) / scriptsRunningWidth);
-
- uint16 startX = itemEntry->x + it->planeRect.left;
- uint16 curY = itemEntry->y + it->planeRect.top;
- const char *txt = text.c_str();
+ TextEntry *textEntry = g_sci->_gfxText32->getTextEntry(itemEntry->object);
+ uint16 startX = ((textEntry->x * _screen->getWidth()) / scriptsRunningWidth) + it->planeRect.left;
+ uint16 startY = ((textEntry->y * _screen->getHeight()) / scriptsRunningHeight) + it->planeRect.top;
// HACK. The plane sometimes doesn't contain the correct width. This
// hack breaks the dialog options when speaking with Grace, but it's
// the best we got up to now. This happens because of the unimplemented
// kTextWidth function in SCI32.
// TODO: Remove this once kTextWidth has been implemented.
uint16 w = it->planeRect.width() >= 20 ? it->planeRect.width() : _screen->getWidth() - 10;
- int16 charCount;
// Upscale the coordinates/width if the fonts are already upscaled
if (_screen->fontIsUpscaled()) {
startX = startX * _screen->getDisplayWidth() / _screen->getWidth();
- curY = curY * _screen->getDisplayHeight() / _screen->getHeight();
+ startY = startY * _screen->getDisplayHeight() / _screen->getHeight();
w = w * _screen->getDisplayWidth() / _screen->getWidth();
}
- while (*txt) {
- charCount = GetLongest(txt, w, font);
- if (charCount == 0)
- break;
-
- uint16 curX = startX;
-
- for (int i = 0; i < charCount; i++) {
- unsigned char curChar = txt[i];
- font->draw(curChar, curY, curX, foreColor, dimmed);
- curX += font->getCharWidth(curChar);
- }
-
- curY += font->getHeight();
- txt += charCount;
- while (*txt == ' ')
- txt++; // skip over breaking spaces
- }
-
+ g_sci->_gfxText32->drawTextBitmap(itemEntry->object, startX, startY, w);
}
}
}
diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index 7e5b1a5006..d2c8086f5f 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -58,6 +58,7 @@ struct FrameoutEntry {
Common::Rect celRect;
GfxPicture *picture;
int16 picStartX;
+ int16 picStartY;
};
typedef Common::List<FrameoutEntry *> FrameoutList;
@@ -65,6 +66,7 @@ typedef Common::List<FrameoutEntry *> FrameoutList;
struct PlanePictureEntry {
reg_t object;
int16 startX;
+ int16 startY;
GuiResourceId pictureId;
GfxPicture *picture;
FrameoutEntry *pictureCels; // temporary
@@ -93,10 +95,10 @@ public:
void kernelUpdateScreenItem(reg_t object);
void kernelDeleteScreenItem(reg_t object);
int16 kernelGetHighPlanePri();
- void kernelAddPicAt(reg_t planeObj, int16 forWidth, GuiResourceId pictureId);
+ void kernelAddPicAt(reg_t planeObj, GuiResourceId pictureId, int16 pictureX, int16 pictureY);
void kernelFrameout();
- void addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX);
+ void addPlanePicture(reg_t object, GuiResourceId pictureId, uint16 startX, uint16 startY = 0);
void deletePlanePictures(reg_t object);
void clear();
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 38919593b4..5f703b90e3 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -114,7 +114,7 @@ bool GfxPalette::isMerging() {
void GfxPalette::setDefault() {
if (_resMan->getViewType() == kViewEga)
setEGA();
- else if (_resMan->getViewType() == kViewAmiga)
+ else if (_resMan->getViewType() == kViewAmiga || _resMan->getViewType() == kViewAmiga64)
setAmiga();
else
kernelSetFromResource(999, true);
@@ -206,6 +206,14 @@ bool GfxPalette::setAmiga() {
_sysPalette.colors[curColor].r = (byte1 & 0x0F) * 0x11;
_sysPalette.colors[curColor].g = ((byte2 & 0xF0) >> 4) * 0x11;
_sysPalette.colors[curColor].b = (byte2 & 0x0F) * 0x11;
+
+ if (_totalScreenColors == 64) {
+ // Set the associated color from the Amiga halfbrite colors
+ _sysPalette.colors[curColor + 32].used = 1;
+ _sysPalette.colors[curColor + 32].r = _sysPalette.colors[curColor].r >> 1;
+ _sysPalette.colors[curColor + 32].g = _sysPalette.colors[curColor].g >> 1;
+ _sysPalette.colors[curColor + 32].b = _sysPalette.colors[curColor].b >> 1;
+ }
}
// Directly set the palette, because setOnScreen() wont do a thing for amiga
@@ -226,6 +234,13 @@ void GfxPalette::modifyAmigaPalette(byte *data) {
_sysPalette.colors[curColor].r = (byte1 & 0x0F) * 0x11;
_sysPalette.colors[curColor].g = ((byte2 & 0xF0) >> 4) * 0x11;
_sysPalette.colors[curColor].b = (byte2 & 0x0F) * 0x11;
+
+ if (_totalScreenColors == 64) {
+ // Set the associated color from the Amiga halfbrite colors
+ _sysPalette.colors[curColor + 32].r = _sysPalette.colors[curColor].r >> 1;
+ _sysPalette.colors[curColor + 32].g = _sysPalette.colors[curColor].g >> 1;
+ _sysPalette.colors[curColor + 32].b = _sysPalette.colors[curColor].b >> 1;
+ }
}
copySysPaletteToScreen();
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index ecb54e89e8..dad2b77036 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -740,7 +740,7 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) {
// Left-Over VGA palette, we simply ignore it
curPos += 256 + 4 + 1024;
} else {
- // Setting half of the amiga palette
+ // Setting half of the Amiga palette
_palette->modifyAmigaPalette(&data[curPos]);
curPos += 32;
}
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
new file mode 100644
index 0000000000..21372f1502
--- /dev/null
+++ b/engines/sci/graphics/text32.cpp
@@ -0,0 +1,238 @@
+/* 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.
+ *
+ * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/engines/sci/graphics/text16.cpp $
+ * $Id: text16.cpp 55178 2011-01-08 23:16:44Z thebluegr $
+ *
+ */
+
+#include "common/util.h"
+#include "common/stack.h"
+#include "graphics/primitives.h"
+
+#include "sci/sci.h"
+#include "sci/engine/kernel.h"
+#include "sci/engine/selector.h"
+#include "sci/engine/state.h"
+#include "sci/graphics/cache.h"
+#include "sci/graphics/font.h"
+#include "sci/graphics/screen.h"
+#include "sci/graphics/text32.h"
+
+namespace Sci {
+
+GfxText32::GfxText32(SegManager *segMan, GfxCache *fonts, GfxScreen *screen)
+ : _segMan(segMan), _cache(fonts), _screen(screen) {
+}
+
+GfxText32::~GfxText32() {
+ purgeCache();
+}
+
+void GfxText32::purgeCache() {
+ for (TextCache::iterator cacheIterator = _textCache.begin(); cacheIterator != _textCache.end(); cacheIterator++) {
+ delete[] cacheIterator->_value->surface;
+ delete cacheIterator->_value;
+ cacheIterator->_value = 0;
+ }
+
+ _textCache.clear();
+}
+
+void GfxText32::createTextBitmap(reg_t textObject) {
+ if (_textCache.size() >= MAX_CACHED_TEXTS)
+ purgeCache();
+
+ uint32 textId = (textObject.segment << 16) | textObject.offset;
+
+ if (_textCache.contains(textId)) {
+ // Delete the old entry
+ TextEntry *oldEntry = _textCache[textId];
+ delete[] oldEntry->surface;
+ delete oldEntry;
+ _textCache.erase(textId);
+ }
+
+ _textCache[textId] = createTextEntry(textObject);
+}
+
+// TODO: Finish this!
+void GfxText32::drawTextBitmap(reg_t textObject, uint16 textX, uint16 textY, uint16 w) {
+ uint32 textId = (textObject.segment << 16) | textObject.offset;
+
+ if (!_textCache.contains(textId))
+ createTextBitmap(textObject);
+
+ TextEntry *entry = _textCache[textId];
+
+ // This draws text the "SCI0-SCI11" way. In SCI2, text is prerendered in kCreateTextBitmap
+ // TODO: rewrite this the "SCI2" way (i.e. implement the text buffer to draw inside kCreateTextBitmap)
+ GfxFont *font = _cache->getFont(readSelectorValue(_segMan, textObject, SELECTOR(font)));
+ bool dimmed = readSelectorValue(_segMan,textObject, SELECTOR(dimmed));
+ uint16 foreColor = readSelectorValue(_segMan, textObject, SELECTOR(fore));
+
+ const char *txt = entry->text.c_str();
+ int16 charCount;
+
+ while (*txt) {
+ charCount = GetLongest(txt, w, font);
+ if (charCount == 0)
+ break;
+
+ uint16 curX = textX;
+
+ for (int i = 0; i < charCount; i++) {
+ unsigned char curChar = txt[i];
+ font->draw(curChar, textY, curX, foreColor, dimmed);
+ curX += font->getCharWidth(curChar);
+ }
+
+ textY += font->getHeight();
+ txt += charCount;
+ while (*txt == ' ')
+ txt++; // skip over breaking spaces
+ }
+
+ // TODO: The "SCI2" way of font drawing. Currently buggy
+ /*
+ for (int x = textX; x < entry->width; x++) {
+ for (int y = textY; y < entry->height; y++) {
+ byte pixel = entry->surface[y * entry->width + x];
+ if (pixel)
+ _screen->putPixel(x, y, 1, pixel, 0, 0);
+ }
+ }
+ */
+}
+
+TextEntry *GfxText32::getTextEntry(reg_t textObject) {
+ uint32 textId = (textObject.segment << 16) | textObject.offset;
+
+ if (!_textCache.contains(textId))
+ createTextBitmap(textObject);
+
+ return _textCache[textId];
+}
+
+// TODO: Finish this! Currently buggy.
+TextEntry *GfxText32::createTextEntry(reg_t textObject) {
+ reg_t stringObject = readSelector(_segMan, textObject, SELECTOR(text));
+
+ // The object in the text selector of the item can be either a raw string
+ // or a Str object. In the latter case, we need to access the object's data
+ // selector to get the raw string.
+ if (_segMan->isHeapObject(stringObject))
+ stringObject = readSelector(_segMan, stringObject, SELECTOR(data));
+
+ const char *text = _segMan->getString(stringObject).c_str();
+ GfxFont *font = _cache->getFont(readSelectorValue(_segMan, textObject, SELECTOR(font)));
+ bool dimmed = readSelectorValue(_segMan, textObject, SELECTOR(dimmed));
+ uint16 foreColor = readSelectorValue(_segMan, textObject, SELECTOR(fore));
+ uint16 x = readSelectorValue(_segMan, textObject, SELECTOR(x));
+ uint16 y = readSelectorValue(_segMan, textObject, SELECTOR(y));
+
+ // Now get the bounding box from the associated plane
+ reg_t planeObject = readSelector(_segMan, textObject, SELECTOR(plane));
+ Common::Rect planeRect;
+ if (!planeObject.isNull()) {
+ planeRect.top = readSelectorValue(_segMan, planeObject, SELECTOR(top));
+ planeRect.left = readSelectorValue(_segMan, planeObject, SELECTOR(left));
+ planeRect.bottom = readSelectorValue(_segMan, planeObject, SELECTOR(bottom)) + 1;
+ planeRect.right = readSelectorValue(_segMan, planeObject, SELECTOR(right)) + 1;
+ } else {
+ planeRect.top = 0;
+ planeRect.left = 0;
+ planeRect.bottom = _screen->getHeight();
+ planeRect.right = _screen->getWidth();
+ }
+
+ TextEntry *newEntry = new TextEntry();
+ newEntry->object = stringObject;
+ newEntry->x = x;
+ newEntry->y = y;
+ newEntry->width = planeRect.width();
+ newEntry->height = planeRect.height();
+ newEntry->surface = new byte[newEntry->width * newEntry->height];
+ memset(newEntry->surface, 0, newEntry->width * newEntry->height);
+ newEntry->text = _segMan->getString(stringObject);
+
+ int16 maxTextWidth, charCount;
+ uint16 curX = 0, curY = 0;
+
+ maxTextWidth = 0;
+ while (*text) {
+ charCount = GetLongest(text, planeRect.width(), font);
+ if (charCount == 0)
+ break;
+
+ for (int i = 0; i < charCount; i++) {
+ unsigned char curChar = text[i];
+ font->drawToBuffer(curChar, curY, curX, foreColor, dimmed, newEntry->surface, newEntry->width, newEntry->height);
+ curX += font->getCharWidth(curChar);
+ }
+
+ curY += font->getHeight();
+ text += charCount;
+ while (*text == ' ')
+ text++; // skip over breaking spaces
+ }
+
+ return newEntry;
+}
+
+int16 GfxText32::GetLongest(const char *text, int16 maxWidth, GfxFont *font) {
+ uint16 curChar = 0;
+ int16 maxChars = 0, curCharCount = 0;
+ uint16 width = 0;
+
+ while (width <= maxWidth) {
+ curChar = (*(const byte *)text++);
+
+ switch (curChar) {
+ // We need to add 0xD, 0xA and 0xD 0xA to curCharCount and then exit
+ // which means, we split text like
+ // 'Mature, experienced software analyst available.' 0xD 0xA
+ // 'Bug installation a proven speciality. "No version too clean."' (normal game text, this is from lsl2)
+ // and 0xA '-------' 0xA (which is the official sierra subtitle separator)
+ // Sierra did it the same way.
+ case 0xD:
+ // Check, if 0xA is following, if so include it as well
+ if ((*(const unsigned char *)text) == 0xA)
+ curCharCount++;
+ // it's meant to pass through here
+ case 0xA:
+ curCharCount++;
+ // and it's also meant to pass through here
+ case 0:
+ return curCharCount;
+ case ' ':
+ maxChars = curCharCount; // return count up to (but not including) breaking space
+ break;
+ }
+ if (width + font->getCharWidth(curChar) > maxWidth)
+ break;
+ width += font->getCharWidth(curChar);
+ curCharCount++;
+ }
+
+ return maxChars;
+}
+
+} // End of namespace Sci
diff --git a/engines/sci/graphics/text32.h b/engines/sci/graphics/text32.h
new file mode 100644
index 0000000000..39fe710a86
--- /dev/null
+++ b/engines/sci/graphics/text32.h
@@ -0,0 +1,71 @@
+/* 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.
+ *
+ * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/engines/sci/graphics/text16.h $
+ * $Id: text16.h 55178 2011-01-08 23:16:44Z thebluegr $
+ *
+ */
+
+#ifndef SCI_GRAPHICS_TEXT32_H
+#define SCI_GRAPHICS_TEXT32_H
+
+#include "common/hashmap.h"
+
+namespace Sci {
+
+struct TextEntry {
+ reg_t object;
+ uint16 x;
+ uint16 y;
+ uint16 width;
+ uint16 height;
+ byte *surface;
+ Common::String text;
+};
+
+// TODO: Move to Cache, perhaps?
+#define MAX_CACHED_TEXTS 20
+typedef Common::HashMap<uint32, TextEntry *> TextCache;
+
+/**
+ * Text32 class, handles text calculation and displaying of text for SCI2, SCI21 and SCI3 games
+ */
+class GfxText32 {
+public:
+ GfxText32(SegManager *segMan, GfxCache *fonts, GfxScreen *screen);
+ ~GfxText32();
+ void createTextBitmap(reg_t textObject);
+ void drawTextBitmap(reg_t textObject, uint16 textX, uint16 textY, uint16 w);
+ int16 GetLongest(const char *text, int16 maxWidth, GfxFont *font);
+ TextEntry *getTextEntry(reg_t textObject);
+
+private:
+ TextEntry *createTextEntry(reg_t textObject);
+ void purgeCache();
+
+ SegManager *_segMan;
+ GfxCache *_cache;
+ TextCache _textCache;
+ GfxScreen *_screen;
+};
+
+} // End of namespace Sci
+
+#endif
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 6ca4903e17..a0d5b51a2b 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -471,7 +471,8 @@ void unpackCelData(byte *inBuffer, byte *celBitmap, byte clearColor, int pixelCo
curByte = *rlePtr++;
if (curByte & 0xC0) { // fill with color
runLength = curByte >> 6;
- memset(outPtr + pixelNr, curByte & 0x3F, MIN<uint16>(runLength, pixelCount - pixelNr));
+ curByte = curByte & 0x3F;
+ memset(outPtr + pixelNr, curByte, MIN<uint16>(runLength, pixelCount - pixelNr));
} else { // skip the next pixels (transparency)
runLength = curByte & 0x3F;
}
diff --git a/engines/sci/module.mk b/engines/sci/module.mk
index 2202002e2e..c129ae5439 100644
--- a/engines/sci/module.mk
+++ b/engines/sci/module.mk
@@ -80,6 +80,7 @@ ifdef ENABLE_SCI32
MODULE_OBJS += \
graphics/frameout.o \
graphics/paint32.o \
+ graphics/text32.o \
video/robot_decoder.o
endif
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 1b8b7b2f0e..bdd7d6692b 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -93,7 +93,7 @@ const char *getSciVersionDesc(SciVersion version) {
//#define SCI_VERBOSE_RESMAN 1
-static const char *sci_error_types[] = {
+static const char *const sci_error_types[] = {
"No error",
"I/O error",
"Resource is empty (size 0)",
@@ -107,7 +107,7 @@ static const char *sci_error_types[] = {
"SCI version is unsupported"
};
-static const char *s_resourceTypeNames[] = {
+static const char *const s_resourceTypeNames[] = {
"view", "pic", "script", "text", "sound",
"memory", "vocab", "font", "cursor",
"patch", "bitmap", "palette", "cdaudio",
@@ -120,7 +120,7 @@ static const char *s_resourceTypeNames[] = {
// Resource type suffixes. Note that the
// suffic of SCI3 scripts has been changed from
// scr to csc
-static const char *s_resourceTypeSuffixes[] = {
+static const char *const s_resourceTypeSuffixes[] = {
"v56", "p56", "scr", "tex", "snd",
"", "voc", "fon", "cur", "pat",
"bit", "pal", "cda", "aud", "syn",
@@ -1158,8 +1158,10 @@ ResVersion ResourceManager::detectMapVersion() {
}
}
- if (!fileStream)
- error("Failed to open resource map file");
+ if (!fileStream) {
+ warning("Failed to open resource map file");
+ return kResVersionUnknown;
+ }
// detection
// SCI0 and SCI01 maps have last 6 bytes set to FF
@@ -1259,7 +1261,7 @@ ResVersion ResourceManager::detectVolVersion() {
}
if (!fileStream) {
- error("Failed to open volume file - if you got resource.p01/resource.p02/etc. files, merge them together into resource.000");
+ warning("Failed to open volume file - if you got resource.p01/resource.p02/etc. files, merge them together into resource.000");
// resource.p01/resource.p02/etc. may be there when directly copying the files from the original floppies
// the sierra installer would merge those together (perhaps we could do this as well?)
// possible TODO
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 792b2b2055..6c1b6e4dd6 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -61,6 +61,7 @@
#include "sci/graphics/transitions.h"
#ifdef ENABLE_SCI32
+#include "sci/graphics/text32.h"
#include "sci/graphics/frameout.h"
#include "sci/video/robot_decoder.h"
#endif
@@ -146,6 +147,7 @@ SciEngine::~SciEngine() {
DebugMan.clearAllDebugChannels();
#ifdef ENABLE_SCI32
+ delete _gfxText32;
delete _robotDecoder;
delete _gfxFrameout;
#endif
@@ -598,6 +600,7 @@ void SciEngine::initGraphics() {
_gfxText16 = 0;
_gfxTransitions = 0;
#ifdef ENABLE_SCI32
+ _gfxText32 = 0;
_robotDecoder = 0;
_gfxFrameout = 0;
_gfxPaint32 = 0;
@@ -627,6 +630,7 @@ void SciEngine::initGraphics() {
_gfxCompare = new GfxCompare(_gamestate->_segMan, _kernel, _gfxCache, _gfxScreen, _gfxCoordAdjuster);
_gfxPaint32 = new GfxPaint32(_resMan, _gamestate->_segMan, _kernel, _gfxCoordAdjuster, _gfxCache, _gfxScreen, _gfxPalette);
_gfxPaint = _gfxPaint32;
+ _gfxText32 = new GfxText32(_gamestate->_segMan, _gfxCache, _gfxScreen);
_robotDecoder = new RobotDecoder(g_system->getMixer(), getPlatform() == Common::kPlatformMacintosh);
_gfxFrameout = new GfxFrameout(_gamestate->_segMan, _resMan, _gfxCoordAdjuster, _gfxCache, _gfxScreen, _gfxPalette, _gfxPaint32);
} else {
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index b419d862a4..81bbdc51de 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -71,6 +71,7 @@ class GfxPalette;
class GfxPorts;
class GfxScreen;
class GfxText16;
+class GfxText32;
class GfxTransitions;
#ifdef ENABLE_SCI32
@@ -313,6 +314,7 @@ public:
GfxPorts *_gfxPorts; // Port managment for 16-bit gfx
GfxScreen *_gfxScreen;
GfxText16 *_gfxText16;
+ GfxText32 *_gfxText32;
GfxTransitions *_gfxTransitions; // transitions between screens for 16-bit gfx
GfxMacIconBar *_gfxMacIconBar; // Mac Icon Bar manager
diff --git a/engines/sci/sound/drivers/gm_names.h b/engines/sci/sound/drivers/gm_names.h
index bfe5ff88c7..fbfa413a4a 100644
--- a/engines/sci/sound/drivers/gm_names.h
+++ b/engines/sci/sound/drivers/gm_names.h
@@ -30,7 +30,7 @@ namespace Sci {
// is defined
#ifndef REDUCE_MEMORY_USAGE
-static const char *GmInstrumentNames[] = {
+static const char *const GmInstrumentNames[] = {
/*000*/ "Acoustic Grand Piano",
/*001*/ "Bright Acoustic Piano",
/*002*/ "Electric Grand Piano",
@@ -162,7 +162,7 @@ static const char *GmInstrumentNames[] = {
};
// The GM Percussion map is downwards compatible to the MT32 map, which is used in SCI
-static const char *GmPercussionNames[] = {
+static const char *const GmPercussionNames[] = {
/*00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/*10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/*20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp
index f48a68dc66..ad7ba7ca36 100644
--- a/engines/sci/sound/midiparser_sci.cpp
+++ b/engines/sci/sound/midiparser_sci.cpp
@@ -480,11 +480,18 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) {
info.basic.param2 = 0;
if (info.channel() == 0xF) {// SCI special case
if (info.basic.param1 != kSetSignalLoop) {
- // at least in kq5/french&mac the first scene in the intro has a song that sets signal to 4 immediately
- // on tick 0. Signal isn't set at that point by sierra sci and it would cause the castle daventry text to
- // get immediately removed, so we currently filter it.
- // Sierra SCI ignores them as well at that time
- if ((_position._play_tick) || (info.delta)) {
+ // At least in kq5/french&mac the first scene in the intro has
+ // a song that sets signal to 4 immediately on tick 0. Signal
+ // isn't set at that point by sierra sci and it would cause the
+ // castle daventry text to get immediately removed, so we
+ // currently filter it. Sierra SCI ignores them as well at that
+ // time. However, this filtering should only be performed for
+ // SCI1 and newer games. Signalling is done differently in SCI0
+ // though, so ignoring these signals in SCI0 games will result
+ // in glitches (e.g. the intro of LB1 Amiga gets stuck - bug
+ // #3297883). Refer to MusicEntry::setSignal() in sound/music.cpp.
+ if (_soundVersion <= SCI_VERSION_0_LATE ||
+ _position._play_tick || info.delta) {
_signalSet = true;
_signalToSet = info.basic.param1;
}
diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index 2afab3858d..9610b6f847 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -63,12 +63,13 @@ void SciMusic::init() {
// SCI sound init
_dwTempo = 0;
- // Default to MIDI in SCI2.1+ games, as many don't have AdLib support.
Common::Platform platform = g_sci->getPlatform();
-
uint32 deviceFlags = MDT_PCSPK | MDT_PCJR | MDT_ADLIB | MDT_MIDI;
- if (getSciVersion() >= SCI_VERSION_2_1)
+ // Default to MIDI in SCI2.1+ games, as many don't have AdLib support.
+ // Also, default to MIDI for Windows versions of SCI1.1 games, as their
+ // soundtrack is written for GM.
+ if (getSciVersion() >= SCI_VERSION_2_1 || g_sci->_features->useAltWinGMSound())
deviceFlags |= MDT_PREFER_GM;
// Currently our CMS implementation only supports SCI1(.1)
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index d4cff7614c..a91b103214 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -37,6 +37,7 @@ SoundCommandParser::SoundCommandParser(ResourceManager *resMan, SegManager *segM
_music = new SciMusic(_soundVersion);
_music->init();
+ _bMultiMidi = ConfMan.getBool("multi_midi");
}
SoundCommandParser::~SoundCommandParser() {
@@ -63,6 +64,35 @@ int SoundCommandParser::getSoundResourceId(reg_t obj) {
return resourceId;
}
+void SoundCommandParser::initSoundResource(MusicEntry *newSound) {
+ if (newSound->resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, newSound->resourceId)))
+ newSound->soundRes = new SoundResource(newSound->resourceId, _resMan, _soundVersion);
+ else
+ newSound->soundRes = 0;
+
+ // In SCI1.1 games, sound effects are started from here. If we can find
+ // a relevant audio resource, play it, otherwise switch to synthesized
+ // effects. If the resource exists, play it using map 65535 (sound
+ // effects map)
+ bool checkAudioResource = getSciVersion() >= SCI_VERSION_1_1;
+ if (g_sci->getGameId() == GID_HOYLE4)
+ checkAudioResource = false; // hoyle 4 has garbled audio resources in place of the sound resources
+ // if we play those, we will only make the user deaf and break speakers. Sierra SCI doesn't play anything
+ // on soundblaster. FIXME: check, why this is
+
+ if (checkAudioResource && _resMan->testResource(ResourceId(kResourceTypeAudio, newSound->resourceId))) {
+ // Found a relevant audio resource, create an audio stream
+ if (_bMultiMidi || !newSound->soundRes) {
+ int sampleLen;
+ newSound->pStreamAud = _audio->getAudioStream(newSound->resourceId, 65535, &sampleLen);
+ newSound->soundType = Audio::Mixer::kSpeechSoundType;
+ }
+ }
+
+ if (!newSound->pStreamAud && newSound->soundRes)
+ _music->soundInitSnd(newSound);
+}
+
void SoundCommandParser::processInitSound(reg_t obj) {
int resourceId = getSoundResourceId(obj);
@@ -73,11 +103,6 @@ void SoundCommandParser::processInitSound(reg_t obj) {
MusicEntry *newSound = new MusicEntry();
newSound->resourceId = resourceId;
- if (resourceId && _resMan->testResource(ResourceId(kResourceTypeSound, resourceId)))
- newSound->soundRes = new SoundResource(resourceId, _resMan, _soundVersion);
- else
- newSound->soundRes = 0;
-
newSound->soundObj = obj;
newSound->loop = readSelectorValue(_segMan, obj, SELECTOR(loop));
newSound->priority = readSelectorValue(_segMan, obj, SELECTOR(pri)) & 0xFF;
@@ -88,25 +113,7 @@ void SoundCommandParser::processInitSound(reg_t obj) {
debugC(kDebugLevelSound, "kDoSound(init): %04x:%04x number %d, loop %d, prio %d, vol %d", PRINT_REG(obj),
resourceId, newSound->loop, newSound->priority, newSound->volume);
- // In SCI1.1 games, sound effects are started from here. If we can find
- // a relevant audio resource, play it, otherwise switch to synthesized
- // effects. If the resource exists, play it using map 65535 (sound
- // effects map)
- bool checkAudioResource = getSciVersion() >= SCI_VERSION_1_1;
- if (g_sci->getGameId() == GID_HOYLE4)
- checkAudioResource = false; // hoyle 4 has garbled audio resources in place of the sound resources
- // if we play those, we will only make the user deaf and break speakers. Sierra SCI doesn't play anything
- // on soundblaster. FIXME: check, why this is
-
- if (checkAudioResource && _resMan->testResource(ResourceId(kResourceTypeAudio, resourceId))) {
- // Found a relevant audio resource, play it
- int sampleLen;
- newSound->pStreamAud = _audio->getAudioStream(resourceId, 65535, &sampleLen);
- newSound->soundType = Audio::Mixer::kSpeechSoundType;
- } else {
- if (newSound->soundRes)
- _music->soundInitSnd(newSound);
- }
+ initSoundResource(newSound);
_music->pushBackSlot(newSound);
@@ -130,8 +137,14 @@ reg_t SoundCommandParser::kDoSoundPlay(int argc, reg_t *argv, reg_t acc) {
void SoundCommandParser::processPlaySound(reg_t obj) {
MusicEntry *musicSlot = _music->getSlot(obj);
if (!musicSlot) {
- warning("kDoSound(play): Slot not found (%04x:%04x)", PRINT_REG(obj));
- return;
+ warning("kDoSound(play): Slot not found (%04x:%04x), initializing it manually", PRINT_REG(obj));
+ // The sound hasn't been initialized for some reason, so initialize it here.
+ // Happens in KQ6, room 460, when giving the creature to the bookwork (the
+ // bookworm's child). Fixes bug #3413301.
+ processInitSound(obj);
+ musicSlot = _music->getSlot(obj);
+ if (!musicSlot)
+ error("Failed to initialize uninitialized sound slot");
}
int resourceId = getSoundResourceId(obj);
@@ -157,6 +170,9 @@ void SoundCommandParser::processPlaySound(reg_t obj) {
musicSlot->loop = readSelectorValue(_segMan, obj, SELECTOR(loop));
musicSlot->priority = readSelectorValue(_segMan, obj, SELECTOR(priority));
+ // Reset hold when starting a new song. kDoSoundSetHold is always called after
+ // kDoSoundPlay to set it properly, if needed. Fixes bug #3413589.
+ musicSlot->hold = -1;
if (_soundVersion >= SCI_VERSION_1_EARLY)
musicSlot->volume = readSelectorValue(_segMan, obj, SELECTOR(vol));
diff --git a/engines/sci/sound/soundcmd.h b/engines/sci/sound/soundcmd.h
index 7f6e2a0fe8..c1dce014d2 100644
--- a/engines/sci/sound/soundcmd.h
+++ b/engines/sci/sound/soundcmd.h
@@ -32,6 +32,7 @@ namespace Sci {
class Console;
class SciMusic;
class SoundCommandParser;
+class MusicEntry;
//typedef void (SoundCommandParser::*SoundCommand)(reg_t obj, int16 value);
//struct MusicEntryCommand {
@@ -64,6 +65,7 @@ public:
void processPlaySound(reg_t obj);
void processStopSound(reg_t obj, bool sampleFinishedPlaying);
+ void initSoundResource(MusicEntry *newSound);
MusicType getMusicType() const;
@@ -109,6 +111,7 @@ private:
SciMusic *_music;
AudioPlayer *_audio;
SciVersion _soundVersion;
+ bool _bMultiMidi;
void processInitSound(reg_t obj);
void processDisposeSound(reg_t obj);
diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp
index 20b929dfd4..eb23c30ebe 100644
--- a/engines/scumm/actor.cpp
+++ b/engines/scumm/actor.cpp
@@ -2287,7 +2287,7 @@ void Actor::setActorCostume(int c) {
}
}
-static const char* v0ActorNames_English[25] = {
+static const char *const v0ActorNames_English[25] = {
"Syd",
"Razor",
"Dave",
@@ -2313,7 +2313,7 @@ static const char* v0ActorNames_English[25] = {
"Sandy"
};
-static const char* v0ActorNames_German[25] = {
+static const char *const v0ActorNames_German[25] = {
"Syd",
"Razor",
"Dave",
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index 8558da397e..4064853b6b 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -511,14 +511,15 @@ void CharsetRendererV3::enableShadow(bool enable) {
_shadowMode = enable;
}
-void CharsetRendererV3::drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height, uint8 bitDepth) {
- int y, x;
+void CharsetRendererV3::drawBits1(Graphics::Surface &dest, int x, int y, const byte *src, int drawTop, int width, int height) {
+ byte *dst = (byte *)dest.getBasePtr(x, y);
+
byte bits = 0;
uint8 col = _color;
- int pitch = s.pitch - width * bitDepth;
- byte *dst2 = dst + s.pitch;
+ int pitch = dest.pitch - width * dest.format.bytesPerPixel;
+ byte *dst2 = dst + dest.pitch;
- for (y = 0; y < height && y + drawTop < s.h; y++) {
+ for (y = 0; y < height && y + drawTop < dest.h; y++) {
for (x = 0; x < width; x++) {
if ((x % 8) == 0)
bits = *src++;
@@ -527,8 +528,8 @@ void CharsetRendererV3::drawBits1(const Graphics::Surface &s, byte *dst, const b
dst[1] = dst2[0] = dst2[1] = _shadowColor;
dst[0] = col;
}
- dst += bitDepth;
- dst2 += bitDepth;
+ dst += dest.format.bytesPerPixel;
+ dst2 += dest.format.bytesPerPixel;
}
dst += pitch;
@@ -591,7 +592,6 @@ void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) {
int width, height, origWidth = 0, origHeight;
VirtScreen *vs;
const byte *charPtr;
- byte *dst;
int is2byte = (chr >= 256 && _vm->_useCJKMode) ? 1 : 0;
assertRange(0, _curId, _vm->_numCharsets - 1, "charset");
@@ -636,13 +636,14 @@ void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) {
_textScreenID = vs->number;
}
- if ((ignoreCharsetMask || !vs->hasTwoBuffers)) {
- dst = vs->getPixels(_left, drawTop);
- drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight, vs->format.bytesPerPixel);
- } else {
- dst = (byte *)_vm->_textSurface.getBasePtr(_left * _vm->_textSurfaceMultiplier, _top * _vm->_textSurfaceMultiplier);
- drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight, _vm->_textSurface.format.bytesPerPixel);
- }
+ if ((ignoreCharsetMask || !vs->hasTwoBuffers)
+#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
+ && (_vm->_game.platform != Common::kPlatformFMTowns)
+#endif
+ )
+ drawBits1(*vs, _left + vs->xstart, drawTop, charPtr, drawTop, origWidth, origHeight);
+ else
+ drawBits1(_vm->_textSurface, _left * _vm->_textSurfaceMultiplier, _top * _vm->_textSurfaceMultiplier, charPtr, drawTop, origWidth, origHeight);
if (is2byte) {
origWidth /= _vm->_textSurfaceMultiplier;
@@ -669,9 +670,7 @@ void CharsetRendererV3::drawChar(int chr, Graphics::Surface &s, int x, int y) {
int width = getDrawWidthIntern(chr);
int height = getDrawHeightIntern(chr);
setDrawCharIntern(chr);
-
- byte *dst = (byte *)s.pixels + y * s.pitch + x;
- drawBits1(s, dst, charPtr, y, width, height, s.format.bytesPerPixel);
+ drawBits1(s, x, y, charPtr, y, width, height);
}
void CharsetRenderer::translateColor() {
@@ -767,6 +766,13 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) {
_textScreenID = vs->number;
}
+ // We need to know the virtual screen we draw on for Indy 4 Amiga, since
+ // it selects the palette map according to this. We furthermore can not
+ // use _textScreenID here, since that will cause inventory graphics
+ // glitches.
+ if (_vm->_game.platform == Common::kPlatformAmiga && _vm->_game.id == GID_INDY4)
+ _drawScreen = vs->number;
+
printCharIntern(is2byte, _charPtr, _origWidth, _origHeight, _width, _height, vs, ignoreCharsetMask);
_left += _origWidth;
@@ -917,12 +923,27 @@ void CharsetRendererClassic::drawBitsN(const Graphics::Surface &s, byte *dst, co
numbits = 8;
byte *cmap = _vm->_charsetColorMap;
+ // Indy4 Amiga always uses the room or verb palette map to match colors to
+ // the currently setup palette, thus we need to select it over here too.
+ // Done like the original interpreter.
+ byte *amigaMap = 0;
+ if (_vm->_game.platform == Common::kPlatformAmiga && _vm->_game.id == GID_INDY4) {
+ if (_drawScreen == kVerbVirtScreen)
+ amigaMap = _vm->_verbPalette;
+ else
+ amigaMap = _vm->_roomPalette;
+ }
+
for (y = 0; y < height && y + drawTop < s.h; y++) {
for (x = 0; x < width; x++) {
color = (bits >> (8 - bpp)) & 0xFF;
- if (color && y + drawTop >= 0)
- *dst = cmap[color];
+ if (color && y + drawTop >= 0) {
+ if (amigaMap)
+ *dst = amigaMap[cmap[color]];
+ else
+ *dst = cmap[color];
+ }
dst++;
bits <<= bpp;
numbits -= bpp;
@@ -971,50 +992,43 @@ void CharsetRendererTownsV3::enableShadow(bool enable) {
#endif
}
-void CharsetRendererTownsV3::drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height, uint8 bitDepth) {
+void CharsetRendererTownsV3::drawBits1(Graphics::Surface &dest, int x, int y, const byte *src, int drawTop, int width, int height) {
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
#ifdef USE_RGB_COLOR
if (_sjisCurChar) {
assert(_vm->_cjkFont);
- _vm->_cjkFont->drawChar(_vm->_textSurface, _sjisCurChar, _left * _vm->_textSurfaceMultiplier, _top * _vm->_textSurfaceMultiplier, _color, _shadowColor);
+ _vm->_cjkFont->drawChar(dest, _sjisCurChar, x, y, _color, _shadowColor);
return;
}
#endif
-
- dst = (byte *)_vm->_textSurface.getBasePtr(_left * _vm->_textSurfaceMultiplier, _top * _vm->_textSurfaceMultiplier);
- int sfPitch = _vm->_textSurface.pitch;
- int sfHeight = _vm->_textSurface.h;
- bool scale2x = (_vm->_textSurfaceMultiplier == 2 && !(_sjisCurChar >= 256 && _vm->_useCJKMode));
-#else
- int sfPitch = s.pitch;
- int sfHeight = s.h;
+ bool scale2x = ((&dest == &_vm->_textSurface) && (_vm->_textSurfaceMultiplier == 2) && !(_sjisCurChar >= 256 && _vm->_useCJKMode));
#endif
- int y, x;
byte bits = 0;
uint8 col = _color;
- int pitch = sfPitch - width * bitDepth;
- byte *dst2 = dst + sfPitch;
+ int pitch = dest.pitch - width * dest.format.bytesPerPixel;
+ byte *dst = (byte *)dest.getBasePtr(x, y);
+ byte *dst2 = dst + dest.pitch;
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
byte *dst3 = dst2;
byte *dst4 = dst2;
if (scale2x) {
- dst3 = dst2 + sfPitch;
- dst4 = dst3 + sfPitch;
+ dst3 = dst2 + dest.pitch;
+ dst4 = dst3 + dest.pitch;
pitch <<= 1;
}
#endif
- for (y = 0; y < height && y + drawTop < sfHeight; y++) {
+ for (y = 0; y < height && y + drawTop < dest.h; y++) {
for (x = 0; x < width; x++) {
if ((x % 8) == 0)
bits = *src++;
if ((bits & revBitMask(x % 8)) && y + drawTop >= 0) {
- if (bitDepth == 2) {
+ if (dest.format.bytesPerPixel == 2) {
if (_shadowMode) {
WRITE_UINT16(dst + 2, _vm->_16BitPalette[_shadowColor]);
- WRITE_UINT16(dst + sfPitch, _vm->_16BitPalette[_shadowColor]);
+ WRITE_UINT16(dst + dest.pitch, _vm->_16BitPalette[_shadowColor]);
}
WRITE_UINT16(dst, _vm->_16BitPalette[_color]);
} else {
@@ -1037,8 +1051,8 @@ void CharsetRendererTownsV3::drawBits1(const Graphics::Surface &s, byte *dst, co
#endif
}
}
- dst += bitDepth;
- dst2 += bitDepth;
+ dst += dest.format.bytesPerPixel;
+ dst2 += dest.format.bytesPerPixel;
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
if (scale2x) {
dst++;
@@ -1084,45 +1098,45 @@ void CharsetRendererTownsV3::setDrawCharIntern(uint16 chr) {
#endif
#ifdef USE_RGB_COLOR
-void CharsetRendererPCE::drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height, uint8 bitDepth) {
+void CharsetRendererPCE::drawBits1(Graphics::Surface &dest, int x, int y, const byte *src, int drawTop, int width, int height) {
+ byte *dst = (byte *)dest.getBasePtr(x, y);
if (_sjisCurChar) {
assert(_vm->_cjkFont);
uint16 col1 = _color;
uint16 col2 = _shadowColor;
- if (s.format.bytesPerPixel == 2) {
+ if (dest.format.bytesPerPixel == 2) {
col1 = _vm->_16BitPalette[col1];
col2 = _vm->_16BitPalette[col2];
}
- _vm->_cjkFont->drawChar(dst, _sjisCurChar, s.pitch, s.format.bytesPerPixel, col1, col2, -1, -1);
+ _vm->_cjkFont->drawChar(dst, _sjisCurChar, dest.pitch, dest.format.bytesPerPixel, col1, col2, -1, -1);
return;
}
- int y, x;
byte bits = 0;
- for (y = 0; y < height && y + drawTop < s.h; y++) {
+ for (y = 0; y < height && y + drawTop < dest.h; y++) {
int bitCount = 0;
for (x = 0; x < width; x++) {
if ((bitCount % 8) == 0)
bits = *src++;
if ((bits & revBitMask(bitCount % 8)) && y + drawTop >= 0) {
- if (bitDepth == 2) {
+ if (dest.format.bytesPerPixel == 2) {
if (_shadowMode)
- WRITE_UINT16(dst + s.pitch + 2, _vm->_16BitPalette[_shadowColor]);
+ WRITE_UINT16(dst + dest.pitch + 2, _vm->_16BitPalette[_shadowColor]);
WRITE_UINT16(dst, _vm->_16BitPalette[_color]);
} else {
if (_shadowMode)
- *(dst + s.pitch + 1) = _shadowColor;
+ *(dst + dest.pitch + 1) = _shadowColor;
*dst = _color;
}
}
- dst += bitDepth;
+ dst += dest.format.bytesPerPixel;
bitCount++;
}
- dst += s.pitch - width * bitDepth;
+ dst += dest.pitch - width * dest.format.bytesPerPixel;
}
}
@@ -1260,7 +1274,7 @@ void CharsetRendererNut::printChar(int chr, bool ignoreCharsetMask) {
void CharsetRendererNES::printChar(int chr, bool ignoreCharsetMask) {
int width, height, origWidth, origHeight;
VirtScreen *vs;
- byte *charPtr, *dst;
+ byte *charPtr;
// Init it here each time since it is cheap and fixes bug with
// charset after game load
@@ -1300,13 +1314,10 @@ void CharsetRendererNES::printChar(int chr, bool ignoreCharsetMask) {
_textScreenID = vs->number;
}
- if (ignoreCharsetMask || !vs->hasTwoBuffers) {
- dst = vs->getPixels(_left, drawTop);
- drawBits1(*vs, dst, charPtr, drawTop, origWidth, origHeight, vs->format.bytesPerPixel);
- } else {
- dst = (byte *)_vm->_textSurface.pixels + _top * _vm->_textSurface.pitch + _left;
- drawBits1(_vm->_textSurface, dst, charPtr, drawTop, origWidth, origHeight, _vm->_textSurface.format.bytesPerPixel);
- }
+ if (ignoreCharsetMask || !vs->hasTwoBuffers)
+ drawBits1(*vs, _left + vs->xstart, drawTop, charPtr, drawTop, origWidth, origHeight);
+ else
+ drawBits1(_vm->_textSurface, _left, _top, charPtr, drawTop, origWidth, origHeight);
if (_str.left > _left)
_str.left = _left;
@@ -1324,7 +1335,7 @@ void CharsetRendererNES::printChar(int chr, bool ignoreCharsetMask) {
}
void CharsetRendererNES::drawChar(int chr, Graphics::Surface &s, int x, int y) {
- byte *charPtr, *dst;
+ byte *charPtr;
int width, height;
if (!_trTable)
@@ -1334,8 +1345,7 @@ void CharsetRendererNES::drawChar(int chr, Graphics::Surface &s, int x, int y) {
width = getCharWidth(chr);
height = 8;
- dst = (byte *)s.pixels + y * s.pitch + x;
- drawBits1(s, dst, charPtr, y, width, height, s.format.bytesPerPixel);
+ drawBits1(s, x, y, charPtr, y, width, height);
}
#ifdef USE_RGB_COLOR
@@ -1535,14 +1545,15 @@ void CharsetRendererTownsClassic::processCharsetColors() {
#endif
#endif
-void CharsetRendererNES::drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height, uint8 bitDepth) {
+void CharsetRendererNES::drawBits1(Graphics::Surface &dest, int x, int y, const byte *src, int drawTop, int width, int height) {
+ byte *dst = (byte *)dest.getBasePtr(x, y);
for (int i = 0; i < 8; i++) {
byte c0 = src[i];
byte c1 = src[i + 8];
for (int j = 0; j < 8; j++)
dst[j] = _vm->_NESPalette[0][((c0 >> (7 - j)) & 1) | (((c1 >> (7 - j)) & 1) << 1) |
(_color ? 12 : 8)];
- dst += s.pitch;
+ dst += dest.pitch;
}
}
diff --git a/engines/scumm/charset.h b/engines/scumm/charset.h
index b23ec996f5..b8f1d84045 100644
--- a/engines/scumm/charset.h
+++ b/engines/scumm/charset.h
@@ -119,6 +119,9 @@ protected:
int _offsX, _offsY;
const byte *_charPtr;
+ // On which virtual screen will be drawn right now
+ VirtScreenNumber _drawScreen;
+
public:
CharsetRendererClassic(ScummEngine *vm) : CharsetRendererCommon(vm) {}
@@ -153,7 +156,7 @@ class CharsetRendererNES : public CharsetRendererCommon {
protected:
byte *_trTable;
- void drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height, uint8 bitDepth);
+ void drawBits1(Graphics::Surface &dest, int x, int y, const byte *src, int drawTop, int width, int height);
public:
CharsetRendererNES(ScummEngine *vm) : CharsetRendererCommon(vm) {}
@@ -169,7 +172,7 @@ public:
class CharsetRendererV3 : public CharsetRendererCommon {
protected:
virtual void enableShadow(bool enable);
- virtual void drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height, uint8 bitDepth);
+ virtual void drawBits1(Graphics::Surface &dest, int x, int y, const byte *src, int drawTop, int width, int height);
virtual int getDrawWidthIntern(uint16 chr);
virtual int getDrawHeightIntern(uint16 chr);
virtual void setDrawCharIntern(uint16 chr) {}
@@ -195,7 +198,7 @@ public:
private:
void enableShadow(bool enable);
- void drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height, uint8 bitDepth);
+ void drawBits1(Graphics::Surface &dest, int x, int y, const byte *src, int drawTop, int width, int height);
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
int getDrawWidthIntern(uint16 chr);
int getDrawHeightIntern(uint16 chr);
@@ -207,7 +210,7 @@ private:
#ifdef USE_RGB_COLOR
class CharsetRendererPCE : public CharsetRendererV3 {
private:
- void drawBits1(const Graphics::Surface &s, byte *dst, const byte *src, int drawTop, int width, int height, uint8 bitDepth);
+ void drawBits1(Graphics::Surface &dest, int x, int y, const byte *src, int drawTop, int width, int height);
int getDrawWidthIntern(uint16 chr);
int getDrawHeightIntern(uint16 chr);
diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp
index 4ca4988605..eb3cc3262c 100644
--- a/engines/scumm/costume.cpp
+++ b/engines/scumm/costume.cpp
@@ -545,6 +545,13 @@ void ClassicCostumeRenderer::proc3_ami(Codec1 &v1) {
oldXpos = v1.x;
oldScaleIndexX = _scaleIndexX;
+ // Indy4 Amiga always uses the room map to match colors to the currently
+ // setup palette in the actor code in the original, thus we need to do this
+ // mapping over here too.
+ byte *amigaMap = 0;
+ if (_vm->_game.platform == Common::kPlatformAmiga && _vm->_game.id == GID_INDY4)
+ amigaMap = _vm->_roomPalette;
+
do {
len = *src++;
color = len >> v1.shr;
@@ -556,7 +563,10 @@ void ClassicCostumeRenderer::proc3_ami(Codec1 &v1) {
masked = (y < 0 || y >= _out.h) || (v1.x < 0 || v1.x >= _out.w) || (v1.mask_ptr && (mask[0] & maskbit));
if (color && !masked) {
- *dst = _palette[color];
+ if (amigaMap)
+ *dst = amigaMap[_palette[color]];
+ else
+ *dst = _palette[color];
}
if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) {
diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp
index 6739282c9d..36f06a4889 100644
--- a/engines/scumm/cursor.cpp
+++ b/engines/scumm/cursor.cpp
@@ -609,7 +609,16 @@ void ScummEngine_v5::setBuiltinCursor(int idx) {
for (i = 0; i < 1024; i++)
WRITE_UINT16(_grabbedCursor + i * 2, 0xFF);
} else {
- color = default_cursor_colors[idx];
+ // Indy4 Amiga uses its own color set for the cursor image.
+ // This is patchwork code to make the cursor flash in correct colors.
+ if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
+ static const uint8 indy4AmigaColors[4] = {
+ 252, 252, 253, 254
+ };
+ color = indy4AmigaColors[idx];
+ } else {
+ color = default_cursor_colors[idx];
+ }
memset(_grabbedCursor, 0xFF, sizeof(_grabbedCursor));
}
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index 037c12bdbf..92face553c 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -308,6 +308,46 @@ static void closeDiskImage(ScummDiskImage *img) {
SearchMan.remove("tmpDiskImgDir");
}
+/*
+ * This function tries to detect if a speech file exists.
+ * False doesn't necessarily mean there are no speech files.
+ */
+static bool detectSpeech(const Common::FSList &fslist, const GameSettings *gs) {
+ if (gs->id == GID_MONKEY || gs->id == GID_MONKEY2) {
+ // FMTOWNS monkey and monkey2 games don't have speech but may have .sou files
+ if (gs->platform == Common::kPlatformFMTowns)
+ return false;
+
+ const char *const basenames[] = { gs->gameid, "monster", 0 };
+ static const char *const extensions[] = { "sou",
+#ifdef USE_FLAC
+ "sof",
+#endif
+#ifdef USE_VORBIS
+ "sog",
+#endif
+#ifdef USE_MAD
+ "so3",
+#endif
+ 0 };
+
+ for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
+ if (file->isDirectory())
+ continue;
+
+ for (int i = 0; basenames[i]; ++i) {
+ Common::String basename = Common::String(basenames[i]) + ".";
+
+ for (int j = 0; extensions[j]; ++j) {
+ if ((basename + extensions[j]).equalsIgnoreCase(file->getName()))
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+}
+
// The following function tries to detect the language for COMI and DIG
static Common::Language detectLanguage(const Common::FSList &fslist, byte id) {
// First try to detect Chinese translation
@@ -436,7 +476,7 @@ static void computeGameSettingsFromMD5(const Common::FSList &fslist, const GameF
}
}
-static void composeFileHashMap(DescMap &fileMD5Map, const Common::FSList &fslist, int depth, const char **globs) {
+static void composeFileHashMap(DescMap &fileMD5Map, const Common::FSList &fslist, int depth, const char *const *globs) {
if (depth <= 0)
return;
@@ -454,7 +494,7 @@ static void composeFileHashMap(DescMap &fileMD5Map, const Common::FSList &fslist
continue;
bool matched = false;
- for (const char **glob = globs; *glob; glob++)
+ for (const char *const *glob = globs; *glob; glob++)
if (file->getName().matchString(*glob, true)) {
matched = true;
break;
@@ -608,6 +648,10 @@ static void detectGames(const Common::FSList &fslist, Common::List<DetectorResul
// HACK: Perhaps it is some modified translation?
dr.language = detectLanguage(fslist, g->id);
+ // Detect if there are speech files in this unknown game
+ if (detectSpeech(fslist, g))
+ dr.game.guioptions &= ~GUIO_NOSPEECH;
+
// Add the game/variant to the candidates list if it is consistent
// with the file(s) we are seeing.
if (testGame(g, fileMD5Map, file))
diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h
index 78645ea8d5..7463fa7dcc 100644
--- a/engines/scumm/detection_tables.h
+++ b/engines/scumm/detection_tables.h
@@ -49,7 +49,7 @@ namespace Scumm {
* This table contains list of directories which could contain game data
* and which should be looked into during detection.
*/
-static const char *directoryGlobs[] = {
+static const char *const directoryGlobs[] = {
"rooms *", // Mac version of indy3/loom
0
};
diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
index 74a92f2204..20aedae089 100644
--- a/engines/scumm/dialogs.cpp
+++ b/engines/scumm/dialogs.cpp
@@ -593,7 +593,7 @@ void SubtitleSettingsDialog::open() {
}
void SubtitleSettingsDialog::cycleValue() {
- static const char* subtitleDesc[] = {
+ static const char *const subtitleDesc[] = {
_s("Speech Only"),
_s("Speech and Subtitles"),
_s("Subtitles Only")
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index 8a32b963cd..a22aa1802f 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -1025,6 +1025,16 @@ void ScummEngine::restoreBackground(Common::Rect rect, byte backColor) {
if (rect.left > vs->w)
return;
+ // Indy4 Amiga always uses the room or verb palette map to match colors to
+ // the currently setup palette, thus we need to select it over here too.
+ // Done like the original interpreter.
+ if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
+ if (vs->number == kVerbVirtScreen)
+ backColor = _verbPalette[backColor];
+ else
+ backColor = _roomPalette[backColor];
+ }
+
// Convert 'rect' to local (virtual screen) coordinates
rect.top -= vs->topline;
rect.bottom -= vs->topline;
@@ -1235,6 +1245,16 @@ void ScummEngine::drawBox(int x, int y, int x2, int y2, int color) {
if ((vs = findVirtScreen(y)) == NULL)
return;
+ // Indy4 Amiga always uses the room or verb palette map to match colors to
+ // the currently setup palette, thus we need to select it over here too.
+ // Done like the original interpreter.
+ if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
+ if (vs->number == kVerbVirtScreen)
+ color = _verbPalette[color];
+ else
+ color = _roomPalette[color];
+ }
+
if (x > x2)
SWAP(x, x2);
@@ -1872,6 +1892,16 @@ bool Gdi::drawStrip(byte *dstPtr, VirtScreen *vs, int x, int y, const int width,
}
assertRange(0, offset, smapLen-1, "screen strip");
+ // Indy4 Amiga always uses the room or verb palette map to match colors to
+ // the currently setup palette, thus we need to select it over here too.
+ // Done like the original interpreter.
+ if (_vm->_game.platform == Common::kPlatformAmiga && _vm->_game.id == GID_INDY4) {
+ if (vs->number == kVerbVirtScreen)
+ _roomPalette = _vm->_verbPalette;
+ else
+ _roomPalette = _vm->_roomPalette;
+ }
+
return decompressBitmap(dstPtr, vs->pitch, smap_ptr + offset, height);
}
diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h
index f4df6571fa..cdc5faa084 100644
--- a/engines/scumm/he/intern_he.h
+++ b/engines/scumm/he/intern_he.h
@@ -458,6 +458,7 @@ protected:
virtual void saveOrLoad(Serializer *s);
virtual void readMAXS(int blockSize);
+ void setResourceOffHeap(int typeId, int resId, int val);
virtual void processActors();
diff --git a/engines/scumm/he/logic/basketball.cpp b/engines/scumm/he/logic/basketball.cpp
index 8352aa4357..a4da8e05dc 100644
--- a/engines/scumm/he/logic/basketball.cpp
+++ b/engines/scumm/he/logic/basketball.cpp
@@ -157,7 +157,7 @@ int LogicHEbasketball::op_1012() {
int LogicHEbasketball::op_1050(int32 *args) {
// This function loads the court data
- static const char *courtNames[] = {
+ static const char *const courtNames[] = {
"Dobbaguchi", "Jocindas", "SandyFlats", "Queens",
"Park", "Scheffler", "Polk", "McMillan",
"CrownHill", "Memorial", "TechState", "Garden",
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index 39240e347f..42748d08ed 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -386,6 +386,40 @@ int ScummEngine_v72he::getSoundResourceSize(ResId id) {
return size;
}
+void ScummEngine_v90he::setResourceOffHeap(int typeId, int resId, int val) {
+ debug(0, "setResourceOffHeap: type %d resId %d toggle %d", typeId, resId, val);
+ ResType type;
+
+ switch (typeId) {
+ case 1:
+ type = rtRoom;
+ break;
+ case 2:
+ type = rtScript;
+ break;
+ case 3:
+ type = rtCostume;
+ break;
+ case 4:
+ type = rtSound;
+ break;
+ case 6:
+ type = rtCharset;
+ break;
+ case 19:
+ type = rtImage;
+ break;
+ default:
+ error("setResourceOffHeap: default case %d", typeId);
+ }
+
+ if (val == 1) {
+ _res->setOffHeap(type, resId);
+ } else {
+ _res->setOnHeap(type, resId);
+ }
+}
+
#endif
} // End of namespace Scumm
diff --git a/engines/scumm/he/script_v90he.cpp b/engines/scumm/he/script_v90he.cpp
index 66a0a34d16..877f8b239d 100644
--- a/engines/scumm/he/script_v90he.cpp
+++ b/engines/scumm/he/script_v90he.cpp
@@ -2358,7 +2358,7 @@ void ScummEngine_v90he::o90_kernelSetFunctions() {
_wiz->_rectOverrideEnabled = false;
break;
case 714:
- debug(5, "o90_kernelSetFunctions: case 714: type %d resId %d unk1 %d", args[1], args[2], args[3]);
+ setResourceOffHeap(args[1], args[2], args[3]);
break;
case 1492:
// Remote start script function
diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp
index 30096000ce..2c10758730 100644
--- a/engines/scumm/palette.cpp
+++ b/engines/scumm/palette.cpp
@@ -372,6 +372,143 @@ void ScummEngine::setPaletteFromPtr(const byte *ptr, int numcolor) {
setDirtyColors(firstIndex, numcolor - 1);
}
+void ScummEngine::setAmigaPaletteFromPtr(const byte *ptr) {
+ memcpy(_currentPalette, ptr, 768);
+
+ for (int i = 0; i < 32; ++i) {
+ _shadowPalette[i] = i;
+ _colorUsedByCycle[i] = 0;
+ }
+
+ amigaPaletteFindFirstUsedColor();
+
+ for (int i = 0; i < 64; ++i) {
+ _amigaPalette[i * 3 + 0] = _currentPalette[(i + 16) * 3 + 0] >> 4;
+ _amigaPalette[i * 3 + 1] = _currentPalette[(i + 16) * 3 + 1] >> 4;
+ _amigaPalette[i * 3 + 2] = _currentPalette[(i + 16) * 3 + 2] >> 4;
+ }
+
+ for (int i = 0; i < 256; ++i) {
+ if (i < 16 || i >= _amigaFirstUsedColor) {
+ mapRoomPalette(i);
+ mapVerbPalette(i);
+ } else {
+ int idx = (i - 16) & 31;
+ // We adjust our verb palette map from [0, 31] to [32, 63], since unlike
+ // the original we set up the verb palette at colors [32, 63].
+ // The original instead used two different palettes for the verb virtual
+ // screen and all the rest.
+ if (idx != 17) {
+ _roomPalette[i] = idx;
+ _verbPalette[i] = idx + 32;
+ } else {
+ // In all my tests it seems the colors 0 and 32 in
+ // _amigaPalette are in fact black. Thus 17 is probably black.
+ // For the room map the color 17 is 33 (17+16), for the verb
+ // map it is 65 (17+32).
+ _roomPalette[i] = 0;
+ _verbPalette[i] = 32;
+ }
+ }
+ }
+
+ setDirtyColors(0, 255);
+}
+
+void ScummEngine::amigaPaletteFindFirstUsedColor() {
+ for (_amigaFirstUsedColor = 80; _amigaFirstUsedColor < 256; ++_amigaFirstUsedColor) {
+ // We look for the first used color here. If all color components are
+ // >= 252 the color seems to be unused. Check remapPaletteColor for
+ // the same behavior.
+ if (_currentPalette[_amigaFirstUsedColor * 3 + 0] <= 251
+ || _currentPalette[_amigaFirstUsedColor * 3 + 1] <= 251
+ || _currentPalette[_amigaFirstUsedColor * 3 + 2] <= 251)
+ break;
+ }
+}
+
+void ScummEngine::mapRoomPalette(int idx) {
+ // For Color 33 (which is in fact 17+16) see the special case in
+ // setAmigaPaletteFromPtr.
+ if (idx >= 16 && idx < 48 && idx != 33)
+ _roomPalette[idx] = idx - 16;
+ else
+ _roomPalette[idx] = remapRoomPaletteColor(_currentPalette[idx * 3 + 0] >> 4,
+ _currentPalette[idx * 3 + 1] >> 4,
+ _currentPalette[idx * 3 + 2] >> 4);
+}
+
+static const uint8 amigaWeightTable[16] = {
+ 0, 1, 4, 9, 16, 25, 36, 49,
+ 64, 81, 100, 121, 144, 169, 196, 225
+};
+
+int ScummEngine::remapRoomPaletteColor(int r, int g, int b) {
+ int idx = 0;
+ uint16 minValue = 0xFFFF;
+
+ const byte *pal = _amigaPalette;
+ const byte *cycle = _colorUsedByCycle;
+
+ for (int i = 0; i < 32; ++i) {
+ if (!*cycle++ && i != 17) {
+ int rD = ABS<int>(*pal++ - r);
+ int gD = ABS<int>(*pal++ - g);
+ int bD = ABS<int>(*pal++ - b);
+
+ const uint16 weight = amigaWeightTable[rD] + amigaWeightTable[gD] + amigaWeightTable[bD];
+ if (weight < minValue) {
+ minValue = weight;
+ idx = i;
+ }
+ } else {
+ pal += 3;
+ }
+ }
+
+ return idx;
+}
+
+void ScummEngine::mapVerbPalette(int idx) {
+ // We adjust our verb palette map from [0, 31] to [32, 63], since unlike
+ // the original we set up the verb palette at colors [32, 63].
+ // The original instead used two different palettes for the verb virtual
+ // screen and all the rest.
+ // For Color 65 (which is in fact 17+32) see the special case in
+ // setAmigaPaletteFromPtr.
+ if (idx >= 48 && idx < 80 && idx != 65)
+ _verbPalette[idx] = idx - 16;
+ else
+ _verbPalette[idx] = remapVerbPaletteColor(_currentPalette[idx * 3 + 0] >> 4,
+ _currentPalette[idx * 3 + 1] >> 4,
+ _currentPalette[idx * 3 + 2] >> 4) + 32;
+}
+
+int ScummEngine::remapVerbPaletteColor(int r, int g, int b) {
+ int idx = 0;
+ uint16 minValue = 0xFFFF;
+
+ const byte *pal = _amigaPalette + 32 * 3;
+
+ for (int i = 0; i < 32; ++i) {
+ if (i != 17) {
+ int rD = ABS<int>(*pal++ - r);
+ int gD = ABS<int>(*pal++ - g);
+ int bD = ABS<int>(*pal++ - b);
+
+ const uint16 weight = amigaWeightTable[rD] + amigaWeightTable[gD] + amigaWeightTable[bD];
+ if (weight < minValue) {
+ minValue = weight;
+ idx = i;
+ }
+ } else {
+ pal += 3;
+ }
+ }
+
+ return idx;
+}
+
void ScummEngine::setDirtyColors(int min, int max) {
if (_palDirtyMin > min)
_palDirtyMin = min;
@@ -419,11 +556,26 @@ void ScummEngine::initCycl(const byte *ptr) {
cycl->start = *ptr++;
cycl->end = *ptr++;
+ if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
+ cycl->start = CLIP(cycl->start - 16, 0, 31);
+ cycl->end = CLIP(cycl->end - 16, 0, 31);
+ }
+
for (int i = cycl->start; i <= cycl->end; ++i) {
_colorUsedByCycle[i] = 1;
}
}
}
+
+ if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
+ for (int i = 0; i < 256; ++i) {
+ if (i >= 16 && i < _amigaFirstUsedColor)
+ continue;
+
+ if (_colorUsedByCycle[_roomPalette[i]])
+ mapRoomPalette(i);
+ }
+ }
}
void ScummEngine::stopCycle(int i) {
@@ -432,11 +584,25 @@ void ScummEngine::stopCycle(int i) {
assertRange(0, i, 16, "stopCycle: cycle");
if (i != 0) {
_colorCycle[i - 1].delay = 0;
+ if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
+ cycl = &_colorCycle[i - 1];
+ for (int j = cycl->start; j <= cycl->end && j < 32; ++j) {
+ _shadowPalette[j] = j;
+ _colorUsedByCycle[j] = 0;
+ }
+ }
return;
}
- for (i = 0, cycl = _colorCycle; i < 16; i++, cycl++)
+ for (i = 0, cycl = _colorCycle; i < 16; i++, cycl++) {
cycl->delay = 0;
+ if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
+ for (int j = cycl->start; j <= cycl->end && j < 32; ++j) {
+ _shadowPalette[j] = j;
+ _colorUsedByCycle[j] = 0;
+ }
+ }
+ }
}
/**
@@ -512,14 +678,18 @@ void ScummEngine::cyclePalette() {
setDirtyColors(cycl->start, cycl->end);
moveMemInPalRes(cycl->start, cycl->end, cycl->flags & 2);
- doCyclePalette(_currentPalette, cycl->start, cycl->end, 3, !(cycl->flags & 2));
+ if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
+ doCyclePalette(_shadowPalette, cycl->start, cycl->end, 1, !(cycl->flags & 2));
+ } else {
+ doCyclePalette(_currentPalette, cycl->start, cycl->end, 3, !(cycl->flags & 2));
- if (_shadowPalette) {
- if (_game.version >= 7) {
- for (j = 0; j < NUM_SHADOW_PALETTE; j++)
+ if (_shadowPalette) {
+ if (_game.version >= 7) {
+ for (j = 0; j < NUM_SHADOW_PALETTE; j++)
doCycleIndirectPalette(_shadowPalette + j * 256, cycl->start, cycl->end, !(cycl->flags & 2));
- } else {
- doCycleIndirectPalette(_shadowPalette, cycl->start, cycl->end, !(cycl->flags & 2));
+ } else {
+ doCycleIndirectPalette(_shadowPalette, cycl->start, cycl->end, !(cycl->flags & 2));
+ }
}
}
}
@@ -733,62 +903,106 @@ void ScummEngine::setShadowPalette(int redScale, int greenScale, int blueScale,
}
void ScummEngine::darkenPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor) {
- int max;
- if (_game.version >= 5 && _game.version <= 6 && _game.heversion <= 60) {
- max = 252;
- } else {
- max = 255;
- }
+ if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
+ startColor = CLIP(startColor, 0, 255);
- if (startColor <= endColor) {
- const byte *cptr;
- const byte *palptr;
- int color, idx, j;
+ //bool remappedVerbColors = false;
+ bool remappedRoomColors = false;
+ bool cycleFlag = (blueScale >= 250 && greenScale >= 250 && redScale >= 250);
+
+ const byte *palptr = getPalettePtr(_curPalIndex, _roomResource) + startColor * 3;
- if (_game.heversion >= 90 || _game.version == 8) {
- palptr = _darkenPalette;
+ for (int i = startColor; i <= endColor; ++i) {
+ if (i > 16 && i < 48) {
+ if (cycleFlag)
+ _colorUsedByCycle[i - 16] &= ~2;
+ else
+ _colorUsedByCycle[i - 16] |= 2;
+ }
+
+ _currentPalette[i * 3 + 0] = (*palptr++ * redScale) >> 8;
+ _currentPalette[i * 3 + 1] = (*palptr++ * greenScale) >> 8;
+ _currentPalette[i * 3 + 2] = (*palptr++ * blueScale) >> 8;
+ }
+
+ for (int i = startColor; i <= endColor; ++i) {
+ // Colors 33 (17+16) and 65 (17+32) will never get changed. For
+ // more information about these check setAmigaPaletteFromPtr.
+ if (i >= 16 && i < 48 && i != 33) {
+ remappedRoomColors = true;
+ _amigaPalette[(i - 16) * 3 + 0] = _currentPalette[i * 3 + 0] >> 4;
+ _amigaPalette[(i - 16) * 3 + 1] = _currentPalette[i * 3 + 1] >> 4;
+ _amigaPalette[(i - 16) * 3 + 2] = _currentPalette[i * 3 + 2] >> 4;
+ } else if (i >= 48 && i < 80 && i != 65) {
+ //remappedVerbColors = true;
+ _amigaPalette[(i - 16) * 3 + 0] = _currentPalette[i * 3 + 0] >> 4;
+ _amigaPalette[(i - 16) * 3 + 1] = _currentPalette[i * 3 + 1] >> 4;
+ _amigaPalette[(i - 16) * 3 + 2] = _currentPalette[i * 3 + 2] >> 4;
+ }
+ }
+
+ for (int i = 0; i < 256; ++i) {
+ if (i >= 16 && i < _amigaFirstUsedColor)
+ continue;
+
+ bool inRange = (startColor <= i && i <= endColor);
+ int idx = _roomPalette[i] + 16;
+ bool mappedInRange = (startColor <= idx && idx <= endColor);
+
+ if (inRange != mappedInRange || (remappedRoomColors && cycleFlag))
+ mapRoomPalette(i);
+ }
+
+ setDirtyColors(startColor, endColor);
+ } else {
+ int max;
+ if (_game.version >= 5 && _game.version <= 6 && _game.heversion <= 60) {
+ max = 252;
} else {
- palptr = getPalettePtr(_curPalIndex, _roomResource);
+ max = 255;
}
- for (j = startColor; j <= endColor; j++) {
- idx = (_game.heversion == 70) ? _HEV7ActorPalette[j] : j;
- cptr = palptr + idx * 3;
- if (_game.heversion == 70)
- setDirtyColors(idx, idx);
+ if (startColor <= endColor) {
+ const byte *cptr;
+ const byte *palptr;
+ int color, idx, j;
- // Original FOA Amiga version skips these colors
- // Fixes bug #1206994: "FOA AMIGA: Black cursor and text in Dig Site"
- if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
- if (j < 16) {
- cptr += 3;
- continue;
- }
+ if (_game.heversion >= 90 || _game.version == 8) {
+ palptr = _darkenPalette;
+ } else {
+ palptr = getPalettePtr(_curPalIndex, _roomResource);
}
-
- color = *cptr++;
- color = color * redScale / 0xFF;
- if (color > max)
- color = max;
- _currentPalette[idx * 3 + 0] = color;
-
- color = *cptr++;
- color = color * greenScale / 0xFF;
- if (color > max)
- color = max;
- _currentPalette[idx * 3 + 1] = color;
-
- color = *cptr++;
- color = color * blueScale / 0xFF;
- if (color > max)
- color = max;
- _currentPalette[idx * 3 + 2] = color;
-
- if (_game.features & GF_16BIT_COLOR)
- _16BitPalette[idx] = get16BitColor(_currentPalette[idx * 3 + 0], _currentPalette[idx * 3 + 1], _currentPalette[idx * 3 + 2]);
+ for (j = startColor; j <= endColor; j++) {
+ idx = (_game.heversion == 70) ? _HEV7ActorPalette[j] : j;
+ cptr = palptr + idx * 3;
+
+ if (_game.heversion == 70)
+ setDirtyColors(idx, idx);
+
+ color = *cptr++;
+ color = color * redScale / 0xFF;
+ if (color > max)
+ color = max;
+ _currentPalette[idx * 3 + 0] = color;
+
+ color = *cptr++;
+ color = color * greenScale / 0xFF;
+ if (color > max)
+ color = max;
+ _currentPalette[idx * 3 + 1] = color;
+
+ color = *cptr++;
+ color = color * blueScale / 0xFF;
+ if (color > max)
+ color = max;
+ _currentPalette[idx * 3 + 2] = color;
+
+ if (_game.features & GF_16BIT_COLOR)
+ _16BitPalette[idx] = get16BitColor(_currentPalette[idx * 3 + 0], _currentPalette[idx * 3 + 1], _currentPalette[idx * 3 + 2]);
+ }
+ if (_game.heversion != 70)
+ setDirtyColors(startColor, endColor);
}
- if (_game.heversion != 70)
- setDirtyColors(startColor, endColor);
}
}
@@ -1007,6 +1221,41 @@ void ScummEngine::setPalColor(int idx, int r, int g, int b) {
_darkenPalette[idx * 3 + 2] = b;
}
+ if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
+ // Colors 33 (17+16) and 65 (17+32) will never get changed. For
+ // more information about these check setAmigaPaletteFromPtr.
+ if (idx < 16 || idx >= _amigaFirstUsedColor) {
+ mapRoomPalette(idx);
+ mapVerbPalette(idx);
+ } else if (idx >= 16 && idx < 48 && idx != 33) {
+ _amigaPalette[(idx - 16) * 3 + 0] = _currentPalette[idx * 3 + 0] >> 4;
+ _amigaPalette[(idx - 16) * 3 + 1] = _currentPalette[idx * 3 + 1] >> 4;
+ _amigaPalette[(idx - 16) * 3 + 2] = _currentPalette[idx * 3 + 2] >> 4;
+
+ for (int i = 0; i < 256; ++i) {
+ if (i >= 16 && i < _amigaFirstUsedColor)
+ continue;
+
+ if (idx - 16 == _roomPalette[i])
+ mapRoomPalette(i);
+ }
+ } else if (idx >= 48 && idx < 80 && idx != 65) {
+ _amigaPalette[(idx - 16) * 3 + 0] = _currentPalette[idx * 3 + 0] >> 4;
+ _amigaPalette[(idx - 16) * 3 + 1] = _currentPalette[idx * 3 + 1] >> 4;
+ _amigaPalette[(idx - 16) * 3 + 2] = _currentPalette[idx * 3 + 2] >> 4;
+
+ for (int i = 0; i < 256; ++i) {
+ if (i >= 16 && i < _amigaFirstUsedColor)
+ continue;
+
+ // We do - 16 instead of - 48 like the original, since our
+ // verb palette map is using [32, 63] instead of [0, 31].
+ if (idx - 16 == _verbPalette[i])
+ mapVerbPalette(i);
+ }
+ }
+ }
+
if (_game.features & GF_16BIT_COLOR)
_16BitPalette[idx] = get16BitColor(r, g, b);
@@ -1026,6 +1275,8 @@ void ScummEngine::setCurrentPalette(int palindex) {
towns_setPaletteFromPtr(pals);
#endif
#endif
+ } else if (_game.id == GID_INDY4 && _game.platform == Common::kPlatformAmiga) {
+ setAmigaPaletteFromPtr(pals);
} else {
setPaletteFromPtr(pals);
}
@@ -1081,42 +1332,74 @@ void ScummEngine::updatePalette() {
if (_palDirtyMax == -1)
return;
- bool noir_mode = (_game.id == GID_SAMNMAX && readVar(0x8000));
- int first = _palDirtyMin;
- int num = _palDirtyMax - first + 1;
- int i;
-
byte palette_colors[3 * 256];
byte *p = palette_colors;
+ int first;
+ int num;
- for (i = _palDirtyMin; i <= _palDirtyMax; i++) {
- byte *data;
+ if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
+ // Indy4 Amiga has a special palette handling scheme
+ first = 0;
+ num = 64;
- if (_game.features & GF_SMALL_HEADER && _game.version > 2)
- data = _currentPalette + _shadowPalette[i] * 3;
- else
- data = _currentPalette + i * 3;
+ for (int i = 0; i < 64; ++i) {
+ byte *data;
- // Sam & Max film noir mode. Convert the colors to grayscale
- // before uploading them to the backend.
+ if (i < 32)
+ data = _amigaPalette + _shadowPalette[i] * 3;
+ else
+ data = _amigaPalette + i * 3;
- if (noir_mode) {
- int r, g, b;
- byte brightness;
+ *p++ = data[0] * 255 / 15;
+ *p++ = data[1] * 255 / 15;
+ *p++ = data[2] * 255 / 15;
+ }
- r = data[0];
- g = data[1];
- b = data[2];
+ // Setup colors for the mouse cursor
+ // Color values taken from Indy4 DOS
+ static const uint8 mouseCursorPalette[] = {
+ 255, 255, 255,
+ 171, 171, 171,
+ 87, 87, 87
+ };
- brightness = (byte)((0.299 * r + 0.587 * g + 0.114 * b) + 0.5);
+ _system->getPaletteManager()->setPalette(mouseCursorPalette, 252, 3);
+ } else {
+ bool noir_mode = (_game.id == GID_SAMNMAX && readVar(0x8000));
+ int i;
- *p++ = brightness;
- *p++ = brightness;
- *p++ = brightness;
- } else {
- *p++ = data[0];
- *p++ = data[1];
- *p++ = data[2];
+ first = _palDirtyMin;
+ num = _palDirtyMax - first + 1;
+
+ for (i = _palDirtyMin; i <= _palDirtyMax; i++) {
+ byte *data;
+
+ if (_game.features & GF_SMALL_HEADER && _game.version > 2)
+ data = _currentPalette + _shadowPalette[i] * 3;
+ else
+ data = _currentPalette + i * 3;
+
+ // Sam & Max film noir mode. Convert the colors to grayscale
+ // before uploading them to the backend.
+
+ if (noir_mode) {
+ int r, g, b;
+ byte brightness;
+
+ r = data[0];
+ g = data[1];
+ b = data[2];
+
+ brightness = (byte)((0.299 * r + 0.587 * g + 0.114 * b) + 0.5);
+
+ *p++ = brightness;
+ *p++ = brightness;
+ *p++ = brightness;
+ } else {
+ *p++ = data[0];
+ *p++ = data[1];
+ *p++ = data[2];
+ }
}
}
@@ -1127,7 +1410,7 @@ void ScummEngine::updatePalette() {
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
if (_game.platform == Common::kPlatformFMTowns) {
p = palette_colors;
- for (i = first; i < first + num; ++i) {
+ for (int i = first; i < first + num; ++i) {
_16BitPalette[i] = get16BitColor(p[0], p[1], p[2]);
p += 3;
}
diff --git a/engines/scumm/player_towns.cpp b/engines/scumm/player_towns.cpp
index dd7630d370..f6f493a1e1 100644
--- a/engines/scumm/player_towns.cpp
+++ b/engines/scumm/player_towns.cpp
@@ -242,7 +242,8 @@ void Player_Towns_v1::startSound(int sound) {
}
velocity = velocity ? velocity >> 2 : ptr[14] >> 1;
- playPcmTrack(sound, ptr + 6, velocity, 64, note ? note : ptr[50], READ_LE_UINT16(ptr + 10));
+ uint16 len = READ_LE_UINT16(ptr) + 2;
+ playPcmTrack(sound, ptr + 6, velocity, 64, note ? note : (len > 50 ? ptr[50] : 60), READ_LE_UINT16(ptr + 10));
} else if (type == 1) {
playEuphonyTrack(sound, ptr + 6);
diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp
index 10301da3e3..f445a44ded 100644
--- a/engines/scumm/resource.cpp
+++ b/engines/scumm/resource.cpp
@@ -47,7 +47,8 @@ enum {
RF_USAGE = 0x7F,
RF_USAGE_MAX = RF_USAGE,
- RS_MODIFIED = 0x10
+ RS_MODIFIED = 0x10,
+ RF_OFFHEAP = 0x40
};
@@ -993,18 +994,42 @@ void ResourceManager::setModified(ResType type, ResId idx) {
_types[type][idx].setModified();
}
+void ResourceManager::setOffHeap(ResType type, ResId idx) {
+ if (!validateResource("setOffHeap", type, idx))
+ return;
+ _types[type][idx].setOffHeap();
+}
+
+void ResourceManager::setOnHeap(ResType type, ResId idx) {
+ if (!validateResource("setOnHeap", type, idx))
+ return;
+ _types[type][idx].setOnHeap();
+}
+
bool ResourceManager::isModified(ResType type, ResId idx) const {
if (!validateResource("isModified", type, idx))
return false;
return _types[type][idx].isModified();
}
+bool ResourceManager::Resource::isModified() const {
+ return (_status & RS_MODIFIED) != 0;
+}
+
+bool ResourceManager::Resource::isOffHeap() const {
+ return (_status & RF_OFFHEAP) != 0;
+}
+
void ResourceManager::Resource::setModified() {
_status |= RS_MODIFIED;
}
-bool ResourceManager::Resource::isModified() const {
- return (_status & RS_MODIFIED) != 0;
+void ResourceManager::Resource::setOffHeap() {
+ _status |= RF_OFFHEAP;
+}
+
+void ResourceManager::Resource::setOnHeap() {
+ _status &= ~RF_OFFHEAP;
}
void ResourceManager::expireResources(uint32 size) {
@@ -1035,7 +1060,7 @@ void ResourceManager::expireResources(uint32 size) {
while (idx-- > 0) {
Resource &tmp = _types[type][idx];
byte counter = tmp.getResourceCounter();
- if (!tmp.isLocked() && counter >= best_counter && tmp._address && !_vm->isResourceInUse(type, idx)) {
+ if (!tmp.isLocked() && counter >= best_counter && tmp._address && !_vm->isResourceInUse(type, idx) && !tmp.isOffHeap()) {
best_counter = counter;
best_type = type;
best_res = idx;
diff --git a/engines/scumm/resource.h b/engines/scumm/resource.h
index 2e8960717f..aa7f809b76 100644
--- a/engines/scumm/resource.h
+++ b/engines/scumm/resource.h
@@ -138,8 +138,12 @@ public:
void unlock();
bool isLocked() const;
+ // HE specific
void setModified();
bool isModified() const;
+ void setOffHeap();
+ void setOnHeap();
+ bool isOffHeap() const;
};
/**
@@ -192,8 +196,11 @@ public:
void unlock(ResType type, ResId idx);
bool isLocked(ResType type, ResId idx) const;
+ // HE Specific
void setModified(ResType type, ResId idx);
bool isModified(ResType type, ResId idx) const;
+ void setOffHeap(ResType type, ResId idx);
+ void setOnHeap(ResType type, ResId idx);
/**
* This method increments the _expireCounter, and if it overflows (which happens
diff --git a/engines/scumm/room.cpp b/engines/scumm/room.cpp
index 8962a0e971..63cbef8944 100644
--- a/engines/scumm/room.cpp
+++ b/engines/scumm/room.cpp
@@ -552,6 +552,10 @@ void ScummEngine::resetRoomSubBlocks() {
}
}
+ // We need to setup the current palette before initCycl for Indy4 Amiga.
+ if (_PALS_offs || _CLUT_offs)
+ setCurrentPalette(0);
+
// Color cycling
// HE 7.0 games load resources but don't use them.
if (_game.version >= 4 && _game.heversion <= 62) {
@@ -570,9 +574,6 @@ void ScummEngine::resetRoomSubBlocks() {
}
}
#endif
-
- if (_PALS_offs || _CLUT_offs)
- setCurrentPalette(0);
}
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index 870ec8cdf7..3ab13df032 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -30,7 +30,7 @@
#include "scumm/charset.h"
#include "scumm/imuse_digi/dimuse.h"
#include "scumm/imuse/imuse.h"
-#include "player_towns.h"
+#include "scumm/player_towns.h"
#include "scumm/he/intern_he.h"
#include "scumm/object.h"
#include "scumm/resource.h"
@@ -1322,6 +1322,9 @@ void ScummEngine::saveOrLoad(Serializer *s) {
if (_shadowPaletteSize) {
s->saveLoadArrayOf(_shadowPalette, _shadowPaletteSize, 1, sleByte);
// _roomPalette didn't show up until V21 save games
+ // Note that we also save the room palette for Indy4 Amiga, since it
+ // is used as palette map there too, but we do so slightly a bit
+ // further down to group it with the other special palettes needed.
if (s->getVersion() >= VER(21) && _game.version < 5)
s->saveLoadArrayOf(_roomPalette, sizeof(_roomPalette), 1, sleByte);
}
@@ -1348,6 +1351,29 @@ void ScummEngine::saveOrLoad(Serializer *s) {
memset(_colorUsedByCycle, 0, sizeof(_colorUsedByCycle));
}
+ // Indy4 Amiga specific palette tables were not saved before V85
+ if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4) {
+ if (s->getVersion() >= 85) {
+ s->saveLoadArrayOf(_roomPalette, 256, 1, sleByte);
+ s->saveLoadArrayOf(_verbPalette, 256, 1, sleByte);
+ s->saveLoadArrayOf(_amigaPalette, 3 * 64, 1, sleByte);
+
+ // Starting from version 86 we also save the first used color in
+ // the palette beyond the verb palette. For old versions we just
+ // look for it again, which hopefully won't cause any troubles.
+ if (s->getVersion() >= 86) {
+ s->saveLoadArrayOf(&_amigaFirstUsedColor, 1, 2, sleUint16);
+ } else {
+ amigaPaletteFindFirstUsedColor();
+ }
+ } else {
+ warning("Save with old Indiana Jones 4 Amiga palette handling detected");
+ // We need to restore the internal state of the Amiga palette for Indy4
+ // Amiga. This might lead to graphics glitches!
+ setAmigaPaletteFromPtr(_currentPalette);
+ }
+ }
+
//
// Save/load more global object state
//
diff --git a/engines/scumm/saveload.h b/engines/scumm/saveload.h
index 776f40e12b..16c225d20e 100644
--- a/engines/scumm/saveload.h
+++ b/engines/scumm/saveload.h
@@ -47,7 +47,7 @@ namespace Scumm {
* only saves/loads those which are valid for the version of the savegame
* which is being loaded/saved currently.
*/
-#define CURRENT_VER 84
+#define CURRENT_VER 86
/**
* An auxillary macro, used to specify savegame versions. We use this instead
diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp
index 1ef16d7106..e2d3f40e8e 100644
--- a/engines/scumm/script_v0.cpp
+++ b/engines/scumm/script_v0.cpp
@@ -442,7 +442,7 @@ void ScummEngine_v0::drawSentenceWord(int object, bool usePrep, bool objInInvent
// The prepositions, like the fonts, were hard code in the engine. Thus
// we have to do that, too, and provde localized versions for all the
// languages MM/Zak are available in.
- static const char *prepositions[][5] = {
+ static const char *const prepositions[][5] = {
{ " ", " in", " with", " on", " to" }, // English
{ " ", " mit", " mit", " mit", " zu" }, // German
{ " ", " dans", " avec", " sur", " <" }, // French
diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp
index 02c8d977a5..6426b75e1e 100644
--- a/engines/scumm/script_v5.cpp
+++ b/engines/scumm/script_v5.cpp
@@ -1799,12 +1799,20 @@ void ScummEngine_v5::o5_roomOps() {
case 13: // SO_SAVE_STRING
{
- // This subopcode is used in Indy 4 to save the IQ points data.
- // No other game uses it. We use this to replace the given filename by
- // one based on the targetname ("TARGET.iq").
- // This way, the iq data of each Indy 4 variant a user might have stays
- // separate. Moreover, the filename now clearly reflects to which target
- // it belongs (as it should).
+ // This subopcode is used in Indy 4 to save the IQ points
+ // data. No other LucasArts game uses it. We use this fact
+ // to substitute a filename based on the targetname
+ // ("TARGET.iq").
+ //
+ // This way, the iq data of each Indy 4 variant stays
+ // separate. Moreover, the filename now clearly reflects to
+ // which target it belongs (as it should).
+ //
+ // In addition, the Monkey Island fan patch (which adds
+ // speech support and more things to MI 1 and 2) uses
+ // this opcode to generate a "monkey.cfg" file containing.
+ // some user controllable settings.
+ // Once more we use a custom filename ("TARGET.cfg").
Common::String filename;
char chr;
@@ -1814,6 +1822,8 @@ void ScummEngine_v5::o5_roomOps() {
if (_game.id == GID_INDY4) {
filename = _targetName + ".iq";
+ } else if (_game.id == GID_MONKEY || _game.id == GID_MONKEY2) {
+ filename = _targetName + ".cfg";
} else {
error("SO_SAVE_STRING: Unsupported filename %s", filename.c_str());
}
@@ -1841,6 +1851,8 @@ void ScummEngine_v5::o5_roomOps() {
if (_game.id == GID_INDY4) {
filename = _targetName + ".iq";
+ } else if (_game.id == GID_MONKEY || _game.id == GID_MONKEY2) {
+ filename = _targetName + ".cfg";
} else {
error("SO_LOAD_STRING: Unsupported filename %s", filename.c_str());
}
diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h
index 319eddf871..45c6e90a08 100644
--- a/engines/scumm/scumm-md5.h
+++ b/engines/scumm/scumm-md5.h
@@ -1,5 +1,5 @@
/*
- This file was generated by the md5table tool on Wed Aug 3 03:14:00 2011
+ This file was generated by the md5table tool on Sun Oct 02 03:05:23 2011
DO NOT EDIT MANUALLY!
*/
@@ -578,7 +578,7 @@ static const MD5Table md5table[] = {
{ "e5563c8358443c4352fcddf7402a5e0a", "pajama2", "HE 98.5", "", -1, Common::FR_FRA, Common::kPlatformWindows },
{ "e5c112140ad6574997de033a8e2a2964", "readtime", "", "", -1, Common::EN_ANY, Common::kPlatformUnknown },
{ "e62056ba675ad65d8854ab3c5ad4b3c0", "spyfox2", "", "Mini Game", -1, Common::EN_ANY, Common::kPlatformWindows },
- { "e63a0b9249b5ca4cc4d3ac34305ae360", "freddi", "HE 71", "", -1, Common::NB_NOR, Common::kPlatformWindows },
+ { "e63a0b9249b5ca4cc4d3ac34305ae360", "freddi", "HE 99", "", -1, Common::NB_NOR, Common::kPlatformWindows },
{ "e689bdf67f98b1d760ce4487ec0e8d06", "indy3", "EGA", "EGA", -1, Common::FR_FRA, Common::kPlatformAmiga },
{ "e6cd81b25ab1453a8a6d3482118c391e", "pass", "", "", 7857, Common::EN_ANY, Common::kPlatformPC },
{ "e72bb4c2b613db2cf50f89ff6350e70a", "ft", "", "", -1, Common::ES_ESP, Common::kPlatformUnknown },
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 3b83019275..81f6af453c 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -290,6 +290,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
#endif
_shadowPalette = NULL;
_shadowPaletteSize = 0;
+ _verbPalette = NULL;
memset(_currentPalette, 0, sizeof(_currentPalette));
memset(_darkenPalette, 0, sizeof(_darkenPalette));
memset(_HEV7ActorPalette, 0, sizeof(_HEV7ActorPalette));
@@ -610,6 +611,7 @@ ScummEngine::~ScummEngine() {
_textSurface.free();
free(_shadowPalette);
+ free(_verbPalette);
free(_palManipPalette);
free(_palManipIntermediatePal);
@@ -1408,6 +1410,10 @@ void ScummEngine::resetScumm() {
_16BitPalette = (uint16 *)calloc(512, sizeof(uint16));
#endif
+ // Indy4 Amiga needs another palette map for the verb area.
+ if (_game.platform == Common::kPlatformAmiga && _game.id == GID_INDY4 && !_verbPalette)
+ _verbPalette = (uint8 *)calloc(256, 1);
+
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
if (_game.platform == Common::kPlatformFMTowns) {
delete _townsScreen;
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 04a175e732..d9237b2b30 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -970,6 +970,7 @@ protected:
void setCurrentPalette(int pal);
void setRoomPalette(int pal, int room);
void setPCEPaletteFromPtr(const byte *ptr);
+ void setAmigaPaletteFromPtr(const byte *ptr);
virtual void setPaletteFromPtr(const byte *ptr, int numcolor = -1);
virtual void setPalColor(int index, int r, int g, int b);
@@ -1065,6 +1066,9 @@ public:
uint16 _hePaletteSlot;
uint16 *_16BitPalette;
+ // Indy4 Amiga specific
+ byte *_verbPalette;
+
protected:
int _shadowPaletteSize;
byte _currentPalette[3 * 256];
@@ -1085,6 +1089,15 @@ protected:
bool _enable_gs;
bool _copyProtection;
+ // Indy4 Amiga specific
+ uint16 _amigaFirstUsedColor;
+ byte _amigaPalette[3 * 64];
+ void amigaPaletteFindFirstUsedColor();
+ void mapRoomPalette(int idx);
+ int remapRoomPaletteColor(int r, int g, int b);
+ void mapVerbPalette(int idx);
+ int remapVerbPaletteColor(int r, int g, int b);
+
public:
uint16 _extraBoxFlags[65];
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index d8235206f8..ba8c6e2277 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -1150,19 +1150,20 @@ int ScummEngine::readSoundResource(ResId idx) {
if ((_sound->_musicType == MDT_PCSPK || _sound->_musicType == MDT_PCJR) && pri != 11)
pri = -1;
- // We only allow ADL resources when AdLib or FM-Towns is used as
- // primary audio output. This fixes some odd sounds when Indy and
- // Sophia leave Atlantis with the submarine in Indy4. (Easy to
- // check with bootparam 4061 in the CD version). It seems the game
- // only contains a ROL resource for sound id 60. Formerly we tried
- // to play that via the AdLib or FM-Towns audio driver resulting
- // in strange noises. Now we behave like the original did.
+ // We only allow ADL, SBL and TOWS resources when AdLib
+ // or FM-Towns is used as primary audio output. This fixes some
+ // odd sounds when Indy and Sophia leave Atlantis with the
+ // submarine in Indy4. (Easy to check with bootparam 4061 in
+ // the CD version). It seems the game only contains a ROL resource
+ // for sound id 60. Formerly we tried to play that via the AdLib
+ // or FM-Towns audio driver resulting in strange noises. Now we
+ // behave like the original did.
// We make an exception for Macintosh, which uses priority 2 for
// its sound resources, and Amiga games, which feature only ROL
// resources, since we are a doing Midi -> AdLib conversion for
// these.
- if ((_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS) && pri != 10
- && pri != 2 && _game.platform != Common::kPlatformAmiga)
+ if ((_sound->_musicType == MDT_ADLIB || _sound->_musicType == MDT_TOWNS) && pri != 16
+ && pri != 15 && pri != 10 && pri != 2 && _game.platform != Common::kPlatformAmiga)
pri = -1;
debugC(DEBUG_RESOURCE, " tag: %s, total_size=%d, pri=%d", tag2str(tag), size, pri);
diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp
index 0c1554840e..67ed17c024 100644
--- a/engines/scumm/verbs.cpp
+++ b/engines/scumm/verbs.cpp
@@ -1440,7 +1440,6 @@ void ScummEngine::drawVerb(int verb, int mode) {
}
void ScummEngine::restoreVerbBG(int verb) {
-
VerbSlot *vs;
vs = &_verbs[verb];
diff --git a/engines/sky/compact.cpp b/engines/sky/compact.cpp
index 84609d5500..fd81cb9bea 100644
--- a/engines/sky/compact.cpp
+++ b/engines/sky/compact.cpp
@@ -471,7 +471,7 @@ uint16 SkyCompact::giveDataListLen(uint16 listNum) {
return _dataListLen[listNum];
}
-const char *SkyCompact::_typeNames[NUM_CPT_TYPES] = {
+const char *const SkyCompact::_typeNames[NUM_CPT_TYPES] = {
"null",
"COMPACT",
"TURNTABLE",
diff --git a/engines/sky/compact.h b/engines/sky/compact.h
index a7b8520539..0bd5b4943b 100644
--- a/engines/sky/compact.h
+++ b/engines/sky/compact.h
@@ -88,7 +88,7 @@ private:
uint16 **_cptTypes;
Common::File *_cptFile;
uint32 _resetDataPos;
- static const char *_typeNames[NUM_CPT_TYPES];
+ static const char *const _typeNames[NUM_CPT_TYPES];
};
} // End of namespace Sky
diff --git a/engines/sky/debug.cpp b/engines/sky/debug.cpp
index ebc1ee377d..a417bc2ece 100644
--- a/engines/sky/debug.cpp
+++ b/engines/sky/debug.cpp
@@ -35,7 +35,7 @@
namespace Sky {
-static const char *logic_table_names[] = {
+static const char *const logic_table_names[] = {
"return",
"Logic::script",
"Logic::auto_route",
@@ -79,7 +79,7 @@ static const char opcode_par[] = {
0
};
-static const char *opcodes[] = {
+static const char *const opcodes[] = {
"push_variable",
"less_than",
"push_number",
@@ -103,7 +103,7 @@ static const char *opcodes[] = {
"restart_script"
};
-static const char *mcodes[] = {
+static const char *const mcodes[] = {
"fn_cache_chip",
"fn_cache_fast",
"fn_draw_screen",
@@ -221,7 +221,7 @@ static const char *mcodes[] = {
"fn_printf"
};
-static const char *scriptVars[] = {
+static const char *const scriptVars[] = {
"result",
"screen",
"logic_list_no",
@@ -1121,12 +1121,12 @@ bool Debugger::Cmd_ReloadGrid(int argc, const char **argv) {
return true;
}
-static const char *logicTypes[] = {
+static const char *const logicTypes[] = {
"(none)", "SCRIPT", "AUTOROUTE", "AR_ANIM", "AR_TURNING", "ALT", "MOD_ANIM", "TURNING", "CURSOR", "TALK", "LISTEN",
"STOPPED", "CHOOSE", "FRAMES", "PAUSE", "WAIT_SYNC", "SIMPLE MOD"
};
-static const char *noYes[] = { "no", "yes" };
+static const char *const noYes[] = { "no", "yes" };
void Debugger::dumpCompact(uint16 cptId) {
uint16 type, size;
diff --git a/engines/sky/disk.cpp b/engines/sky/disk.cpp
index a06c5c9be8..99b707dcf1 100644
--- a/engines/sky/disk.cpp
+++ b/engines/sky/disk.cpp
@@ -32,8 +32,8 @@
namespace Sky {
-static const char *dataFilename = "sky.dsk";
-static const char *dinnerFilename = "sky.dnr";
+static const char *const dataFilename = "sky.dsk";
+static const char *const dinnerFilename = "sky.dnr";
Disk::Disk() {
_dataDiskHandle = new Common::File();
diff --git a/engines/sky/logic.cpp b/engines/sky/logic.cpp
index 616670b0fd..a69ba793f2 100644
--- a/engines/sky/logic.cpp
+++ b/engines/sky/logic.cpp
@@ -1248,6 +1248,17 @@ script:
debug(3, "Doing Script: %d:%d:%x", moduleNo, scriptNo & 0xFFF, offset ? (offset - moduleStart[scriptNo & 0xFFF]) : 0);
+ // WORKAROUND for bug #3149412: "Invalid Mode when giving shades to travel agent"
+ // Using the dark glasses on Trevor (travel agent) multiple times in succession would
+ // wreck the trevor compact's mode, as the script in question doesn't account for using
+ // this item at this point in the game (you will only have it here if you play the game
+ // in an unusual way) and thus would loop indefinitely / never drop out.
+ // To prevent this, we trigger the generic response by pretending we're using an item
+ // which the script /does/ handle.
+ if (scriptNo == TREVOR_SPEECH && _scriptVariables[OBJECT_HELD] == IDO_SHADES)
+ _scriptVariables[OBJECT_HELD] = IDO_GLASS;
+
+
// Check whether we have an offset or what
if (offset)
scriptData = moduleStart + offset;
diff --git a/engines/sky/sound.cpp b/engines/sky/sound.cpp
index e94a2a61d9..a60e3d9e38 100644
--- a/engines/sky/sound.cpp
+++ b/engines/sky/sound.cpp
@@ -872,7 +872,7 @@ static const Sfx fx_orifice_swallow_drip = {
}
};
-static const Sfx *musicList[] = {
+static const Sfx *const musicList[] = {
&fx_press_bang, // 256 banging of the press
&fx_press_hiss, // 257 hissing press
&fx_wind_howl, // 258 howling wind
diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp
index f19efd2635..324154f709 100644
--- a/engines/sword1/animation.cpp
+++ b/engines/sword1/animation.cpp
@@ -38,7 +38,7 @@
namespace Sword1 {
-static const char *sequenceList[20] = {
+static const char *const sequenceList[20] = {
"ferrari", // 0 CD2 ferrari running down fitz in sc19
"ladder", // 1 CD2 george walking down ladder to dig sc24->sc$
"steps", // 2 CD2 george walking down steps sc23->sc24
diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp
index 36d5a24e99..6e395116f9 100644
--- a/engines/sword1/control.cpp
+++ b/engines/sword1/control.cpp
@@ -122,8 +122,8 @@ ControlButton::ControlButton(uint16 x, uint16 y, uint32 resId, uint8 id, uint8 f
_width = (_width > SCREEN_WIDTH) ? SCREEN_WIDTH : _width;
_height = _resMan->getUint16(tmp->height);
if ((x == 0) && (y == 0)) { // center the frame (used for panels);
- _x = (((640 - _width) / 2) < 0)? 0 : ((640 - _width) / 2);
- _y = (((480 - _height) / 2) < 0)? 0 : ((480 - _height) / 2);
+ _x = (((640 - _width) / 2) < 0) ? 0 : ((640 - _width) / 2);
+ _y = (((480 - _height) / 2) < 0) ? 0 : ((480 - _height) / 2);
}
_dstBuf = screenBuf + _y * SCREEN_WIDTH + _x;
_system = system;
@@ -139,11 +139,11 @@ bool ControlButton::isSaveslot() {
void ControlButton::draw() {
FrameHeader *fHead = _resMan->fetchFrame(_resMan->fetchRes(_resId), _frameIdx);
- uint8 *src = (uint8*)fHead + sizeof(FrameHeader);
+ uint8 *src = (uint8 *)fHead + sizeof(FrameHeader);
uint8 *dst = _dstBuf;
if (SwordEngine::isPsx() && _resId) {
- uint8 *HIFbuf = (uint8*)malloc(_resMan->readUint16(&fHead->height) * _resMan->readUint16(&fHead->width));
+ uint8 *HIFbuf = (uint8 *)malloc(_resMan->readUint16(&fHead->height) * _resMan->readUint16(&fHead->width));
memset(HIFbuf, 0, _resMan->readUint16(&fHead->height) * _resMan->readUint16(&fHead->width));
Screen::decompressHIF(src, HIFbuf);
src = HIFbuf;
@@ -163,24 +163,24 @@ void ControlButton::draw() {
src += _resMan->readUint16(&fHead->width);
}
else if (_resId == SR_DEATHPANEL) { // Check for death panel psx version (which is 1/3 of original width)
- for (uint16 cnt = 0; cnt < _resMan->readUint16(&fHead->height)/2; cnt++) {
+ for (uint16 cnt = 0; cnt < _resMan->readUint16(&fHead->height) / 2; cnt++) {
//Stretched panel is bigger than 640px, check we don't draw outside screen
- for (uint16 cntx = 0; (cntx < (_resMan->readUint16(&fHead->width))/3) && (cntx < (SCREEN_WIDTH-3) ); cntx++)
+ for (uint16 cntx = 0; (cntx < (_resMan->readUint16(&fHead->width)) / 3) && (cntx < (SCREEN_WIDTH - 3)); cntx++)
if (src[cntx]) {
dst[cntx * 3] = src[cntx];
dst[cntx * 3 + 1] = src[cntx];
dst[cntx * 3 + 2] = src[cntx];
}
- dst+= SCREEN_WIDTH;
+ dst += SCREEN_WIDTH;
- for (uint16 cntx = 0; cntx < (_resMan->readUint16(&fHead->width))/3; cntx++)
+ for (uint16 cntx = 0; cntx < (_resMan->readUint16(&fHead->width)) / 3; cntx++)
if (src[cntx]) {
dst[cntx * 3] = src[cntx];
dst[cntx * 3 + 1] = src[cntx];
dst[cntx * 3 + 2] = src[cntx];
}
dst += SCREEN_WIDTH;
- src += _resMan->readUint16(&fHead->width)/3;
+ src += _resMan->readUint16(&fHead->width) / 3;
}
} else { //save slots needs to be multiplied by 2 in height
for (uint16 cnt = 0; cnt < _resMan->readUint16(&fHead->height); cnt++) {
@@ -198,7 +198,7 @@ void ControlButton::draw() {
}
dst += SCREEN_WIDTH;
- src += _resMan->readUint16(&fHead->width)/2;
+ src += _resMan->readUint16(&fHead->width) / 2;
}
}
@@ -242,13 +242,13 @@ Control::Control(Common::SaveFileManager *saveFileMan, ResMan *pResMan, ObjectMa
}
void Control::askForCd() {
- _screenBuf = (uint8*)malloc(640 * 480);
+ _screenBuf = (uint8 *)malloc(640 * 480);
uint32 fontId = SR_FONT;
if (SwordEngine::_systemVars.language == BS1_CZECH)
fontId = CZECH_SR_FONT;
- _font = (uint8*)_resMan->openFetchRes(fontId);
- uint8 *pal = (uint8*)_resMan->openFetchRes(SR_PALETTE);
- uint8 *palOut = (uint8*)malloc(256 * 3);
+ _font = (uint8 *)_resMan->openFetchRes(fontId);
+ uint8 *pal = (uint8 *)_resMan->openFetchRes(SR_PALETTE);
+ uint8 *palOut = (uint8 *)malloc(256 * 3);
for (uint16 cnt = 1; cnt < 256; cnt++) {
palOut[cnt * 3 + 0] = pal[cnt * 3 + 0] << 2;
palOut[cnt * 3 + 1] = pal[cnt * 3 + 1] << 2;
@@ -262,7 +262,7 @@ void Control::askForCd() {
char fName[10];
uint8 textA[50];
sprintf(fName, "cd%d.id", SwordEngine::_systemVars.currentCD);
- sprintf((char*)textA, "%s%d", _lStrings[STR_INSERT_CD_A], SwordEngine::_systemVars.currentCD);
+ sprintf((char *)textA, "%s%d", _lStrings[STR_INSERT_CD_A], SwordEngine::_systemVars.currentCD);
bool notAccepted = true;
bool refreshText = true;
do {
@@ -304,7 +304,7 @@ uint8 Control::runPanel() {
_restoreBuf = NULL;
_keyPressed.reset();
_numButtons = 0;
- _screenBuf = (uint8*)malloc(640 * 480);
+ _screenBuf = (uint8 *)malloc(640 * 480);
memset(_screenBuf, 0, 640 * 480);
_system->copyRectToScreen(_screenBuf, 640, 0, 0, 640, 480);
_sound->quitScreen();
@@ -314,11 +314,11 @@ uint8 Control::runPanel() {
fontId = CZECH_SR_FONT;
redFontId = CZECH_SR_REDFONT;
}
- _font = (uint8*)_resMan->openFetchRes(fontId);
- _redFont = (uint8*)_resMan->openFetchRes(redFontId);
+ _font = (uint8 *)_resMan->openFetchRes(fontId);
+ _redFont = (uint8 *)_resMan->openFetchRes(redFontId);
- uint8 *pal = (uint8*)_resMan->openFetchRes(SR_PALETTE);
- uint8 *palOut = (uint8*)malloc(256 * 3);
+ uint8 *pal = (uint8 *)_resMan->openFetchRes(SR_PALETTE);
+ uint8 *palOut = (uint8 *)malloc(256 * 3);
for (uint16 cnt = 1; cnt < 256; cnt++) {
palOut[cnt * 3 + 0] = pal[cnt * 3 + 0] << 2;
palOut[cnt * 3 + 1] = pal[cnt * 3 + 1] << 2;
@@ -491,7 +491,7 @@ uint8 Control::handleButtonClick(uint8 id, uint8 mode, uint8 *retVal) {
else
return mode;
} else if ((id == BUTTON_RESTORE_PANEL) || (id == BUTTON_SAVE_PANEL) ||
- (id == BUTTON_DONE) || (id == BUTTON_VOLUME_PANEL))
+ (id == BUTTON_DONE) || (id == BUTTON_VOLUME_PANEL))
return id;
else if (id == BUTTON_TEXT) {
SwordEngine::_systemVars.showText ^= 1;
@@ -641,14 +641,14 @@ void Control::handleVolumeClicks() {
clickDest = 2;
else if (ABS(mouseDiffY) <= 8) // right
clickDest = 3;
- else // lower right
+ else // lower right
clickDest = 4;
} else if (mouseDiffX < -8) { // left part
if (mouseDiffY < -8) // upper left
clickDest = 8;
else if (ABS(mouseDiffY) <= 8) // left
clickDest = 7;
- else // lower left
+ else // lower left
clickDest = 6;
} else { // middle
if (mouseDiffY < -8)
@@ -754,9 +754,9 @@ bool Control::getConfirm(const uint8 *title) {
bool Control::keyAccepted(uint16 ascii) {
static const char allowedSpecials[] = ",.:-()?! \"\'";
if (((ascii >= 'A') && (ascii <= 'Z')) ||
- ((ascii >= 'a') && (ascii <= 'z')) ||
- ((ascii >= '0') && (ascii <= '9')) ||
- strchr(allowedSpecials, ascii))
+ ((ascii >= 'a') && (ascii <= 'z')) ||
+ ((ascii >= '0') && (ascii <= '9')) ||
+ strchr(allowedSpecials, ascii))
return true;
else
return false;
@@ -792,7 +792,7 @@ void Control::readSavegameDescriptions() {
char saveName[40];
Common::String pattern = "sword1.???";
Common::StringArray filenames = _saveFileMan->listSavefiles(pattern);
- sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
+ sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
_saveNames.clear();
@@ -811,7 +811,7 @@ void Control::readSavegameDescriptions() {
num++;
Common::InSaveFile *in = _saveFileMan->openForLoading(*file);
if (in) {
- in->readUint32LE(); // header
+ in->readUint32LE(); // header
in->read(saveName, 40);
_saveNames.push_back(saveName);
delete in;
@@ -860,9 +860,9 @@ void Control::checkForOldSaveGames() {
}
GUI::MessageDialog dialog0(
- _("ScummVM found that you have old savefiles for Broken Sword 1 that should be converted.\n"
- "The old save game format is no longer supported, so you will not be able to load your games if you don't convert them.\n\n"
- "Press OK to convert them now, otherwise you will be asked again the next time you start the game.\n"), _("OK"), _("Cancel"));
+ _("ScummVM found that you have old savefiles for Broken Sword 1 that should be converted.\n"
+ "The old save game format is no longer supported, so you will not be able to load your games if you don't convert them.\n\n"
+ "Press OK to convert them now, otherwise you will be asked again the next time you start the game.\n"), _("OK"), _("Cancel"));
int choice = dialog0.runModal();
if (choice == GUI::kMessageCancel) {
@@ -889,8 +889,8 @@ void Control::checkForOldSaveGames() {
}
} while ((ch != 10) && (ch != 255) && (!inf->eos()));
- if (pos > 1) // if the slot has a description
- convertSaveGame(slot, (char*)saveName);
+ if (pos > 1) // if the slot has a description
+ convertSaveGame(slot, (char *)saveName);
slot++;
} while ((ch != 255) && (!inf->eos()));
@@ -906,12 +906,12 @@ void Control::showSavegameNames() {
uint8 textMode = TEXT_LEFT_ALIGN;
uint16 ycoord = _saveButtons[cnt].y + 2;
uint8 str[40];
- sprintf((char*)str, "%d. %s", cnt + _saveScrollPos + 1, _saveNames[cnt + _saveScrollPos].c_str());
+ sprintf((char *)str, "%d. %s", cnt + _saveScrollPos + 1, _saveNames[cnt + _saveScrollPos].c_str());
if (cnt + _saveScrollPos == _selectedSavegame) {
textMode |= TEXT_RED_FONT;
ycoord += 2;
if (_cursorVisible)
- strcat((char*)str, "_");
+ strcat((char *)str, "_");
}
renderText(str, _saveButtons[cnt].x + 6, ycoord, textMode);
}
@@ -1013,7 +1013,7 @@ void Control::renderText(const uint8 *str, uint16 x, uint16 y, uint8 mode) {
uint8 *dst = _screenBuf + y * SCREEN_WIDTH + destX;
FrameHeader *chSpr = _resMan->fetchFrame(font, *str - 32);
- uint8 *sprData = (uint8*)chSpr + sizeof(FrameHeader);
+ uint8 *sprData = (uint8 *)chSpr + sizeof(FrameHeader);
uint8 *HIFbuf = NULL;
if (SwordEngine::isPsx()) { //Text fonts are compressed in psx version
@@ -1056,7 +1056,7 @@ void Control::renderVolumeBar(uint8 id, uint8 volL, uint8 volR) {
uint8 vol = (chCnt == 0) ? volL : volR;
FrameHeader *frHead = _resMan->fetchFrame(_resMan->openFetchRes(SR_VLIGHT), (vol + 15) >> 4);
uint8 *destMem = _screenBuf + destY * SCREEN_WIDTH + destX;
- uint8 *srcMem = (uint8*)frHead + sizeof(FrameHeader);
+ uint8 *srcMem = (uint8 *)frHead + sizeof(FrameHeader);
uint16 barHeight = _resMan->getUint16(frHead->height);
uint8 *psxVolBuf = NULL;
@@ -1135,7 +1135,7 @@ void Control::saveGameToFile(uint8 slot) {
outf->writeUint32LE(Logic::_scriptVars[cnt]);
uint32 playerSize = (sizeof(Object) - 12000) / 4;
- uint32 *playerRaw = (uint32*)cpt;
+ uint32 *playerRaw = (uint32 *)cpt;
for (uint32 cnt2 = 0; cnt2 < playerSize; cnt2++)
outf->writeUint32LE(playerRaw[cnt2]);
outf->finalize();
@@ -1163,7 +1163,7 @@ bool Control::restoreGameFromFile(uint8 slot) {
return false;
}
- inf->skip(40); // skip description
+ inf->skip(40); // skip description
uint8 saveVersion = inf->readByte();
if (saveVersion > SAVEGAME_VERSION) {
@@ -1176,8 +1176,8 @@ bool Control::restoreGameFromFile(uint8 slot) {
Graphics::skipThumbnail(*inf);
- inf->readUint32BE(); // save date
- inf->readUint16BE(); // save time
+ inf->readUint32BE(); // save date
+ inf->readUint16BE(); // save time
if (saveVersion < 2) { // Before version 2 we didn't had play time feature
g_engine->setTotalPlayTime(0);
@@ -1185,14 +1185,14 @@ bool Control::restoreGameFromFile(uint8 slot) {
g_engine->setTotalPlayTime(inf->readUint32BE() * 1000);
}
- _restoreBuf = (uint8*)malloc(
- TOTAL_SECTIONS * 2 +
- NUM_SCRIPT_VARS * 4 +
- (sizeof(Object) - 12000));
+ _restoreBuf = (uint8 *)malloc(
+ TOTAL_SECTIONS * 2 +
+ NUM_SCRIPT_VARS * 4 +
+ (sizeof(Object) - 12000));
- uint16 *liveBuf = (uint16*)_restoreBuf;
- uint32 *scriptBuf = (uint32*)(_restoreBuf + 2 * TOTAL_SECTIONS);
- uint32 *playerBuf = (uint32*)(_restoreBuf + 2 * TOTAL_SECTIONS + 4 * NUM_SCRIPT_VARS);
+ uint16 *liveBuf = (uint16 *)_restoreBuf;
+ uint32 *scriptBuf = (uint32 *)(_restoreBuf + 2 * TOTAL_SECTIONS);
+ uint32 *playerBuf = (uint32 *)(_restoreBuf + 2 * TOTAL_SECTIONS + 4 * NUM_SCRIPT_VARS);
for (cnt = 0; cnt < TOTAL_SECTIONS; cnt++)
liveBuf[cnt] = inf->readUint16LE();
@@ -1215,7 +1215,7 @@ bool Control::restoreGameFromFile(uint8 slot) {
return true;
}
-bool Control::convertSaveGame(uint8 slot, char* desc) {
+bool Control::convertSaveGame(uint8 slot, char *desc) {
char oldFileName[15];
char newFileName[40];
sprintf(oldFileName, "SAVEGAME.%03d", slot);
@@ -1230,8 +1230,8 @@ bool Control::convertSaveGame(uint8 slot, char* desc) {
delete testSave;
Common::String msg = Common::String::format(_("Target new save game already exists!\n"
- "Would you like to keep the old save game (%s) or the new one (%s)?\n"),
- oldFileName, newFileName);
+ "Would you like to keep the old save game (%s) or the new one (%s)?\n"),
+ oldFileName, newFileName);
GUI::MessageDialog dialog0(msg, _("Keep the old one"), _("Keep the new one"));
int choice = dialog0.runModal();
@@ -1299,17 +1299,17 @@ bool Control::convertSaveGame(uint8 slot, char* desc) {
void Control::doRestore() {
uint8 *bufPos = _restoreBuf;
- _objMan->loadLiveList((uint16*)bufPos);
+ _objMan->loadLiveList((uint16 *)bufPos);
bufPos += TOTAL_SECTIONS * 2;
for (uint16 cnt = 0; cnt < NUM_SCRIPT_VARS; cnt++) {
- Logic::_scriptVars[cnt] = *(uint32*)bufPos;
+ Logic::_scriptVars[cnt] = *(uint32 *)bufPos;
bufPos += 4;
}
uint32 playerSize = (sizeof(Object) - 12000) / 4;
- uint32 *playerRaw = (uint32*)_objMan->fetchObject(PLAYER);
+ uint32 *playerRaw = (uint32 *)_objMan->fetchObject(PLAYER);
Object *cpt = _objMan->fetchObject(PLAYER);
for (uint32 cnt2 = 0; cnt2 < playerSize; cnt2++) {
- *playerRaw = *(uint32*)bufPos;
+ *playerRaw = *(uint32 *)bufPos;
playerRaw++;
bufPos += 4;
}
diff --git a/engines/sword1/control.h b/engines/sword1/control.h
index c3550e6f02..a80ea05b03 100644
--- a/engines/sword1/control.h
+++ b/engines/sword1/control.h
@@ -101,7 +101,7 @@ public:
private:
int displayMessage(const char *altButton, const char *message, ...) GCC_PRINTF(3, 4);
- bool convertSaveGame(uint8 slot, char* desc);
+ bool convertSaveGame(uint8 slot, char *desc);
void showSavegameNames();
void deselectSaveslots();
uint8 *_restoreBuf;
@@ -142,7 +142,7 @@ private:
ControlButton *_buttons[MAX_BUTTONS];
static const ButtonInfo _deathButtons[3], _panelButtons[7], _saveButtons[16], _volumeButtons[4];
static const uint8 _languageStrings[8 * 20][43];
- const uint8 (*_lStrings)[43];
+ const uint8(*_lStrings)[43];
Common::SaveFileManager *_saveFileMan;
ObjectMan *_objMan;
ResMan *_resMan;
diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp
index 4da636bce9..e4c068e667 100644
--- a/engines/sword1/detection.cpp
+++ b/engines/sword1/detection.cpp
@@ -48,7 +48,7 @@ static const PlainGameDescriptor sword1PSXDemoSettings =
// check these subdirectories (if present)
-static const char *g_dirNames[] = { "clusters", "speech", "english", "italian"};
+static const char *const g_dirNames[] = { "clusters", "speech", "english", "italian"};
#define NUM_COMMON_FILES_TO_CHECK 1
#define NUM_PC_FILES_TO_CHECK 3
@@ -59,7 +59,7 @@ static const char *g_dirNames[] = { "clusters", "speech", "english", "italian"};
#define NUM_MAC_DEMO_FILES_TO_CHECK 1
#define NUM_FILES_TO_CHECK NUM_COMMON_FILES_TO_CHECK + NUM_PC_FILES_TO_CHECK + NUM_MAC_FILES_TO_CHECK + NUM_PSX_FILES_TO_CHECK + NUM_DEMO_FILES_TO_CHECK + NUM_MAC_DEMO_FILES_TO_CHECK + NUM_PSX_DEMO_FILES_TO_CHECK
-static const char *g_filesToCheck[NUM_FILES_TO_CHECK] = { // these files have to be found
+static const char *const g_filesToCheck[NUM_FILES_TO_CHECK] = { // these files have to be found
"swordres.rif", // Mac, PC and PSX version
"general.clu", // PC and PSX version
"compacts.clu", // PC and PSX version
@@ -68,7 +68,7 @@ static const char *g_filesToCheck[NUM_FILES_TO_CHECK] = { // these files have to
"compacts.clm", // Mac version only
"scripts.clm", // Mac version only
"paris2.clm", // Mac version (full game only)
- "cows.mad", // this one should only exist in the demo version
+ "cows.mad", // this one should only exist in the demo version
"scripts.clm", // Mac version both demo and full game
"train.plx", // PSX version only
"speech.dat", // PSX version only
@@ -99,20 +99,20 @@ public:
bool SwordMetaEngine::hasFeature(MetaEngineFeature f) const {
return
- (f == kSupportsListSaves) ||
- (f == kSupportsLoadingDuringStartup) ||
- (f == kSupportsDeleteSave) ||
- (f == kSavesSupportMetaInfo) ||
- (f == kSavesSupportThumbnail) ||
- (f == kSavesSupportCreationDate) ||
- (f == kSavesSupportPlayTime);
+ (f == kSupportsListSaves) ||
+ (f == kSupportsLoadingDuringStartup) ||
+ (f == kSupportsDeleteSave) ||
+ (f == kSavesSupportMetaInfo) ||
+ (f == kSavesSupportThumbnail) ||
+ (f == kSavesSupportCreationDate) ||
+ (f == kSavesSupportPlayTime);
}
bool Sword1::SwordEngine::hasFeature(EngineFeature f) const {
return
- (f == kSupportsRTL) ||
- (f == kSupportsSavingDuringRuntime) ||
- (f == kSupportsLoadingDuringRuntime);
+ (f == kSupportsRTL) ||
+ (f == kSupportsSavingDuringRuntime) ||
+ (f == kSupportsLoadingDuringRuntime);
}
GameList SwordMetaEngine::getSupportedGames() const {
@@ -225,7 +225,7 @@ SaveStateList SwordMetaEngine::listSaves(const char *target) const {
char saveName[40];
Common::StringArray filenames = saveFileMan->listSavefiles("sword1.???");
- sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
+ sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
int slotNum = 0;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
@@ -235,7 +235,7 @@ SaveStateList SwordMetaEngine::listSaves(const char *target) const {
if (slotNum >= 0 && slotNum <= 999) {
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
if (in) {
- in->readUint32LE(); // header
+ in->readUint32LE(); // header
in->read(saveName, 40);
saveList.push_back(SaveStateDescriptor(slotNum, saveName));
delete in;
@@ -261,9 +261,9 @@ SaveStateDescriptor SwordMetaEngine::querySaveMetaInfos(const char *target, int
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(fileName);
if (in) {
- in->skip(4); // header
+ in->skip(4); // header
in->read(name, sizeof(name));
- in->read(&versionSave, 1); // version
+ in->read(&versionSave, 1); // version
SaveStateDescriptor desc(slot, name);
@@ -323,7 +323,7 @@ Common::Error SwordEngine::loadGameState(int slot) {
reinitialize();
_control->doRestore();
reinitRes();
- return Common::kNoError; // TODO: return success/failure
+ return Common::kNoError; // TODO: return success/failure
}
bool SwordEngine::canLoadGameStateCurrently() {
@@ -333,7 +333,7 @@ bool SwordEngine::canLoadGameStateCurrently() {
Common::Error SwordEngine::saveGameState(int slot, const Common::String &desc) {
_control->setSaveDescription(slot, desc.c_str());
_control->saveGameToFile(slot);
- return Common::kNoError; // TODO: return success/failure
+ return Common::kNoError; // TODO: return success/failure
}
bool SwordEngine::canSaveGameStateCurrently() {
diff --git a/engines/sword1/eventman.cpp b/engines/sword1/eventman.cpp
index d95adebd86..113151bfd5 100644
--- a/engines/sword1/eventman.cpp
+++ b/engines/sword1/eventman.cpp
@@ -44,14 +44,14 @@ void EventManager::checkForEvent(Object *compact) {
if (compact->o_event_list[objCnt].o_event)
for (uint8 globCnt = 0; globCnt < TOTAL_EVENT_SLOTS; globCnt++) {
if (_eventPendingList[globCnt].delay &&
- (_eventPendingList[globCnt].eventNumber == compact->o_event_list[objCnt].o_event)) {
- compact->o_logic = LOGIC_script; //force into script mode
- _eventPendingList[globCnt].delay = 0; //started, so remove from queue
- compact->o_tree.o_script_level++;
- compact->o_tree.o_script_id[compact->o_tree.o_script_level] =
- compact->o_event_list[objCnt].o_event_script;
- compact->o_tree.o_script_pc[compact->o_tree.o_script_level] =
- compact->o_event_list[objCnt].o_event_script;
+ (_eventPendingList[globCnt].eventNumber == compact->o_event_list[objCnt].o_event)) {
+ compact->o_logic = LOGIC_script; //force into script mode
+ _eventPendingList[globCnt].delay = 0; //started, so remove from queue
+ compact->o_tree.o_script_level++;
+ compact->o_tree.o_script_id[compact->o_tree.o_script_level] =
+ compact->o_event_list[objCnt].o_event_script;
+ compact->o_tree.o_script_pc[compact->o_tree.o_script_level] =
+ compact->o_event_list[objCnt].o_event_script;
}
}
}
@@ -60,7 +60,7 @@ void EventManager::checkForEvent(Object *compact) {
bool EventManager::eventValid(int32 event) {
for (uint8 slot = 0; slot < TOTAL_EVENT_SLOTS; slot++)
if ((_eventPendingList[slot].eventNumber == event) &&
- (_eventPendingList[slot].delay))
+ (_eventPendingList[slot].delay))
return true;
return false;
}
@@ -76,15 +76,15 @@ int EventManager::fnCheckForEvent(Object *cpt, int32 id, int32 pause) {
if (cpt->o_event_list[objCnt].o_event)
for (uint8 globCnt = 0; globCnt < TOTAL_EVENT_SLOTS; globCnt++) {
if (_eventPendingList[globCnt].delay &&
- (_eventPendingList[globCnt].eventNumber == cpt->o_event_list[objCnt].o_event)) {
- cpt->o_logic = LOGIC_script; //force into script mode
- _eventPendingList[globCnt].delay = 0; //started, so remove from queue
- cpt->o_tree.o_script_level++;
- cpt->o_tree.o_script_id[cpt->o_tree.o_script_level] =
- cpt->o_event_list[objCnt].o_event_script;
- cpt->o_tree.o_script_pc[cpt->o_tree.o_script_level] =
- cpt->o_event_list[objCnt].o_event_script;
- return SCRIPT_STOP;
+ (_eventPendingList[globCnt].eventNumber == cpt->o_event_list[objCnt].o_event)) {
+ cpt->o_logic = LOGIC_script; //force into script mode
+ _eventPendingList[globCnt].delay = 0; //started, so remove from queue
+ cpt->o_tree.o_script_level++;
+ cpt->o_tree.o_script_id[cpt->o_tree.o_script_level] =
+ cpt->o_event_list[objCnt].o_event_script;
+ cpt->o_tree.o_script_pc[cpt->o_tree.o_script_level] =
+ cpt->o_event_list[objCnt].o_event_script;
+ return SCRIPT_STOP;
}
}
}
diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp
index 5b42c9340e..d1c69c80ff 100644
--- a/engines/sword1/logic.cpp
+++ b/engines/sword1/logic.cpp
@@ -89,14 +89,14 @@ void Logic::initialize() {
delete _textMan;
_textMan = new Text(_objMan, _resMan,
- (SwordEngine::_systemVars.language == BS1_CZECH) ? true : false);
+ (SwordEngine::_systemVars.language == BS1_CZECH) ? true : false);
_screen->useTextManager(_textMan);
_textRunning = _speechRunning = false;
_speechFinished = true;
}
void Logic::newScreen(uint32 screen) {
- Object *compact = (Object*)_objMan->fetchObject(PLAYER);
+ Object *compact = (Object *)_objMan->fetchObject(PLAYER);
// work around script bug #911508
if (((screen == 25) || (_scriptVars[SCREEN] == 25)) && (_scriptVars[SAND_FLAG] == 4)) {
@@ -115,15 +115,15 @@ void Logic::newScreen(uint32 screen) {
if (SwordEngine::_systemVars.justRestoredGame) { // if we've just restored a game - we want George to be exactly as saved
fnAddHuman(NULL, 0, 0, 0, 0, 0, 0, 0);
if (_scriptVars[GEORGE_WALKING]) { // except that if George was walking when we saveed the game
- fnStandAt(compact, PLAYER, _scriptVars[CHANGE_X], _scriptVars[CHANGE_Y], _scriptVars[CHANGE_DIR], _scriptVars[CHANGE_STANCE], 0,0);
- fnIdle(compact,PLAYER,0,0,0,0,0,0);
+ fnStandAt(compact, PLAYER, _scriptVars[CHANGE_X], _scriptVars[CHANGE_Y], _scriptVars[CHANGE_DIR], _scriptVars[CHANGE_STANCE], 0, 0);
+ fnIdle(compact, PLAYER, 0, 0, 0, 0, 0, 0);
_scriptVars[GEORGE_WALKING] = 0;
}
SwordEngine::_systemVars.justRestoredGame = 0;
_music->startMusic(_scriptVars[CURRENT_MUSIC], 1);
} else { // if we haven't just restored a game, set George to stand, etc
compact->o_screen = _scriptVars[NEW_SCREEN]; //move the mega/player at this point between screens
- fnStandAt(compact, PLAYER, _scriptVars[CHANGE_X], _scriptVars[CHANGE_Y], _scriptVars[CHANGE_DIR], _scriptVars[CHANGE_STANCE], 0,0);
+ fnStandAt(compact, PLAYER, _scriptVars[CHANGE_X], _scriptVars[CHANGE_Y], _scriptVars[CHANGE_DIR], _scriptVars[CHANGE_STANCE], 0, 0);
fnChangeFloor(compact, PLAYER, _scriptVars[CHANGE_PLACE], 0, 0, 0, 0, 0);
}
}
@@ -227,7 +227,7 @@ void Logic::processLogic(Object *compact, uint32 id) {
case LOGIC_restart:
compact->o_tree.o_script_pc[compact->o_tree.o_script_level] = compact->o_tree.o_script_id[compact->o_tree.o_script_level];
compact->o_logic = LOGIC_script;
- logicRet=1;
+ logicRet = 1;
break;
case LOGIC_bookmark:
memcpy(&(compact->o_tree.o_script_level), &(compact->o_bookmark.o_script_level), sizeof(ScriptTree));
@@ -293,41 +293,41 @@ int Logic::logicArAnimate(Object *compact, uint32 id) {
compact->o_status |= STAT_SHRINK;
route = compact->o_route;
- walkPc =compact->o_walk_pc;
- compact->o_frame =route[walkPc].frame;
- compact->o_dir =route[walkPc].dir;
- compact->o_xcoord =route[walkPc].x;
- compact->o_ycoord =route[walkPc].y;
- compact->o_anim_x =compact->o_xcoord;
- compact->o_anim_y =compact->o_ycoord;
+ walkPc = compact->o_walk_pc;
+ compact->o_frame = route[walkPc].frame;
+ compact->o_dir = route[walkPc].dir;
+ compact->o_xcoord = route[walkPc].x;
+ compact->o_ycoord = route[walkPc].y;
+ compact->o_anim_x = compact->o_xcoord;
+ compact->o_anim_y = compact->o_ycoord;
if (((_scriptVars[GEORGE_WALKING] == 2) && (walkPc > 5) && (id == PLAYER) &&
- (route[walkPc - 1].step == 5) && (route[walkPc].step == 0)) ||
- ((_scriptVars[GEORGE_WALKING] == 3) && (id == PLAYER))) {
-
- compact->o_frame = 96 + compact->o_dir; //reset
- if ((compact->o_dir != 2) && (compact->o_dir != 6)) { // on verticals and diagonals stand where george is
- compact->o_xcoord = route[walkPc - 1].x;
- compact->o_ycoord = route[walkPc - 1].y;
- compact->o_anim_x = compact->o_xcoord;
- compact->o_anim_y = compact->o_ycoord;
- }
- compact->o_logic = LOGIC_script;
- compact->o_down_flag = 0; //0 means error
- _scriptVars[GEORGE_WALKING] = 0;
- route[compact->o_walk_pc+1].frame = 512; //end of sequence
- if (_scriptVars[MEGA_ON_GRID] == 2)
- _scriptVars[MEGA_ON_GRID] = 0;
+ (route[walkPc - 1].step == 5) && (route[walkPc].step == 0)) ||
+ ((_scriptVars[GEORGE_WALKING] == 3) && (id == PLAYER))) {
+
+ compact->o_frame = 96 + compact->o_dir; //reset
+ if ((compact->o_dir != 2) && (compact->o_dir != 6)) { // on verticals and diagonals stand where george is
+ compact->o_xcoord = route[walkPc - 1].x;
+ compact->o_ycoord = route[walkPc - 1].y;
+ compact->o_anim_x = compact->o_xcoord;
+ compact->o_anim_y = compact->o_ycoord;
+ }
+ compact->o_logic = LOGIC_script;
+ compact->o_down_flag = 0; //0 means error
+ _scriptVars[GEORGE_WALKING] = 0;
+ route[compact->o_walk_pc + 1].frame = 512; //end of sequence
+ if (_scriptVars[MEGA_ON_GRID] == 2)
+ _scriptVars[MEGA_ON_GRID] = 0;
}
compact->o_walk_pc++;
- if (route[compact->o_walk_pc].frame == 512) { //end of sequence
+ if (route[compact->o_walk_pc].frame == 512) { //end of sequence
compact->o_logic = LOGIC_script;
if (((_scriptVars[GEORGE_WALKING] == 2) || (_scriptVars[GEORGE_WALKING] == 1)) &&
- (id == PLAYER)) {
- _scriptVars[GEORGE_WALKING] = 0;
- if (_scriptVars[MEGA_ON_GRID] == 2)
- _scriptVars[MEGA_ON_GRID] = 0;
+ (id == PLAYER)) {
+ _scriptVars[GEORGE_WALKING] = 0;
+ if (_scriptVars[MEGA_ON_GRID] == 2)
+ _scriptVars[MEGA_ON_GRID] = 0;
}
}
return 0;
@@ -360,16 +360,16 @@ int Logic::speechDriver(Object *compact) {
_speechFinished = true;
}
if (compact->o_anim_resource) {
- uint8 *animData = ((uint8*)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
+ uint8 *animData = ((uint8 *)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
int32 numFrames = _resMan->readUint32(animData);
animData += 4;
compact->o_anim_pc++; // go to next frame of anim
if (_speechFinished || (compact->o_anim_pc >= numFrames) ||
- (_speechRunning && (_sound->amISpeaking() == 0)))
- compact->o_anim_pc = 0; //set to frame 0, closed mouth
+ (_speechRunning && (_sound->amISpeaking() == 0)))
+ compact->o_anim_pc = 0; //set to frame 0, closed mouth
- AnimUnit *animPtr = (AnimUnit*)(animData + sizeof(AnimUnit) * compact->o_anim_pc);
+ AnimUnit *animPtr = (AnimUnit *)(animData + sizeof(AnimUnit) * compact->o_anim_pc);
if (!(compact->o_status & STAT_SHRINK)) {
compact->o_anim_x = _resMan->getUint32(animPtr->animX);
compact->o_anim_y = _resMan->getUint32(animPtr->animY);
@@ -385,10 +385,10 @@ int Logic::fullAnimDriver(Object *compact) {
compact->o_logic = LOGIC_script;
return 1;
}
- uint8 *data = ((uint8*)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
+ uint8 *data = ((uint8 *)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
uint32 numFrames = _resMan->readUint32(data);
data += 4;
- AnimUnit *animPtr = (AnimUnit*)(data + compact->o_anim_pc * sizeof(AnimUnit));
+ AnimUnit *animPtr = (AnimUnit *)(data + compact->o_anim_pc * sizeof(AnimUnit));
compact->o_anim_x = compact->o_xcoord = _resMan->getUint32(animPtr->animX);
compact->o_anim_y = compact->o_ycoord = _resMan->getUint32(animPtr->animY);
@@ -407,9 +407,9 @@ int Logic::animDriver(Object *compact) {
compact->o_logic = LOGIC_script;
return 1;
}
- uint8 *data = ((uint8*)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
+ uint8 *data = ((uint8 *)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
uint32 numFrames = _resMan->readUint32(data);
- AnimUnit *animPtr = (AnimUnit*)(data + 4 + compact->o_anim_pc * sizeof(AnimUnit));
+ AnimUnit *animPtr = (AnimUnit *)(data + 4 + compact->o_anim_pc * sizeof(AnimUnit));
if (!(compact->o_status & STAT_SHRINK)) {
compact->o_anim_x = _resMan->getUint32(animPtr->animX);
@@ -426,9 +426,9 @@ int Logic::animDriver(Object *compact) {
}
void Logic::updateScreenParams() {
- Object *compact = (Object*)_objMan->fetchObject(PLAYER);
+ Object *compact = (Object *)_objMan->fetchObject(PLAYER);
_screen->setScrolling((int16)(compact->o_xcoord - _scriptVars[FEET_X]),
- (int16)(compact->o_ycoord - _scriptVars[FEET_Y]));
+ (int16)(compact->o_ycoord - _scriptVars[FEET_Y]));
}
int Logic::scriptManager(Object *compact, uint32 id) {
@@ -465,7 +465,7 @@ void Logic::runMouseScript(Object *cpt, int32 scriptId) {
}
int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int scriptBase, int scriptNum) {
- int32 *scriptCode = (int32*)(((uint8*)scriptModule) + sizeof(Header));
+ int32 *scriptCode = (int32 *)(((uint8 *)scriptModule) + sizeof(Header));
int32 stack[MAX_STACK_SIZE];
int32 stackIdx = 0;
int32 offset;
@@ -609,7 +609,7 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
debug(9, "IT_SCRIPTEND");
return 0;
case IT_POPVAR: // pop a variable
- debug(9, "IT_POPVAR: ScriptVars[%d] = %d", scriptCode[pc], stack[stackIdx-1]);
+ debug(9, "IT_POPVAR: ScriptVars[%d] = %d", scriptCode[pc], stack[stackIdx - 1]);
varNum = scriptCode[pc++];
if (SwordEngine::_systemVars.isDemo && SwordEngine::isPc()) {
if (varNum >= 397) // BS1 Demo has different number of script variables
@@ -622,15 +622,15 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
case IT_POPLONGOFFSET:
offset = scriptCode[pc++];
debug(9, "IT_POPLONGOFFSET: Cpt[%d] = %d", offset, stack[stackIdx - 1]);
- *((int32 *)((uint8*)compact + offset)) = stack[--stackIdx];
+ *((int32 *)((uint8 *)compact + offset)) = stack[--stackIdx];
break;
case IT_PUSHLONGOFFSET:
offset = scriptCode[pc++];
- debug(9, "IT_PUSHLONGOFFSET: PUSH Cpt[%d] (==%d)", offset, *((int32 *)((uint8*)compact + offset)));
- stack[stackIdx++] = *((int32 *)((uint8*)compact + offset));
+ debug(9, "IT_PUSHLONGOFFSET: PUSH Cpt[%d] (==%d)", offset, *((int32 *)((uint8 *)compact + offset)));
+ stack[stackIdx++] = *((int32 *)((uint8 *)compact + offset));
break;
case IT_SKIPONFALSE:
- debug(9, "IT_SKIPONFALSE: %d (%s)", scriptCode[pc], (stack[stackIdx-1] ? "IS TRUE (NOT SKIPPED)" : "IS FALSE (SKIPPED)"));
+ debug(9, "IT_SKIPONFALSE: %d (%s)", scriptCode[pc], (stack[stackIdx - 1] ? "IS TRUE (NOT SKIPPED)" : "IS FALSE (SKIPPED)"));
if (stack[--stackIdx])
pc++;
else
@@ -645,12 +645,12 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
{
int switchValue = stack[--stackIdx];
int switchCount = scriptCode[pc++];
- int doneSwitch=0;
+ int doneSwitch = 0;
- for (int cnt = 0; (cnt < switchCount) && (doneSwitch==0); cnt++) {
+ for (int cnt = 0; (cnt < switchCount) && (doneSwitch == 0); cnt++) {
if (switchValue == scriptCode[pc]) {
- pc += scriptCode[pc+1];
- doneSwitch=1;
+ pc += scriptCode[pc + 1];
+ doneSwitch = 1;
} else
pc += 2;
}
@@ -659,7 +659,7 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
}
break;
case IT_SKIPONTRUE: // skip if expression true
- debug(9, "IT_SKIPONTRUE: %d (%s)", scriptCode[pc], (stack[stackIdx-1] ? "IS TRUE (SKIPPED)" : "IS FALSE (NOT SKIPPED)"));
+ debug(9, "IT_SKIPONTRUE: %d (%s)", scriptCode[pc], (stack[stackIdx - 1] ? "IS TRUE (SKIPPED)" : "IS FALSE (NOT SKIPPED)"));
stackIdx--;
if (stack[stackIdx])
pc += scriptCode[pc];
@@ -667,7 +667,7 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
pc++;
break;
case IT_PRINTF:
- debug(0, "IT_PRINTF(%d)",stack[stackIdx]);
+ debug(0, "IT_PRINTF(%d)", stack[stackIdx]);
break;
case IT_RESTARTSCRIPT:
debug(9, "IT_RESTARTSCRIPT");
@@ -676,16 +676,16 @@ int Logic::interpretScript(Object *compact, int id, Header *scriptModule, int sc
case IT_POPWORDOFFSET:
offset = scriptCode[pc++];
debug(9, "IT_POPWORDOFFSET: Cpt[%d] = %d", offset, stack[stackIdx - 1] & 0xFFFF);
- *((int32 *)((uint8*)compact + offset)) = stack[--stackIdx] & 0xffff;
+ *((int32 *)((uint8 *)compact + offset)) = stack[--stackIdx] & 0xffff;
break;
case IT_PUSHWORDOFFSET:
offset = scriptCode[pc++];
- debug(9, "IT_PUSHWORDOFFSET: PUSH Cpt[%d] == %d", offset, (*((int32 *)((uint8*)compact + offset))) & 0xffff);
- stack[stackIdx++] = (*((int32 *)((uint8*)compact + offset))) & 0xffff;
+ debug(9, "IT_PUSHWORDOFFSET: PUSH Cpt[%d] == %d", offset, (*((int32 *)((uint8 *)compact + offset))) & 0xffff);
+ stack[stackIdx++] = (*((int32 *)((uint8 *)compact + offset))) & 0xffff;
break;
default:
- error("Invalid operator %d",scriptCode[pc-1]);
- return 0; // for compilers that don't support NORETURN
+ error("Invalid operator %d", scriptCode[pc - 1]);
+ return 0; // for compilers that don't support NORETURN
}
}
}
@@ -831,7 +831,7 @@ int Logic::fnAnim(Object *cpt, int32 id, int32 cdt, int32 spr, int32 e, int32 f,
AnimSet *animTab;
if (cdt && (!spr)) {
- animTab = (AnimSet*)((uint8*)_resMan->openFetchRes(cdt) + sizeof(Header));
+ animTab = (AnimSet *)((uint8 *)_resMan->openFetchRes(cdt) + sizeof(Header));
animTab += cpt->o_dir;
cpt->o_anim_resource = _resMan->getUint32(animTab->cdt);
@@ -865,13 +865,13 @@ int Logic::fnSetFrame(Object *cpt, int32 id, int32 cdt, int32 spr, int32 frameNo
AnimUnit *animPtr;
- uint8 *data = (uint8*)_resMan->openFetchRes(cdt);
+ uint8 *data = (uint8 *)_resMan->openFetchRes(cdt);
data += sizeof(Header);
if (frameNo == LAST_FRAME)
frameNo = _resMan->readUint32(data) - 1;
data += 4;
- animPtr = (AnimUnit*)(data + frameNo * sizeof(AnimUnit));
+ animPtr = (AnimUnit *)(data + frameNo * sizeof(AnimUnit));
cpt->o_anim_x = _resMan->getUint32(animPtr->animX);
cpt->o_anim_y = _resMan->getUint32(animPtr->animY);
@@ -895,13 +895,13 @@ int Logic::fnFullAnim(Object *cpt, int32 id, int32 anim, int32 graphic, int32 e,
}
int Logic::fnFullSetFrame(Object *cpt, int32 id, int32 cdt, int32 spr, int32 frameNo, int32 f, int32 z, int32 x) {
- uint8 *data = (uint8*)_resMan->openFetchRes(cdt) + sizeof(Header);
+ uint8 *data = (uint8 *)_resMan->openFetchRes(cdt) + sizeof(Header);
if (frameNo == LAST_FRAME)
frameNo = _resMan->readUint32(data) - 1;
data += 4;
- AnimUnit *animPtr = (AnimUnit*)(data + sizeof(AnimUnit) * frameNo);
+ AnimUnit *animPtr = (AnimUnit *)(data + sizeof(AnimUnit) * frameNo);
cpt->o_anim_x = cpt->o_xcoord = _resMan->getUint32(animPtr->animX);
cpt->o_anim_y = cpt->o_ycoord = _resMan->getUint32(animPtr->animY);
cpt->o_frame = _resMan->getUint32(animPtr->animFrame);
@@ -1115,7 +1115,7 @@ int Logic::fnISpeak(Object *cpt, int32 id, int32 cdt, int32 textNo, int32 spr, i
// first setup the talk animation
if (cdt && (!spr)) { // if 'cdt' is non-zero but 'spr' is zero - 'cdt' is an anim table tag
- AnimSet *animTab = (AnimSet*)((uint8*)_resMan->openFetchRes(cdt) + sizeof(Header));
+ AnimSet *animTab = (AnimSet *)((uint8 *)_resMan->openFetchRes(cdt) + sizeof(Header));
animTab += cpt->o_dir;
cpt->o_anim_resource = _resMan->getUint32(animTab->cdt);
@@ -1152,10 +1152,10 @@ int Logic::fnISpeak(Object *cpt, int32 id, int32 cdt, int32 textNo, int32 spr, i
char *text = _objMan->lockText(textNo);
cpt->o_speech_time = strlen(text) + 5;
- uint32 textCptId = _textMan->lowTextManager((uint8*)text, cpt->o_speech_width, (uint8)cpt->o_speech_pen);
+ uint32 textCptId = _textMan->lowTextManager((uint8 *)text, cpt->o_speech_width, (uint8)cpt->o_speech_pen);
_objMan->unlockText(textNo);
- Object * textCpt = _objMan->fetchObject(textCptId);
+ Object *textCpt = _objMan->fetchObject(textCptId);
textCpt->o_screen = cpt->o_screen;
textCpt->o_target = textCptId;
@@ -1189,8 +1189,8 @@ int Logic::fnISpeak(Object *cpt, int32 id, int32 cdt, int32 textNo, int32 spr, i
textTopMargin = SCREEN_TOP_EDGE + TEXT_MARGIN + _scriptVars[SCROLL_OFFSET_Y];
textBottomMargin = SCREEN_BOTTOM_EDGE - TEXT_MARGIN + _scriptVars[SCROLL_OFFSET_Y] - textSpriteHeight;
- textCpt->o_anim_x = textCpt->o_xcoord = inRange(textLeftMargin, textX, textRightMargin);
- textCpt->o_anim_y = textCpt->o_ycoord = inRange(textTopMargin, textY, textBottomMargin);
+ textCpt->o_anim_x = textCpt->o_xcoord = CLIP<uint16>(textX, textLeftMargin, textRightMargin);
+ textCpt->o_anim_y = textCpt->o_ycoord = CLIP<uint16>(textY, textTopMargin, textBottomMargin);
}
return SCRIPT_STOP;
}
@@ -1247,7 +1247,7 @@ int Logic::fnChangeSpeechText(Object *cpt, int32 id, int32 tar, int32 width, int
//The game is halted for debugging. Maybe we'll remove this later.
int Logic::fnTalkError(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x) {
error("fnTalkError for id %d, instruction %d", id, cpt->o_down_flag);
- return SCRIPT_STOP; // for compilers that don't support NORETURN
+ return SCRIPT_STOP; // for compilers that don't support NORETURN
}
int Logic::fnStartTalk(Object *cpt, int32 id, int32 target, int32 d, int32 e, int32 f, int32 z, int32 x) {
@@ -1414,12 +1414,12 @@ int Logic::fnWalk(Object *cpt, int32 id, int32 x, int32 y, int32 dir, int32 stan
int32 target = _scriptVars[CLICK_ID];
// exceptions: compacts that use hand pointers but are not actually exits
if ((target != LEFT_SCROLL_POINTER) && (target != RIGHT_SCROLL_POINTER) &&
- (target != FLOOR_63) && (target != ROOF_63) && (target != GUARD_ROOF_63) &&
- (target != LEFT_TREE_POINTER_71) && (target != RIGHT_TREE_POINTER_71)) {
+ (target != FLOOR_63) && (target != ROOF_63) && (target != GUARD_ROOF_63) &&
+ (target != LEFT_TREE_POINTER_71) && (target != RIGHT_TREE_POINTER_71)) {
target = _objMan->fetchObject(_scriptVars[CLICK_ID])->o_mouse_on;
if ((target >= SCR_exit0) && (target <= SCR_exit9)) {
- fnStandAt(cpt,id,x,y,dir,stance,0,0);
+ fnStandAt(cpt, id, x, y, dir, stance, 0, 0);
return SCRIPT_STOP;
}
}
@@ -1439,13 +1439,13 @@ int Logic::fnTurn(Object *cpt, int32 id, int32 dir, int32 stance, int32 c, int32
dir = 9;
int route = _router->routeFinder(id, cpt, cpt->o_xcoord, cpt->o_ycoord, dir);
- if (route)
- cpt->o_down_flag = 1; //1 means ok
+ if (route)
+ cpt->o_down_flag = 1; //1 means ok
else
- cpt->o_down_flag = 0; //0 means error
+ cpt->o_down_flag = 0; //0 means error
cpt->o_logic = LOGIC_AR_animate;
- cpt->o_walk_pc = 0; //reset
+ cpt->o_walk_pc = 0; //reset
return SCRIPT_STOP;
}
@@ -1602,7 +1602,7 @@ int Logic::fnStopMusic(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d
int Logic::fnInnerSpace(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) {
error("fnInnerSpace() not working");
- return SCRIPT_STOP; // for compilers that don't support NORETURN
+ return SCRIPT_STOP; // for compilers that don't support NORETURN
}
int Logic::fnSetScreen(Object *cpt, int32 id, int32 target, int32 screen, int32 c, int32 d, int32 z, int32 x) {
@@ -1689,10 +1689,6 @@ int Logic::fnBlack(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, in
return SCRIPT_CONT;
}
-uint16 Logic::inRange(uint16 a, uint16 b, uint16 c) {
- return (a > b)? a : (((b > c) ? c : b));
-}
-
void Logic::startPosCallFn(uint8 fnId, uint32 param1, uint32 param2, uint32 param3) {
Object *obj = NULL;
switch (fnId) {
@@ -1789,7 +1785,7 @@ void Logic::startPositions(uint32 pos) {
if (pos == 0)
pos = 1;
Object *compact = _objMan->fetchObject(PLAYER);
- fnEnterSection(compact, PLAYER, pos, 0, 0, 0, 0, 0); // (automatically opens the compact resource for that section)
+ fnEnterSection(compact, PLAYER, pos, 0, 0, 0, 0, 0); // (automatically opens the compact resource for that section)
SwordEngine::_systemVars.controlPanelMode = CP_NORMAL;
SwordEngine::_systemVars.wantFade = true;
}
diff --git a/engines/sword1/logic.h b/engines/sword1/logic.h
index 13ddbc989b..a146d340cf 100644
--- a/engines/sword1/logic.h
+++ b/engines/sword1/logic.h
@@ -35,7 +35,7 @@ class OSystem;
namespace Sword1 {
#define NON_ZERO_SCRIPT_VARS 95
-#define NUM_SCRIPT_VARS 1179
+#define NUM_SCRIPT_VARS 1179
class SwordEngine;
class Text;
@@ -63,7 +63,7 @@ public:
static uint32 _scriptVars[NUM_SCRIPT_VARS];
// public for mouse (menu looking)
- int cfnPresetScript (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int cfnPresetScript(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
private:
SwordEngine *_vm;
ObjectMan *_objMan;
@@ -97,118 +97,116 @@ private:
void setupMcodeTable();
const BSMcodeTable *_mcodeTable;
- uint16 inRange(uint16 a, uint16 b, uint16 c);
-
//- mcodeTable:
- int fnBackground (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnForeground (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSort (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnNoSprite (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnMegaSet (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnAnim (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetFrame (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnFullAnim (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnFullSetFrame (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnFadeDown (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnFadeUp (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnCheckFade (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnBackground(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnForeground(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSort(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnNoSprite(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnMegaSet(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnAnim(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetFrame(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnFullAnim(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnFullSetFrame(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnFadeDown(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnFadeUp(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnCheckFade(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int fnSetSpritePalette(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int fnSetWholePalette(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int fnSetFadeTargetPalette(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int fnSetPaletteToFade(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int fnSetPaletteToCut(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnPlaySequence (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
-
- int fnIdle (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnPause (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnPauseSeconds (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnQuit (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnKillId (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSuicide (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnNewScript (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSubScript (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnRestartScript (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetBookmark (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnGotoBookmark (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSendSync (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnWaitSync (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnPlaySequence(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+
+ int fnIdle(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnPause(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnPauseSeconds(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnQuit(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnKillId(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSuicide(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnNewScript(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSubScript(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnRestartScript(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetBookmark(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnGotoBookmark(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSendSync(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnWaitSync(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int cfnClickInteract(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int cfnSetScript (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
-
- int fnInteract (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnIssueEvent (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnCheckForEvent (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnWipeHands (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnISpeak (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnTheyDo (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnTheyDoWeWait (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnWeWait (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int cfnSetScript(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+
+ int fnInteract(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnIssueEvent(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnCheckForEvent(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnWipeHands(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnISpeak(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnTheyDo(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnTheyDoWeWait(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnWeWait(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int fnChangeSpeechText(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnTalkError (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnStartTalk (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnTalkError(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnStartTalk(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int fnCheckForTextLine(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int fnAddTalkWaitStatusBit(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int fnRemoveTalkWaitStatusBit(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnNoHuman (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnAddHuman (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnBlankMouse (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnNormalMouse (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnLockMouse (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnUnlockMouse (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnNoHuman(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnAddHuman(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnBlankMouse(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnNormalMouse(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnLockMouse(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnUnlockMouse(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int fnSetMousePointer(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
int fnSetMouseLuggage(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnMouseOn (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnMouseOff (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnChooser (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnEndChooser (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnStartMenu (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnEndMenu (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
-
- int cfnReleaseMenu (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
-
- int fnAddSubject (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnAddObject (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnRemoveObject (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnEnterSection (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnLeaveSection (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnChangeFloor (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnWalk (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnTurn (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnStand (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnStandAt (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnFace (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnFaceXy (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnIsFacing (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnGetTo (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnGetToError (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnGetPos (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnGetGamepadXy (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnPlayFx (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnStopFx (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnPlayMusic (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnStopMusic (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnInnerSpace (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnRandom (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetScreen (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnPreload (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnCheckCD (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnRestartGame (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnQuitGame (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnDeathScreen (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnSetParallax (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnTdebug (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
-
- int fnRedFlash (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnBlueFlash (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnYellow (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnGreen (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnPurple (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
- int fnBlack (Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnMouseOn(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnMouseOff(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnChooser(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnEndChooser(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnStartMenu(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnEndMenu(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+
+ int cfnReleaseMenu(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+
+ int fnAddSubject(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnAddObject(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnRemoveObject(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnEnterSection(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnLeaveSection(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnChangeFloor(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnWalk(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnTurn(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnStand(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnStandAt(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnFace(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnFaceXy(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnIsFacing(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnGetTo(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnGetToError(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnGetPos(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnGetGamepadXy(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnPlayFx(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnStopFx(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnPlayMusic(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnStopMusic(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnInnerSpace(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnRandom(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetScreen(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnPreload(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnCheckCD(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnRestartGame(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnQuitGame(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnDeathScreen(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnSetParallax(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnTdebug(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+
+ int fnRedFlash(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnBlueFlash(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnYellow(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnGreen(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnPurple(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
+ int fnBlack(Object *cpt, int32 id, int32 c, int32 d, int32 e, int32 f, int32 z, int32 x);
static const uint32 _scriptVarInit[NON_ZERO_SCRIPT_VARS][2];
- static const uint8 *_startData[];
- static const uint8 *_helperData[];
+ static const uint8 *const _startData[];
+ static const uint8 *const _helperData[];
void startPosCallFn(uint8 fnId, uint32 param1, uint32 param2, uint32 param3);
void runStartScript(const uint8 *data);
};
diff --git a/engines/sword1/memman.cpp b/engines/sword1/memman.cpp
index 9fd763084a..19809249b5 100644
--- a/engines/sword1/memman.cpp
+++ b/engines/sword1/memman.cpp
@@ -40,7 +40,7 @@ MemMan::~MemMan() {
void MemMan::alloc(MemHandle *bsMem, uint32 pSize, uint16 pCond) {
_alloced += pSize;
- bsMem->data = (void*)malloc(pSize);
+ bsMem->data = (void *)malloc(pSize);
if (!bsMem->data)
error("MemMan::alloc(): Can't alloc %d bytes of memory.", pSize);
bsMem->cond = pCond;
diff --git a/engines/sword1/memman.h b/engines/sword1/memman.h
index 3f822189eb..7f84720248 100644
--- a/engines/sword1/memman.h
+++ b/engines/sword1/memman.h
@@ -35,9 +35,9 @@ struct MemHandle {
MemHandle *next, *prev;
};
// mem conditions:
-#define MEM_FREED 0
-#define MEM_CAN_FREE 1
-#define MEM_DONT_FREE 2
+#define MEM_FREED 0
+#define MEM_CAN_FREE 1
+#define MEM_DONT_FREE 2
#define MAX_ALLOC (6*1024*1024) // max amount of mem we want to alloc().
diff --git a/engines/sword1/menu.cpp b/engines/sword1/menu.cpp
index 3a99602fec..f61e10106a 100644
--- a/engines/sword1/menu.cpp
+++ b/engines/sword1/menu.cpp
@@ -85,7 +85,7 @@ void MenuIcon::setSelect(bool pSel) {
void MenuIcon::draw(const byte *fadeMask, int8 fadeStatus) {
uint16 x = _menuPos * 40;
- uint16 y = (_menuType == MENU_TOP)?(0):(440);
+ uint16 y = (_menuType == MENU_TOP) ? (0) : (440);
_screen->showFrame(x, y, _resId, _frame + (_selected ? 1 : 0), fadeMask, fadeStatus);
}
@@ -193,7 +193,7 @@ uint8 Menu::checkMenuClick(uint8 menuType) {
_mouse->setLuggage(0, 0);
Logic::_scriptVars[OBJECT_HELD] = 0; // reselected => deselect it
} else { // the player is clicking another item on this one.
- // run its use-script, if there is one
+ // run its use-script, if there is one
Logic::_scriptVars[SECOND_ITEM] = _menuList[cnt];
_mouse->setLuggage(0, 0);
}
diff --git a/engines/sword1/mouse.cpp b/engines/sword1/mouse.cpp
index cbf951aebc..4a62995d96 100644
--- a/engines/sword1/mouse.cpp
+++ b/engines/sword1/mouse.cpp
@@ -47,7 +47,7 @@ Mouse::~Mouse() {
setLuggage(0, 0);
setPointer(0, 0);
- for (uint8 cnt = 0; cnt < 17; cnt++) // close mouse cursor resources
+ for (uint8 cnt = 0; cnt < 17; cnt++) // close mouse cursor resources
_resMan->resClose(MSE_POINTER + cnt);
}
@@ -60,7 +60,7 @@ void Mouse::initialize() {
_mouseOverride = false;
_currentPtrId = _currentLuggageId = 0;
- for (uint8 cnt = 0; cnt < 17; cnt++) // force res manager to keep mouse
+ for (uint8 cnt = 0; cnt < 17; cnt++) // force res manager to keep mouse
_resMan->resOpen(MSE_POINTER + cnt); // cursors in memory all the time
CursorMan.showMouse(false);
@@ -112,7 +112,7 @@ void Mouse::engine(uint16 x, uint16 y, uint16 eventFlags) {
_mouse.y = y;
if (!(Logic::_scriptVars[MOUSE_STATUS] & 1)) { // no human?
_numObjs = 0;
- return; // no human, so we don't want the mouse engine
+ return; // no human, so we don't want the mouse engine
}
if (!Logic::_scriptVars[TOP_MENU_DISABLED]) {
@@ -144,12 +144,12 @@ void Mouse::engine(uint16 x, uint16 y, uint16 eventFlags) {
for (uint16 priority = 0; (priority < 10) && (!touchedId); priority++) {
for (uint16 cnt = 0; (cnt < _numObjs) && (!touchedId); cnt++) {
if ((_objList[cnt].compact->o_priority == priority) &&
- (Logic::_scriptVars[MOUSE_X] >= (uint32)_objList[cnt].compact->o_mouse_x1) &&
- (Logic::_scriptVars[MOUSE_X] <= (uint32)_objList[cnt].compact->o_mouse_x2) &&
- (Logic::_scriptVars[MOUSE_Y] >= (uint32)_objList[cnt].compact->o_mouse_y1) &&
- (Logic::_scriptVars[MOUSE_Y] <= (uint32)_objList[cnt].compact->o_mouse_y2)) {
- touchedId = _objList[cnt].id;
- clicked = cnt;
+ (Logic::_scriptVars[MOUSE_X] >= (uint32)_objList[cnt].compact->o_mouse_x1) &&
+ (Logic::_scriptVars[MOUSE_X] <= (uint32)_objList[cnt].compact->o_mouse_x2) &&
+ (Logic::_scriptVars[MOUSE_Y] >= (uint32)_objList[cnt].compact->o_mouse_y1) &&
+ (Logic::_scriptVars[MOUSE_Y] <= (uint32)_objList[cnt].compact->o_mouse_y2)) {
+ touchedId = _objList[cnt].id;
+ clicked = cnt;
}
}
}
@@ -160,7 +160,7 @@ void Mouse::engine(uint16 x, uint16 y, uint16 eventFlags) {
_getOff = 0;
}
if (touchedId) { // there's something new selected, now.
- if (_objList[clicked].compact->o_mouse_on) //run its get on
+ if (_objList[clicked].compact->o_mouse_on) //run its get on
_logic->runMouseScript(_objList[clicked].compact, _objList[clicked].compact->o_mouse_on);
_getOff = _objList[clicked].compact->o_mouse_off; //setup get-off for later
@@ -197,7 +197,7 @@ void Mouse::createPointer(uint32 ptrId, uint32 luggageId) {
if (ptrId) {
MousePtr *lugg = NULL;
- MousePtr *ptr = (MousePtr*)_resMan->openFetchRes(ptrId);
+ MousePtr *ptr = (MousePtr *)_resMan->openFetchRes(ptrId);
uint16 noFrames = _resMan->getLEUint16(ptr->numFrames);
uint16 ptrSizeX = _resMan->getLEUint16(ptr->sizeX);
uint16 ptrSizeY = _resMan->getLEUint16(ptr->sizeY);
@@ -210,7 +210,7 @@ void Mouse::createPointer(uint32 ptrId, uint32 luggageId) {
ptrSizeY *= 2;
if (luggageId) {
- lugg = (MousePtr*)_resMan->openFetchRes(luggageId);
+ lugg = (MousePtr *)_resMan->openFetchRes(luggageId);
luggSizeX = _resMan->getLEUint16(lugg->sizeX);
luggSizeY = _resMan->getLEUint16(lugg->sizeY);
@@ -223,18 +223,18 @@ void Mouse::createPointer(uint32 ptrId, uint32 luggageId) {
resSizeX = ptrSizeX;
resSizeY = ptrSizeY;
}
- _currentPtr = (MousePtr*)malloc(sizeof(MousePtr) + resSizeX * resSizeY * noFrames);
+ _currentPtr = (MousePtr *)malloc(sizeof(MousePtr) + resSizeX * resSizeY * noFrames);
_currentPtr->hotSpotX = _resMan->getLEUint16(ptr->hotSpotX);
_currentPtr->hotSpotY = _resMan->getLEUint16(ptr->hotSpotY);
_currentPtr->numFrames = noFrames;
_currentPtr->sizeX = resSizeX;
_currentPtr->sizeY = resSizeY;
- uint8 *ptrData = (uint8*)_currentPtr + sizeof(MousePtr);
+ uint8 *ptrData = (uint8 *)_currentPtr + sizeof(MousePtr);
memset(ptrData, 255, resSizeX * resSizeY * noFrames);
if (luggageId) {
uint8 *dstData = ptrData + resSizeX - luggSizeX;
for (uint32 frameCnt = 0; frameCnt < noFrames; frameCnt++) {
- uint8 *luggSrc = (uint8*)lugg + sizeof(MousePtr);
+ uint8 *luggSrc = (uint8 *)lugg + sizeof(MousePtr);
dstData += (resSizeY - luggSizeY) * resSizeX;
for (uint32 cnty = 0; cnty < (uint32)(SwordEngine::isPsx() ? luggSizeY / 2 : luggSizeY); cnty++) {
for (uint32 cntx = 0; cntx < luggSizeX; cntx++)
@@ -256,7 +256,7 @@ void Mouse::createPointer(uint32 ptrId, uint32 luggageId) {
}
uint8 *dstData = ptrData;
- uint8 *srcData = (uint8*)ptr + sizeof(MousePtr);
+ uint8 *srcData = (uint8 *)ptr + sizeof(MousePtr);
for (uint32 frameCnt = 0; frameCnt < noFrames; frameCnt++) {
for (uint32 cnty = 0; cnty < (uint32)(SwordEngine::isPsx() ? ptrSizeY / 2 : ptrSizeY); cnty++) {
for (uint32 cntx = 0; cntx < ptrSizeX; cntx++)
@@ -264,7 +264,7 @@ void Mouse::createPointer(uint32 ptrId, uint32 luggageId) {
dstData[cntx] = srcData[cntx];
if (SwordEngine::isPsx()) {
- dstData +=resSizeX;
+ dstData += resSizeX;
for (uint32 cntx = 0; cntx < ptrSizeX; cntx++)
if (srcData[cntx])
dstData[cntx] = srcData[cntx];
@@ -309,7 +309,7 @@ void Mouse::animate() {
if (_activeFrame == _frame)
return;
- uint8 *ptrData = (uint8*)_currentPtr + sizeof(MousePtr);
+ uint8 *ptrData = (uint8 *)_currentPtr + sizeof(MousePtr);
ptrData += _frame * _currentPtr->sizeX * _currentPtr->sizeY;
CursorMan.replaceCursor(ptrData, _currentPtr->sizeX, _currentPtr->sizeY, _currentPtr->hotSpotX, _currentPtr->hotSpotY, 255);
diff --git a/engines/sword1/mouse.h b/engines/sword1/mouse.h
index 44a6f76ad7..b2a844d0a9 100644
--- a/engines/sword1/mouse.h
+++ b/engines/sword1/mouse.h
@@ -34,22 +34,22 @@ namespace Sword1 {
#define MAX_MOUSE 30
-#define BS1L_BUTTON_DOWN 2
-#define BS1L_BUTTON_UP 4
-#define BS1R_BUTTON_DOWN 8
-#define BS1R_BUTTON_UP 16
-#define BS1_WHEEL_UP 32
-#define BS1_WHEEL_DOWN 64
-#define MOUSE_BOTH_BUTTONS (BS1L_BUTTON_DOWN | BS1R_BUTTON_DOWN)
-#define MOUSE_DOWN_MASK (BS1L_BUTTON_DOWN | BS1R_BUTTON_DOWN)
-#define MOUSE_UP_MASK (BS1L_BUTTON_UP | BS1R_BUTTON_UP)
+#define BS1L_BUTTON_DOWN 2
+#define BS1L_BUTTON_UP 4
+#define BS1R_BUTTON_DOWN 8
+#define BS1R_BUTTON_UP 16
+#define BS1_WHEEL_UP 32
+#define BS1_WHEEL_DOWN 64
+#define MOUSE_BOTH_BUTTONS (BS1L_BUTTON_DOWN | BS1R_BUTTON_DOWN)
+#define MOUSE_DOWN_MASK (BS1L_BUTTON_DOWN | BS1R_BUTTON_DOWN)
+#define MOUSE_UP_MASK (BS1L_BUTTON_UP | BS1R_BUTTON_UP)
struct MouseObj {
int id;
Object *compact;
};
-#include "common/pack-start.h" // START STRUCT PACKING
+#include "common/pack-start.h" // START STRUCT PACKING
struct MousePtr {
uint16 numFrames;
@@ -60,7 +60,7 @@ struct MousePtr {
uint8 dummyData[0x30];
} PACKED_STRUCT;
-#include "common/pack-end.h" // END STRUCT PACKING
+#include "common/pack-end.h" // END STRUCT PACKING
class Logic;
class Menu;
diff --git a/engines/sword1/object.h b/engines/sword1/object.h
index 4f5371fa72..0dab5519bd 100644
--- a/engines/sword1/object.h
+++ b/engines/sword1/object.h
@@ -27,98 +27,98 @@
namespace Sword1 {
-#define O_TOTAL_EVENTS 5
-#define O_WALKANIM_SIZE 600 //max number of nodes in router output
-#define O_GRID_SIZE 200
-#define EXTRA_GRID_SIZE 20
+#define O_TOTAL_EVENTS 5
+#define O_WALKANIM_SIZE 600 //max number of nodes in router output
+#define O_GRID_SIZE 200
+#define EXTRA_GRID_SIZE 20
-#include "common/pack-start.h" // START STRUCT PACKING
+#include "common/pack-start.h" // START STRUCT PACKING
-struct OEventSlot { //receiving event list in the compact -
- int32 o_event; //array of these with O_TOTAL_EVENTS elements
- int32 o_event_script;
-} PACKED_STRUCT; // size = 2*int32 = 8 bytes
+struct OEventSlot { //receiving event list in the compact -
+ int32 o_event; //array of these with O_TOTAL_EVENTS elements
+ int32 o_event_script;
+} PACKED_STRUCT; // size = 2*int32 = 8 bytes
-#define TOTAL_script_levels 5
+#define TOTAL_script_levels 5
-struct ScriptTree { //this is a logic tree, used by OBJECTs
- int32 o_script_level; //logic level
- int32 o_script_id[TOTAL_script_levels]; //script id's (are unique to each level)
- int32 o_script_pc[TOTAL_script_levels]; //pc of script for each (if script_manager)
-} PACKED_STRUCT; // size = 11*int32 = 44 bytes
+struct ScriptTree { //this is a logic tree, used by OBJECTs
+ int32 o_script_level; //logic level
+ int32 o_script_id[TOTAL_script_levels]; //script id's (are unique to each level)
+ int32 o_script_pc[TOTAL_script_levels]; //pc of script for each (if script_manager)
+} PACKED_STRUCT; // size = 11*int32 = 44 bytes
struct TalkOffset {
- int32 x;
- int32 y;
-} PACKED_STRUCT; // size = 2*int32 = 8 bytes
+ int32 x;
+ int32 y;
+} PACKED_STRUCT; // size = 2*int32 = 8 bytes
struct WalkData {
- int32 frame;
- int32 x;
- int32 y;
- int32 step;
- int32 dir;
-} PACKED_STRUCT; // size = 5*int32 = 20 bytes
+ int32 frame;
+ int32 x;
+ int32 y;
+ int32 step;
+ int32 dir;
+} PACKED_STRUCT; // size = 5*int32 = 20 bytes
struct Object {
- int32 o_type; // 0 broad description of type - object, floor, etc.
- int32 o_status; // 4 bit flags for logic, graphics, mouse, etc.
- int32 o_logic; // 8 logic type
- int32 o_place; // 12 where is the mega character
- int32 o_down_flag; // 16 pass back down with this - with C possibly both are unnecessary?
- int32 o_target; // 20 target object for the GTM *these are linked to script
- int32 o_screen; // 24 physical screen/section
- int32 o_frame; // 28 frame number &
- int32 o_resource; // 32 id of spr file it comes from
- int32 o_sync; // 36 receive sync here
- int32 o_pause; // 40 logic_engine() pauses these cycles
- int32 o_xcoord; // 44
- int32 o_ycoord; // 48
- int32 o_mouse_x1; // 52 top-left of mouse area is (x1,y1)
- int32 o_mouse_y1; // 56
- int32 o_mouse_x2; // 60 bottom-right of area is (x2,y2) (these coords are inclusive)
- int32 o_mouse_y2; // 64
- int32 o_priority; // 68
- int32 o_mouse_on; // 72
- int32 o_mouse_off; // 76
- int32 o_mouse_click; // 80
- int32 o_interact; // 84
- int32 o_get_to_script; // 88
- int32 o_scale_a; // 92 used by floors
- int32 o_scale_b; // 96
- int32 o_anim_x; // 100
- int32 o_anim_y; // 104
-
- ScriptTree o_tree; // 108 size = 44 bytes
- ScriptTree o_bookmark; // 152 size = 44 bytes
-
- int32 o_dir; // 196
- int32 o_speech_pen; // 200
- int32 o_speech_width; // 204
- int32 o_speech_time; // 208
- int32 o_text_id; // 212 working back from o_ins1
- int32 o_tag; // 216
- int32 o_anim_pc; // 220 position within an animation structure
- int32 o_anim_resource; // 224 cdt or anim table
-
- int32 o_walk_pc; // 228
-
- TalkOffset talk_table[6]; // 232 size = 6*8 bytes = 48
-
- OEventSlot o_event_list[O_TOTAL_EVENTS]; // 280 size = 5*8 bytes = 40
-
- int32 o_ins1; // 320
- int32 o_ins2; // 324
- int32 o_ins3; // 328
-
- int32 o_mega_resource; // 332
- int32 o_walk_resource; // 336
-
- WalkData o_route[O_WALKANIM_SIZE]; // 340 size = 600*20 bytes = 12000
- // mega size = 12340 bytes (+ 8 byte offset table + 20 byte header = 12368)
+ int32 o_type; // 0 broad description of type - object, floor, etc.
+ int32 o_status; // 4 bit flags for logic, graphics, mouse, etc.
+ int32 o_logic; // 8 logic type
+ int32 o_place; // 12 where is the mega character
+ int32 o_down_flag; // 16 pass back down with this - with C possibly both are unnecessary?
+ int32 o_target; // 20 target object for the GTM *these are linked to script
+ int32 o_screen; // 24 physical screen/section
+ int32 o_frame; // 28 frame number &
+ int32 o_resource; // 32 id of spr file it comes from
+ int32 o_sync; // 36 receive sync here
+ int32 o_pause; // 40 logic_engine() pauses these cycles
+ int32 o_xcoord; // 44
+ int32 o_ycoord; // 48
+ int32 o_mouse_x1; // 52 top-left of mouse area is (x1,y1)
+ int32 o_mouse_y1; // 56
+ int32 o_mouse_x2; // 60 bottom-right of area is (x2,y2) (these coords are inclusive)
+ int32 o_mouse_y2; // 64
+ int32 o_priority; // 68
+ int32 o_mouse_on; // 72
+ int32 o_mouse_off; // 76
+ int32 o_mouse_click; // 80
+ int32 o_interact; // 84
+ int32 o_get_to_script; // 88
+ int32 o_scale_a; // 92 used by floors
+ int32 o_scale_b; // 96
+ int32 o_anim_x; // 100
+ int32 o_anim_y; // 104
+
+ ScriptTree o_tree; // 108 size = 44 bytes
+ ScriptTree o_bookmark; // 152 size = 44 bytes
+
+ int32 o_dir; // 196
+ int32 o_speech_pen; // 200
+ int32 o_speech_width; // 204
+ int32 o_speech_time; // 208
+ int32 o_text_id; // 212 working back from o_ins1
+ int32 o_tag; // 216
+ int32 o_anim_pc; // 220 position within an animation structure
+ int32 o_anim_resource; // 224 cdt or anim table
+
+ int32 o_walk_pc; // 228
+
+ TalkOffset talk_table[6]; // 232 size = 6*8 bytes = 48
+
+ OEventSlot o_event_list[O_TOTAL_EVENTS]; // 280 size = 5*8 bytes = 40
+
+ int32 o_ins1; // 320
+ int32 o_ins2; // 324
+ int32 o_ins3; // 328
+
+ int32 o_mega_resource; // 332
+ int32 o_walk_resource; // 336
+
+ WalkData o_route[O_WALKANIM_SIZE]; // 340 size = 600*20 bytes = 12000
+ // mega size = 12340 bytes (+ 8 byte offset table + 20 byte header = 12368)
} PACKED_STRUCT;
-#include "common/pack-end.h" // END STRUCT PACKING
+#include "common/pack-end.h" // END STRUCT PACKING
} // End of namespace Sword1
diff --git a/engines/sword1/objectman.cpp b/engines/sword1/objectman.cpp
index 8de29615d5..ed994a97fa 100644
--- a/engines/sword1/objectman.cpp
+++ b/engines/sword1/objectman.cpp
@@ -39,15 +39,15 @@ void ObjectMan::initialize() {
uint16 cnt;
for (cnt = 0; cnt < TOTAL_SECTIONS; cnt++)
_liveList[cnt] = 0; // we don't need to close the files here. When this routine is
- // called, the memory was flushed() anyways, so these resources
- // already *are* closed.
+ // called, the memory was flushed() anyways, so these resources
+ // already *are* closed.
_liveList[128] = _liveList[129] = _liveList[130] = _liveList[131] = _liveList[133] =
- _liveList[134] = _liveList[145] = _liveList[146] = _liveList[TEXT_sect] = 1;
+ _liveList[134] = _liveList[145] = _liveList[146] = _liveList[TEXT_sect] = 1;
for (cnt = 0; cnt < TOTAL_SECTIONS; cnt++) {
if (_liveList[cnt])
- _cptData[cnt] = (uint8*)_resMan->cptResOpen(_objectList[cnt]) + sizeof(Header);
+ _cptData[cnt] = (uint8 *)_resMan->cptResOpen(_objectList[cnt]) + sizeof(Header);
else
_cptData[cnt] = NULL;
}
@@ -66,7 +66,7 @@ bool ObjectMan::sectionAlive(uint16 section) {
void ObjectMan::megaEntering(uint16 section) {
_liveList[section]++;
if (_liveList[section] == 1)
- _cptData[section] = ((uint8*)_resMan->cptResOpen(_objectList[section])) + sizeof(Header);
+ _cptData[section] = ((uint8 *)_resMan->cptResOpen(_objectList[section])) + sizeof(Header);
}
void ObjectMan::megaLeaving(uint16 section, int id) {
@@ -87,7 +87,7 @@ uint8 ObjectMan::fnCheckForTextLine(uint32 textId) {
return 0; // section does not exist
uint8 lang = SwordEngine::_systemVars.language;
- uint32 *textData = (uint32*)((uint8*)_resMan->openFetchRes(_textList[textId / ITM_PER_SEC][lang]) + sizeof(Header));
+ uint32 *textData = (uint32 *)((uint8 *)_resMan->openFetchRes(_textList[textId / ITM_PER_SEC][lang]) + sizeof(Header));
if ((textId & ITM_ID) < _resMan->readUint32(textData)) {
textData++;
if (textData[textId & ITM_ID])
@@ -99,7 +99,7 @@ uint8 ObjectMan::fnCheckForTextLine(uint32 textId) {
char *ObjectMan::lockText(uint32 textId) {
uint8 lang = SwordEngine::_systemVars.language;
- char *addr = (char*)_resMan->openFetchRes(_textList[textId / ITM_PER_SEC][lang]);
+ char *addr = (char *)_resMan->openFetchRes(_textList[textId / ITM_PER_SEC][lang]);
if (addr == 0)
return _missingSubTitleStr;
addr += sizeof(Header);
@@ -107,12 +107,12 @@ char *ObjectMan::lockText(uint32 textId) {
warning("ObjectMan::lockText(%d): only %d texts in file", textId & ITM_ID, _resMan->readUint32(addr));
textId = 0; // get first line instead
}
- uint32 offset = _resMan->readUint32(addr + ((textId & ITM_ID) + 1)* 4);
+ uint32 offset = _resMan->readUint32(addr + ((textId & ITM_ID) + 1) * 4);
if (offset == 0) {
// Workaround bug for missing sentence in some langages in Syria (see bug #1977094).
// We use the hardcoded text in this case.
if (textId == 2950145)
- return const_cast<char*>(_translationId2950145[lang]);
+ return const_cast<char *>(_translationId2950145[lang]);
warning("ObjectMan::lockText(%d): text number has no text lines", textId);
return _missingSubTitleStr;
@@ -125,7 +125,7 @@ void ObjectMan::unlockText(uint32 textId) {
}
uint32 ObjectMan::lastTextNumber(int section) {
- uint8 *data = (uint8*)_resMan->openFetchRes(_textList[section][SwordEngine::_systemVars.language]) + sizeof(Header);
+ uint8 *data = (uint8 *)_resMan->openFetchRes(_textList[section][SwordEngine::_systemVars.language]) + sizeof(Header);
uint32 result = _resMan->readUint32(data) - 1;
_resMan->resClose(_textList[section][SwordEngine::_systemVars.language]);
return result;
@@ -137,17 +137,17 @@ Object *ObjectMan::fetchObject(uint32 id) {
error("fetchObject: section %d is not open", id / ITM_PER_SEC);
id &= ITM_ID;
// DON'T do endian conversion here. it's already done.
- return (Object*)(addr + *(uint32*)(addr + (id + 1)*4));
+ return (Object *)(addr + * (uint32 *)(addr + (id + 1) * 4));
}
uint32 ObjectMan::fetchNoObjects(int section) {
if (_cptData[section] == NULL)
error("fetchNoObjects: section %d is not open", section);
- return *(uint32*)_cptData[section];
+ return *(uint32 *)_cptData[section];
}
void ObjectMan::closeSection(uint32 screen) {
- if (_liveList[screen] == 0) // close the section that PLAYER has just left, if it's empty now
+ if (_liveList[screen] == 0) // close the section that PLAYER has just left, if it's empty now
_resMan->resClose(_objectList[screen]);
}
@@ -159,7 +159,7 @@ void ObjectMan::loadLiveList(uint16 *src) {
}
_liveList[cnt] = src[cnt];
if (_liveList[cnt])
- _cptData[cnt] = ((uint8*)_resMan->cptResOpen(_objectList[cnt])) + sizeof(Header);
+ _cptData[cnt] = ((uint8 *)_resMan->cptResOpen(_objectList[cnt])) + sizeof(Header);
}
}
@@ -179,7 +179,7 @@ char ObjectMan::_missingSubTitleStr[] = " ";
// is not needed. The English version of the game does not include Portuguese
// so I cannot check.)
-const char *ObjectMan::_translationId2950145[7] = {
+const char *const ObjectMan::_translationId2950145[7] = {
"Oh?", // English (not needed)
"Quoi?", // French
"Oh?", // German
diff --git a/engines/sword1/objectman.h b/engines/sword1/objectman.h
index 23047c14ea..ca3c7c1526 100644
--- a/engines/sword1/objectman.h
+++ b/engines/sword1/objectman.h
@@ -54,12 +54,12 @@ public:
void loadLiveList(uint16 *src);
private:
ResMan *_resMan;
- static const uint32 _objectList[TOTAL_SECTIONS]; //a table of pointers to object files
- static const uint32 _textList[TOTAL_SECTIONS][7]; //a table of pointers to text files
- uint16 _liveList[TOTAL_SECTIONS]; //which sections are active
+ static const uint32 _objectList[TOTAL_SECTIONS]; //a table of pointers to object files
+ static const uint32 _textList[TOTAL_SECTIONS][7]; //a table of pointers to text files
+ uint16 _liveList[TOTAL_SECTIONS]; //which sections are active
uint8 *_cptData[TOTAL_SECTIONS];
static char _missingSubTitleStr[];
- static const char *_translationId2950145[7]; //translation for textId 2950145 (missing from cluster file for some langages)
+ static const char *const _translationId2950145[7]; //translation for textId 2950145 (missing from cluster file for some langages)
};
} // End of namespace Sword1
diff --git a/engines/sword1/resman.cpp b/engines/sword1/resman.cpp
index 807679a40e..878ba8eceb 100644
--- a/engines/sword1/resman.cpp
+++ b/engines/sword1/resman.cpp
@@ -31,14 +31,14 @@
#include "gui/message.h"
namespace Sword1 {
- void guiFatalError(char *msg) {
- // Displays a dialog on-screen before terminating the engine.
- // TODO: We really need to setup a special palette for cases when
- // the engine is erroring before setting one... otherwise invisible cursor :)
-
- GUI::MessageDialog dialog(msg);
- dialog.runModal();
- error("%s", msg);
+void guiFatalError(char *msg) {
+ // Displays a dialog on-screen before terminating the engine.
+ // TODO: We really need to setup a special palette for cases when
+ // the engine is erroring before setting one... otherwise invisible cursor :)
+
+ GUI::MessageDialog dialog(msg);
+ dialog.runModal();
+ error("%s", msg);
}
#define MAX_PATH_LEN 260
@@ -62,7 +62,7 @@ ResMan::~ResMan() {
for (uint32 resCnt = 0; resCnt < group->noRes; resCnt++) {
if (group->resHandle[resCnt].cond == MEM_DONT_FREE) {
warning("ResMan::~ResMan: Resource %02X.%04X.%02X is still open",
- clusCnt + 1, grpCnt, resCnt);
+ clusCnt + 1, grpCnt, resCnt);
}
}
}
@@ -92,7 +92,7 @@ void ResMan::loadCluDescript(const char *fileName) {
_prj.clu = new Clu[_prj.noClu];
memset(_prj.clu, 0, _prj.noClu * sizeof(Clu));
- uint32 *cluIndex = (uint32*)malloc(_prj.noClu * 4);
+ uint32 *cluIndex = (uint32 *)malloc(_prj.noClu * 4);
file.read(cluIndex, _prj.noClu * 4);
for (uint32 clusCnt = 0; clusCnt < _prj.noClu; clusCnt++)
@@ -107,7 +107,7 @@ void ResMan::loadCluDescript(const char *fileName) {
memset(cluster->grp, 0, cluster->noGrp * sizeof(Grp));
cluster->refCount = 0;
- uint32 *grpIndex = (uint32*)malloc(cluster->noGrp * 4);
+ uint32 *grpIndex = (uint32 *)malloc(cluster->noGrp * 4);
file.read(grpIndex, cluster->noGrp * 4);
for (uint32 grpCnt = 0; grpCnt < cluster->noGrp; grpCnt++)
@@ -117,7 +117,7 @@ void ResMan::loadCluDescript(const char *fileName) {
group->resHandle = new MemHandle[group->noRes];
group->offset = new uint32[group->noRes];
group->length = new uint32[group->noRes];
- uint32 *resIdIdx = (uint32*)malloc(group->noRes * 4);
+ uint32 *resIdIdx = (uint32 *)malloc(group->noRes * 4);
file.read(resIdIdx, group->noRes * 4);
for (uint32 resCnt = 0; resCnt < group->noRes; resCnt++) {
@@ -227,7 +227,7 @@ Header *ResMan::lockScript(uint32 scrID) {
#else
openScriptResourceLittleEndian(scrID);
#endif
- return (Header*)resHandle(scrID)->data;
+ return (Header *)resHandle(scrID)->data;
}
void ResMan::unlockScript(uint32 scrID) {
@@ -276,23 +276,23 @@ void ResMan::resClose(uint32 id) {
} else {
handle->refCount--;
if (!handle->refCount)
- _memMan->setCondition( handle, MEM_CAN_FREE);
+ _memMan->setCondition(handle, MEM_CAN_FREE);
}
}
FrameHeader *ResMan::fetchFrame(void *resourceData, uint32 frameNo) {
- uint8 *frameFile = (uint8*)resourceData;
+ uint8 *frameFile = (uint8 *)resourceData;
uint8 *idxData = frameFile + sizeof(Header);
if (_isBigEndian) {
if (frameNo >= READ_BE_UINT32(idxData))
error("fetchFrame:: frame %d doesn't exist in resource.", frameNo);
- frameFile += READ_BE_UINT32(idxData + (frameNo+1) * 4);
+ frameFile += READ_BE_UINT32(idxData + (frameNo + 1) * 4);
} else {
if (frameNo >= READ_LE_UINT32(idxData))
error("fetchFrame:: frame %d doesn't exist in resource.", frameNo);
- frameFile += READ_LE_UINT32(idxData + (frameNo+1) * 4);
+ frameFile += READ_LE_UINT32(idxData + (frameNo + 1) * 4);
}
- return (FrameHeader*)frameFile;
+ return (FrameHeader *)frameFile;
}
Common::File *ResMan::resFile(uint32 id) {
@@ -310,9 +310,9 @@ Common::File *ResMan::resFile(uint32 id) {
// Supposes that big endian means mac cluster file and little endian means PC cluster file.
// This works, but we may want to separate the file name from the endianess or try .CLM extension if opening.clu file fail.
if (_isBigEndian)
- sprintf(fileName, "%s.CLM", _prj.clu[(id >> 24)-1].label);
+ sprintf(fileName, "%s.CLM", _prj.clu[(id >> 24) - 1].label);
else
- sprintf(fileName, "%s.CLU", _prj.clu[(id >> 24)-1].label);
+ sprintf(fileName, "%s.CLU", _prj.clu[(id >> 24) - 1].label);
cluster->file->open(fileName);
if (!cluster->file->isOpen()) {
char msg[512];
@@ -392,7 +392,7 @@ void ResMan::openCptResourceBigEndian(uint32 id) {
if (!handle)
return;
uint32 totSize = handle->size;
- uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header));
+ uint32 *data = (uint32 *)((uint8 *)handle->data + sizeof(Header));
totSize -= sizeof(Header);
if (totSize & 3)
error("Illegal compact size for id %d: %d", id, totSize);
@@ -420,7 +420,7 @@ void ResMan::openCptResourceLittleEndian(uint32 id) {
if (!handle)
return;
uint32 totSize = handle->size;
- uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header));
+ uint32 *data = (uint32 *)((uint8 *)handle->data + sizeof(Header));
totSize -= sizeof(Header);
if (totSize & 3)
error("Illegal compact size for id %d: %d", id, totSize);
@@ -448,11 +448,11 @@ void ResMan::openScriptResourceBigEndian(uint32 id) {
if (!handle)
return;
// uint32 totSize = handle->size;
- Header *head = (Header*)handle->data;
+ Header *head = (Header *)handle->data;
head->comp_length = FROM_LE_32(head->comp_length);
head->decomp_length = FROM_LE_32(head->decomp_length);
head->version = FROM_LE_16(head->version);
- uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header));
+ uint32 *data = (uint32 *)((uint8 *)handle->data + sizeof(Header));
uint32 size = handle->size - sizeof(Header);
if (size & 3)
error("Odd size during script endian conversion. Resource ID =%d, size = %d", id, size);
@@ -480,11 +480,11 @@ void ResMan::openScriptResourceLittleEndian(uint32 id) {
if (!handle)
return;
// uint32 totSize = handle->size;
- Header *head = (Header*)handle->data;
+ Header *head = (Header *)handle->data;
head->comp_length = FROM_BE_32(head->comp_length);
head->decomp_length = FROM_BE_32(head->decomp_length);
head->version = FROM_BE_16(head->version);
- uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header));
+ uint32 *data = (uint32 *)((uint8 *)handle->data + sizeof(Header));
uint32 size = handle->size - sizeof(Header);
if (size & 3)
error("Odd size during script endian conversion. Resource ID =%d, size = %d", id, size);
@@ -498,34 +498,34 @@ void ResMan::openScriptResourceLittleEndian(uint32 id) {
uint32 ResMan::_srIdList[29] = { // the file numbers differ for the control panel file IDs, so we need this array
- OTHER_SR_FONT, // SR_FONT
- 0x04050000, // SR_BUTTON
- OTHER_SR_REDFONT, // SR_REDFONT
- 0x04050001, // SR_PALETTE
- 0x04050002, // SR_PANEL_ENGLISH
- 0x04050003, // SR_PANEL_FRENCH
- 0x04050004, // SR_PANEL_GERMAN
- 0x04050005, // SR_PANEL_ITALIAN
- 0x04050006, // SR_PANEL_SPANISH
- 0x04050007, // SR_PANEL_AMERICAN
- 0x04050008, // SR_TEXT_BUTTON
- 0x04050009, // SR_SPEED
- 0x0405000A, // SR_SCROLL1
- 0x0405000B, // SR_SCROLL2
- 0x0405000C, // SR_CONFIRM
- 0x0405000D, // SR_VOLUME
- 0x0405000E, // SR_VLIGHT
- 0x0405000F, // SR_VKNOB
- 0x04050010, // SR_WINDOW
- 0x04050011, // SR_SLAB1
- 0x04050012, // SR_SLAB2
- 0x04050013, // SR_SLAB3
- 0x04050014, // SR_SLAB4
- 0x04050015, // SR_BUTUF
- 0x04050016, // SR_BUTUS
- 0x04050017, // SR_BUTDS
- 0x04050018, // SR_BUTDF
- 0x04050019, // SR_DEATHPANEL
+ OTHER_SR_FONT, // SR_FONT
+ 0x04050000, // SR_BUTTON
+ OTHER_SR_REDFONT, // SR_REDFONT
+ 0x04050001, // SR_PALETTE
+ 0x04050002, // SR_PANEL_ENGLISH
+ 0x04050003, // SR_PANEL_FRENCH
+ 0x04050004, // SR_PANEL_GERMAN
+ 0x04050005, // SR_PANEL_ITALIAN
+ 0x04050006, // SR_PANEL_SPANISH
+ 0x04050007, // SR_PANEL_AMERICAN
+ 0x04050008, // SR_TEXT_BUTTON
+ 0x04050009, // SR_SPEED
+ 0x0405000A, // SR_SCROLL1
+ 0x0405000B, // SR_SCROLL2
+ 0x0405000C, // SR_CONFIRM
+ 0x0405000D, // SR_VOLUME
+ 0x0405000E, // SR_VLIGHT
+ 0x0405000F, // SR_VKNOB
+ 0x04050010, // SR_WINDOW
+ 0x04050011, // SR_SLAB1
+ 0x04050012, // SR_SLAB2
+ 0x04050013, // SR_SLAB3
+ 0x04050014, // SR_SLAB4
+ 0x04050015, // SR_BUTUF
+ 0x04050016, // SR_BUTUS
+ 0x04050017, // SR_BUTDS
+ 0x04050018, // SR_BUTDF
+ 0x04050019, // SR_DEATHPANEL
0,
};
diff --git a/engines/sword1/resman.h b/engines/sword1/resman.h
index 82074e5740..49d974c1db 100644
--- a/engines/sword1/resman.h
+++ b/engines/sword1/resman.h
@@ -33,11 +33,11 @@ namespace Sword1 {
#define MAX_LABEL_SIZE (31+1)
#if defined(__PSP__)
-#define MAX_OPEN_CLUS 4 // the PSP can't have more than 8 files open simultaneously
- // since we also need filehandles for music and sometimes savegames
- // set the maximum number of open clusters to 4.
+#define MAX_OPEN_CLUS 4 // the PSP can't have more than 8 files open simultaneously
+ // since we also need filehandles for music and sometimes savegames
+ // set the maximum number of open clusters to 4.
#else
-#define MAX_OPEN_CLUS 8 // don't open more than 8 files at once
+#define MAX_OPEN_CLUS 8 // don't open more than 8 files at once
#endif
struct Grp {
@@ -77,10 +77,10 @@ public:
FrameHeader *fetchFrame(void *resourceData, uint32 frameNo);
uint16 getUint16(uint16 value) {
- return (_isBigEndian) ? FROM_BE_16(value): FROM_LE_16(value);
+ return (_isBigEndian) ? FROM_BE_16(value) : FROM_LE_16(value);
}
uint32 getUint32(uint32 value) {
- return (_isBigEndian) ? FROM_BE_32(value): FROM_LE_32(value);
+ return (_isBigEndian) ? FROM_BE_32(value) : FROM_LE_32(value);
}
uint16 getLEUint16(uint16 value) {
return FROM_LE_16(value);
@@ -89,24 +89,24 @@ public:
return FROM_LE_32(value);
}
uint16 readUint16(const void *ptr) {
- return (_isBigEndian) ? READ_BE_UINT16(ptr): READ_LE_UINT16(ptr);
+ return (_isBigEndian) ? READ_BE_UINT16(ptr) : READ_LE_UINT16(ptr);
}
uint32 readUint32(const void *ptr) {
- return (_isBigEndian) ? READ_BE_UINT32(ptr):READ_LE_UINT32(ptr);
+ return (_isBigEndian) ? READ_BE_UINT32(ptr) : READ_LE_UINT32(ptr);
}
uint32 readLEUint32(const void *ptr) {
return READ_LE_UINT32(ptr);
}
uint16 toUint16(uint16 value) {
- return (_isBigEndian) ? TO_BE_16(value): TO_LE_16(value);
+ return (_isBigEndian) ? TO_BE_16(value) : TO_LE_16(value);
}
uint32 toUint32(uint32 value) {
- return (_isBigEndian) ? TO_BE_32(value): TO_LE_32(value);
+ return (_isBigEndian) ? TO_BE_32(value) : TO_LE_32(value);
}
private:
- uint32 resLength(uint32 id);
+ uint32 resLength(uint32 id);
MemHandle *resHandle(uint32 id);
uint32 resOffset(uint32 id);
Common::File *resFile(uint32 id);
@@ -120,7 +120,7 @@ private:
void freeCluDescript();
Prj _prj;
MemMan *_memMan;
- static const uint32 _scriptList[TOTAL_SECTIONS]; //a table of resource tags
+ static const uint32 _scriptList[TOTAL_SECTIONS]; //a table of resource tags
static uint32 _srIdList[29];
Clu *_openCluStart, *_openCluEnd;
int _openClus;
diff --git a/engines/sword1/router.cpp b/engines/sword1/router.cpp
index aaf475912d..ef07a0bf02 100644
--- a/engines/sword1/router.cpp
+++ b/engines/sword1/router.cpp
@@ -33,25 +33,25 @@
namespace Sword1 {
/****************************************************************************
- * JROUTER.C polygon router with modular walks
- * using a tree of modules
- * 21 july 94
+ * JROUTER.C polygon router with modular walks
+ * using a tree of modules
+ * 21 july 94
* 3 november 94
- * System currently works by scanning grid data and coming up with a ROUTE
+ * System currently works by scanning grid data and coming up with a ROUTE
* as a series of way points(nodes), the smoothest eight directional PATH
- * through these nodes is then found, and a WALK created to fit the PATH.
+ * through these nodes is then found, and a WALK created to fit the PATH.
*
- * Two funtions are called by the user, RouteFinder creates a route as a
- * module list, HardWalk creates an animation list from the module list.
- * The split is only provided to allow the possibility of turning the
- * autorouter over two game cycles.
+ * Two funtions are called by the user, RouteFinder creates a route as a
+ * module list, HardWalk creates an animation list from the module list.
+ * The split is only provided to allow the possibility of turning the
+ * autorouter over two game cycles.
****************************************************************************
*
* Routine timings on osborne 486
*
- * Read floor resource (file already loaded) 112 pixels
+ * Read floor resource (file already loaded) 112 pixels
*
- * Read mega resource (file already loaded) 112 pixels
+ * Read mega resource (file already loaded) 112 pixels
*
*
*
@@ -59,16 +59,16 @@ namespace Sword1 {
*
* Modified 12 Oct 95
*
- * Target Points within 1 pixel of a line are ignored ???
+ * Target Points within 1 pixel of a line are ignored ???
*
- * Modules split into Points within 1 pixel of a line are ignored ???
+ * Modules split into Points within 1 pixel of a line are ignored ???
*
****************************************************************************/
-#define NO_DIRECTIONS 8
-#define SLOW_IN 3
-#define SLOW_OUT 7
-#define ROUTE_END_FLAG 255
+#define NO_DIRECTIONS 8
+#define SLOW_IN 3
+#define SLOW_OUT 7
+#define ROUTE_END_FLAG 255
Router::Router(ObjectMan *pObjMan, ResMan *pResMan) {
_objMan = pObjMan;
@@ -85,9 +85,9 @@ Router::Router(ObjectMan *pObjMan, ResMan *pResMan) {
int32 Router::routeFinder(int32 id, Object *megaObject, int32 x, int32 y, int32 dir) {
/*********************************************************************
- * RouteFinder.C polygon router with modular walks
- * 21 august 94
- * 3 november 94
+ * RouteFinder.C polygon router with modular walks
+ * 21 august 94
+ * 3 november 94
* routeFinder creates a list of modules that enables HardWalk to
* create an animation list.
*
@@ -99,11 +99,11 @@ int32 Router::routeFinder(int32 id, Object *megaObject, int32 x, int32 y, int32
*
* 30 november 94 return values modified
*
- * return 0 = failed to find a route
+ * return 0 = failed to find a route
*
- * 1 = found a route
+ * 1 = found a route
*
- * 2 = mega already at target
+ * 2 = mega already at target
*
*********************************************************************/
@@ -117,7 +117,7 @@ int32 Router::routeFinder(int32 id, Object *megaObject, int32 x, int32 y, int32
walkAnim = megaObject->o_route;
- _framesPerStep = _nWalkFrames/2;
+ _framesPerStep = _nWalkFrames / 2;
_framesPerChar = _nWalkFrames * NO_DIRECTIONS;
// offset pointers added Oct 30 95 JPS
@@ -145,12 +145,12 @@ int32 Router::routeFinder(int32 id, Object *megaObject, int32 x, int32 y, int32
slowOutFrames = 0;
}
-// **************************************************************************
-// All route data now loaded start finding a route
-// **************************************************************************
-// **************************************************************************
-// check if we can get a route through the floor changed 12 Oct95 JPS
-// **************************************************************************
+ // **************************************************************************
+ // All route data now loaded start finding a route
+ // **************************************************************************
+ // **************************************************************************
+ // check if we can get a route through the floor changed 12 Oct95 JPS
+ // **************************************************************************
routeFlag = getRoute();
@@ -220,26 +220,26 @@ int32 Router::routeFinder(int32 id, Object *megaObject, int32 x, int32 y, int32
break;
}
- return routeFlag; // send back null route
+ return routeFlag; // send back null route
}
int32 Router::getRoute() {
/*********************************************************************
- * GetRoute.C extract a path from walk grid
- * 12 october 94
+ * GetRoute.C extract a path from walk grid
+ * 12 october 94
*
* GetRoute currently works by scanning grid data and coming up with
* a ROUTE as a series of way points(nodes).
*
* static routeData _route[O_ROUTE_SIZE];
*
- * return 0 = failed to find a route
+ * return 0 = failed to find a route
*
- * 1 = found a route
+ * 1 = found a route
*
- * 2 = mega already at target
+ * 2 = mega already at target
*
- * 3 = failed to find a route because target was on a line
+ * 3 = failed to find a route because target was on a line
*
*********************************************************************/
@@ -459,7 +459,7 @@ void Router::smoothCheck(int32 &k, int32 best, int32 p, int32 dirS, int32 dirD)
// set up sd0-ss2 to reflect possible movement in each direction
- if (dirS == 0 || dirS == 4) { // vert and diag
+ if (dirS == 0 || dirS == 4) { // vert and diag
ddx = ldx;
ddy = (ldx * _diagonaly) / _diagonalx;
dsy = ldy - ddy;
@@ -492,7 +492,7 @@ void Router::smoothCheck(int32 &k, int32 best, int32 p, int32 dirS, int32 dirD)
}
switch (best) {
- case 0: // halfsquare, diagonal, halfsquare
+ case 0: // halfsquare, diagonal, halfsquare
_smoothPath[k].x = x + dsx / 2;
_smoothPath[k].y = y + dsy / 2;
_smoothPath[k].dir = dirS;
@@ -512,7 +512,7 @@ void Router::smoothCheck(int32 &k, int32 best, int32 p, int32 dirS, int32 dirD)
k++;
break;
- case 1: // square, diagonal
+ case 1: // square, diagonal
_smoothPath[k].x = x + dsx;
_smoothPath[k].y = y + dsy;
_smoothPath[k].dir = dirS;
@@ -526,7 +526,7 @@ void Router::smoothCheck(int32 &k, int32 best, int32 p, int32 dirS, int32 dirD)
k++;
break;
- case 2: // diagonal square
+ case 2: // diagonal square
_smoothPath[k].x = x + ddx;
_smoothPath[k].y = y + ddy;
_smoothPath[k].dir = dirD;
@@ -540,7 +540,7 @@ void Router::smoothCheck(int32 &k, int32 best, int32 p, int32 dirS, int32 dirD)
k++;
break;
- default: // halfdiagonal, square, halfdiagonal
+ default: // halfdiagonal, square, halfdiagonal
_smoothPath[k].x = x + ddx / 2;
_smoothPath[k].y = y + ddy / 2;
_smoothPath[k].dir = dirD;
@@ -627,17 +627,17 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
* fits the smoothPath and uses foot slipping to fit whole steps into
* the route
*
- * Parameters: georgeg, mouseg
- * Returns: rout
+ * Parameters: georgeg, mouseg
+ * Returns: rout
*
* produce a module list from the line data
*********************************************************************/
int32 p;
- int32 lastDir;
- int32 lastRealDir;
- int32 currentDir;
- int32 turnDir;
+ int32 lastDir;
+ int32 lastRealDir;
+ int32 currentDir;
+ int32 turnDir;
int32 scale;
int32 step;
int32 module;
@@ -677,7 +677,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// START THE WALK WITH THE FIRST STANDFRAME THIS MAY CAUSE A DELAY
// BUT IT STOPS THE PLAYER MOVING FOR COLLISIONS ARE DETECTED
//****************************************************************************
- module = _framesPerChar + lastDir;
+ module = _framesPerChar + lastDir;
walkAnim[stepCount].frame = module;
walkAnim[stepCount].step = 0;
walkAnim[stepCount].dir = lastDir;
@@ -694,7 +694,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// get the direction to turn
turnDir = currentDir - lastDir;
if (turnDir < 0)
- turnDir += NO_DIRECTIONS;
+ turnDir += NO_DIRECTIONS;
if (turnDir > 4)
turnDir = -1;
@@ -704,10 +704,10 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// rotate to new walk direction
// for george and nico put in a head turn at the start
if ((megaId == GEORGE) || (megaId == NICO)) {
- if (turnDir < 0) { // new frames for turn frames 29oct95jps
- module = turnFramesLeft + lastDir;
+ if (turnDir < 0) { // new frames for turn frames 29oct95jps
+ module = turnFramesLeft + lastDir;
} else {
- module = turnFramesRight + lastDir;
+ module = turnFramesRight + lastDir;
}
walkAnim[stepCount].frame = module;
walkAnim[stepCount].step = 0;
@@ -720,14 +720,14 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// rotate till were facing new dir then go back 45 degrees
while (lastDir != currentDir) {
lastDir += turnDir;
- if (turnDir < 0) { // new frames for turn frames 29oct95jps
+ if (turnDir < 0) { // new frames for turn frames 29oct95jps
if (lastDir < 0)
- lastDir += NO_DIRECTIONS;
- module = turnFramesLeft + lastDir;
+ lastDir += NO_DIRECTIONS;
+ module = turnFramesLeft + lastDir;
} else {
if (lastDir > 7)
- lastDir -= NO_DIRECTIONS;
- module = turnFramesRight + lastDir;
+ lastDir -= NO_DIRECTIONS;
+ module = turnFramesRight + lastDir;
}
walkAnim[stepCount].frame = module;
walkAnim[stepCount].step = 0;
@@ -760,17 +760,17 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
lastDir = currentDir;
lastCount = stepCount;
}
- //calculate average amount to lose in each step on the way to the next _node
+ //calculate average amount to lose in each step on the way to the next _node
currentDir = _modularPath[p].dir;
if (currentDir < NO_DIRECTIONS) {
- module = currentDir * _framesPerStep * 2 + _slidyWalkAnimatorState * _framesPerStep;
+ module = currentDir * _framesPerStep * 2 + _slidyWalkAnimatorState * _framesPerStep;
_slidyWalkAnimatorState = !_slidyWalkAnimatorState;
moduleEnd = module + _framesPerStep;
step = 0;
scale = (_scaleA * moduleY + _scaleB);
do {
- module16X += _dx[module]*scale;
- module16Y += _dy[module]*scale;
+ module16X += _dx[module] * scale;
+ module16Y += _dy[module] * scale;
moduleX = module16X >> 16;
moduleY = module16Y >> 16;
walkAnim[stepCount].frame = module;
@@ -781,53 +781,53 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
stepCount += 1;
step += 1;
module += 1;
- } while ( module < moduleEnd);
+ } while (module < moduleEnd);
stepX = _modX[_modularPath[p].dir];
stepY = _modY[_modularPath[p].dir];
- errorX = _modularPath[p].x - moduleX;
+ errorX = _modularPath[p].x - moduleX;
errorX = errorX * stepX;
- errorY = _modularPath[p].y - moduleY;
+ errorY = _modularPath[p].y - moduleY;
errorY = errorY * stepY;
if ((errorX < 0) || (errorY < 0)) {
- _modularPath[p].num = 0; // the end of the path
+ _modularPath[p].num = 0; // the end of the path
// okay those last steps took us past our target but do we want to scoot or moonwalk
frames = stepCount - lastCount;
- errorX = _modularPath[p].x - walkAnim[stepCount-1].x;
- errorY = _modularPath[p].y - walkAnim[stepCount-1].y;
+ errorX = _modularPath[p].x - walkAnim[stepCount - 1].x;
+ errorY = _modularPath[p].y - walkAnim[stepCount - 1].y;
if (frames > _framesPerStep) {
- lastErrorX = _modularPath[p].x - walkAnim[stepCount-7].x;
- lastErrorY = _modularPath[p].y - walkAnim[stepCount-7].y;
- if (stepX==0) {
- if (3*ABS(lastErrorY) < ABS(errorY)) { //the last stop was closest
+ lastErrorX = _modularPath[p].x - walkAnim[stepCount - 7].x;
+ lastErrorY = _modularPath[p].y - walkAnim[stepCount - 7].y;
+ if (stepX == 0) {
+ if (3 * ABS(lastErrorY) < ABS(errorY)) { //the last stop was closest
stepCount -= _framesPerStep;
_slidyWalkAnimatorState = !_slidyWalkAnimatorState;
}
} else {
- if (3*ABS(lastErrorX) < ABS(errorX)) { //the last stop was closest
+ if (3 * ABS(lastErrorX) < ABS(errorX)) { //the last stop was closest
stepCount -= _framesPerStep;
_slidyWalkAnimatorState = !_slidyWalkAnimatorState;
}
}
}
- errorX = _modularPath[p].x - walkAnim[stepCount-1].x;
- errorY = _modularPath[p].y - walkAnim[stepCount-1].y;
+ errorX = _modularPath[p].x - walkAnim[stepCount - 1].x;
+ errorY = _modularPath[p].y - walkAnim[stepCount - 1].y;
// okay we've reached the end but we still have an error
if (errorX != 0) {
frameCount = 0;
frames = stepCount - lastCount;
do {
frameCount += 1;
- walkAnim[lastCount + frameCount - 1].x += errorX*frameCount/frames;
- } while (frameCount<frames);
+ walkAnim[lastCount + frameCount - 1].x += errorX * frameCount / frames;
+ } while (frameCount < frames);
}
if (errorY != 0) {
frameCount = 0;
frames = stepCount - lastCount;
do {
frameCount += 1;
- walkAnim[lastCount + frameCount-1].y += errorY*frameCount/frames;
- } while (frameCount<frames);
+ walkAnim[lastCount + frameCount - 1].y += errorY * frameCount / frames;
+ } while (frameCount < frames);
}
// Now is the time to put in the turn frames for the last turn
if (frames < _framesPerStep)
@@ -858,8 +858,8 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// all turns checked
lastCount = stepCount;
- moduleX = walkAnim[stepCount-1].x;
- moduleY = walkAnim[stepCount-1].y;
+ moduleX = walkAnim[stepCount - 1].x;
+ moduleY = walkAnim[stepCount - 1].y;
module16X = moduleX << 16;
module16Y = moduleY << 16;
}
@@ -879,9 +879,9 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// We've done the walk now put in any turns at the end
- if (_targetDir == NO_DIRECTIONS) { // stand in the last direction
- module = standFrames + lastRealDir;
- _targetDir = lastRealDir;
+ if (_targetDir == NO_DIRECTIONS) { // stand in the last direction
+ module = standFrames + lastRealDir;
+ _targetDir = lastRealDir;
walkAnim[stepCount].frame = module;
walkAnim[stepCount].step = 0;
walkAnim[stepCount].dir = lastRealDir;
@@ -891,7 +891,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
}
if (_targetDir == 9) {
if (stepCount == 0) {
- module = _framesPerChar + lastRealDir;
+ module = _framesPerChar + lastRealDir;
walkAnim[stepCount].frame = module;
walkAnim[stepCount].step = 0;
walkAnim[stepCount].dir = lastRealDir;
@@ -913,10 +913,10 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// rotate to target direction
// for george and nico put in a head turn at the start
if ((megaId == GEORGE) || (megaId == NICO)) {
- if (turnDir < 0) { // new frames for turn frames 29oct95jps
- module = turnFramesLeft + lastDir;
+ if (turnDir < 0) { // new frames for turn frames 29oct95jps
+ module = turnFramesLeft + lastDir;
} else {
- module = turnFramesRight + lastDir;
+ module = turnFramesRight + lastDir;
}
walkAnim[stepCount].frame = module;
walkAnim[stepCount].step = 0;
@@ -929,14 +929,14 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// rotate if we need to
while (lastRealDir != _targetDir) {
lastRealDir += turnDir;
- if (turnDir < 0) { // new frames for turn frames 29oct95jps
+ if (turnDir < 0) { // new frames for turn frames 29oct95jps
if (lastRealDir < 0)
- lastRealDir += NO_DIRECTIONS;
- module = turnFramesLeft + lastRealDir;
+ lastRealDir += NO_DIRECTIONS;
+ module = turnFramesLeft + lastRealDir;
} else {
if (lastRealDir > 7)
- lastRealDir -= NO_DIRECTIONS;
- module = turnFramesRight + lastRealDir;
+ lastRealDir -= NO_DIRECTIONS;
+ module = turnFramesRight + lastRealDir;
}
walkAnim[stepCount].frame = module;
walkAnim[stepCount].step = 0;
@@ -945,10 +945,10 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
walkAnim[stepCount].y = moduleY;
stepCount += 1;
}
- module = standFrames + lastRealDir;
- walkAnim[stepCount-1].frame = module;
+ module = standFrames + lastRealDir;
+ walkAnim[stepCount - 1].frame = module;
} else { // just stand at the end
- module = standFrames + lastRealDir;
+ module = standFrames + lastRealDir;
walkAnim[stepCount].frame = module;
walkAnim[stepCount].step = 0;
walkAnim[stepCount].dir = lastRealDir;
@@ -962,7 +962,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
walkAnim[stepCount].frame = 512;
stepCount += 1;
walkAnim[stepCount].frame = 512;
-// Tdebug("RouteFinder RouteSize is %d", stepCount);
+ //Tdebug("RouteFinder RouteSize is %d", stepCount);
return;
}
@@ -1071,7 +1071,7 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) {
// start at the begining for a change
lastDir = _modularPath[0].dir;
currentDir = _modularPath[1].dir;
- module = _framesPerChar + lastDir;
+ module = _framesPerChar + lastDir;
moduleX = _startX;
moduleY = _startY;
module16X = moduleX << 16;
@@ -1100,7 +1100,7 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) {
// get the direction to turn
turnDir = currentDir - lastDir;
if (turnDir < 0)
- turnDir += NO_DIRECTIONS;
+ turnDir += NO_DIRECTIONS;
if (turnDir > 4)
turnDir = -1;
@@ -1110,10 +1110,10 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) {
// rotate to new walk direction
// for george and nico put in a head turn at the start
if ((megaId == GEORGE) || (megaId == NICO)) {
- if (turnDir < 0) { // new frames for turn frames 29oct95jps
- module = turnFramesLeft + lastDir;
+ if (turnDir < 0) { // new frames for turn frames 29oct95jps
+ module = turnFramesLeft + lastDir;
} else {
- module = turnFramesRight + lastDir;
+ module = turnFramesRight + lastDir;
}
walkAnim[stepCount].frame = module;
walkAnim[stepCount].step = 0;
@@ -1126,14 +1126,14 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) {
// rotate till were facing new dir then go back 45 degrees
while (lastDir != currentDir) {
lastDir += turnDir;
- if (turnDir < 0) { // new frames for turn frames 29oct95jps
+ if (turnDir < 0) { // new frames for turn frames 29oct95jps
if (lastDir < 0)
lastDir += NO_DIRECTIONS;
- module = turnFramesLeft + lastDir;
+ module = turnFramesLeft + lastDir;
} else {
if (lastDir > 7)
lastDir -= NO_DIRECTIONS;
- module = turnFramesRight + lastDir;
+ module = turnFramesRight + lastDir;
}
walkAnim[stepCount].frame = module;
walkAnim[stepCount].step = 0;
@@ -1213,19 +1213,19 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) {
int32 p;
- for (p = 1; _modularPath[p].dir < NO_DIRECTIONS; ++p) {
+ for (p = 1; _modularPath[p].dir < NO_DIRECTIONS; ++p) {
while (_modularPath[p].num > 0) {
currentDir = _modularPath[p].dir;
if (currentDir < NO_DIRECTIONS) {
- module = currentDir * _framesPerStep * 2 + left * _framesPerStep;
+ module = currentDir * _framesPerStep * 2 + left * _framesPerStep;
left = !left;
moduleEnd = module + _framesPerStep;
step = 0;
scale = (_scaleA * moduleY + _scaleB);
do {
- module16X += _dx[module]*scale;
- module16Y += _dy[module]*scale;
+ module16X += _dx[module] * scale;
+ module16Y += _dy[module] * scale;
moduleX = module16X >> 16;
moduleY = module16Y >> 16;
walkAnim[stepCount].frame = module;
@@ -1236,22 +1236,22 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) {
stepCount += 1;
module += 1;
step += 1;
- } while ( module < moduleEnd);
- errorX = _modularPath[p].x - moduleX;
+ } while (module < moduleEnd);
+ errorX = _modularPath[p].x - moduleX;
errorX = errorX * _modX[_modularPath[p].dir];
- errorY = _modularPath[p].y - moduleY;
+ errorY = _modularPath[p].y - moduleY;
errorY = errorY * _modY[_modularPath[p].dir];
if ((errorX < 0) || (errorY < 0)) {
_modularPath[p].num = 0;
stepCount -= _framesPerStep;
left = !left;
// Okay this is the end of a section
- moduleX = walkAnim[stepCount-1].x;
- moduleY = walkAnim[stepCount-1].y;
+ moduleX = walkAnim[stepCount - 1].x;
+ moduleY = walkAnim[stepCount - 1].y;
module16X = moduleX << 16;
module16Y = moduleY << 16;
- _modularPath[p].x =moduleX;
- _modularPath[p].y =moduleY;
+ _modularPath[p].x = moduleX;
+ _modularPath[p].y = moduleY;
// Now is the time to put in the turn frames for the last turn
if ((stepCount - lastCount) < _framesPerStep) { // no step taken
currentDir = 99;// this ensures that we don't put in turn frames for this walk or the next
@@ -1350,10 +1350,10 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) {
stepCount += 1;
}
}
- module = _framesPerChar + _modularPath[p-1].dir;
+ module = _framesPerChar + _modularPath[p - 1].dir;
walkAnim[stepCount].frame = module;
walkAnim[stepCount].step = 0;
- walkAnim[stepCount].dir = _modularPath[p-1].dir;
+ walkAnim[stepCount].dir = _modularPath[p - 1].dir;
walkAnim[stepCount].x = moduleX;
walkAnim[stepCount].y = moduleY;
stepCount += 1;
@@ -1395,7 +1395,7 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) {
bool Router::scan(int32 level) {
/*********************************************************************
- * Called successively from routeFinder until no more changes take
+ * Called successively from routeFinder until no more changes take
* place in the grid array, ie he best path has been found
*
* Scans through every point in the node array and checks if there is
@@ -1447,7 +1447,7 @@ bool Router::scan(int32 level) {
}
-int32 Router::newCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32 y2) {
+int32 Router::newCheck(int32 status, int32 x1, int32 y1, int32 x2, int32 y2) {
/*********************************************************************
* newCheck routine checks if the route between two points can be
* achieved without crossing any of the bars in the Bars array.
@@ -1531,7 +1531,7 @@ int32 Router::newCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32 y2) {
step2 = check(x1 + ldx / 2, y1, x1 + ldx / 2 + dlx, y2);
if (step2 != 0) {
step3 = check(x1 + ldx / 2 + dlx, y2, x2, y2);
- if (step3 != 0) {
+ if (step3 != 0) {
steps = step1 + step2 + step3;
options |= 1;
}
@@ -1565,8 +1565,8 @@ int32 Router::newCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32 y2) {
ldx = 0;
// options are square, diagonal a code 1 route
- step1 = check(x1 ,y1, x1, y1 + ldy);
- if (step1 != 0) {
+ step1 = check(x1 , y1, x1, y1 + ldy);
+ if (step1 != 0) {
step2 = check(x1, y1 + ldy, x2, y2);
if (step2 != 0) {
steps = step1 + step2;
@@ -1608,7 +1608,7 @@ int32 Router::newCheck(int32 status, int32 x1 , int32 y1 , int32 x2 ,int32 y2) {
step2 = check(x1 + dlx / 2, y1 + dly / 2, x1 + dlx / 2, y1 + ldy + dly / 2);
if (step2 != 0) {
step3 = check(x1 + dlx / 2, y1 + ldy + dly / 2, x2, y2);
- if (step3 != 0) {
+ if (step3 != 0) {
steps = step1 + step2 + step3;
options |= 8;
}
@@ -1659,7 +1659,7 @@ bool Router::lineCheck(int32 x1, int32 y1, int32 x2, int32 y2) {
int32 dirx = x2 - x1;
int32 diry = y2 - y1;
- int32 co = (y1 * dirx) - (x1 * diry); // new line equation
+ int32 co = (y1 * dirx) - (x1 * diry); // new line equation
for (int i = 0; i < _nBars && linesCrossed; i++) {
// skip if not on module
@@ -1668,7 +1668,7 @@ bool Router::lineCheck(int32 x1, int32 y1, int32 x2, int32 y2) {
// but all this arithmetic we must have loads of time
// slope it he slope between the two lines
- int32 slope = (_bars[i].dx * diry) - (_bars[i].dy *dirx);
+ int32 slope = (_bars[i].dx * diry) - (_bars[i].dy * dirx);
// assuming parallel lines don't cross
if (slope != 0) {
// calculate x intercept and check its on both
@@ -1818,50 +1818,50 @@ int32 Router::checkTarget(int32 x, int32 y) {
// ****************************************************************************
int32 Router::LoadWalkResources(Object *megaObject, int32 x, int32 y, int32 dir) {
- WalkGridHeader floorHeader;
- int32 i;
- uint8 *fPolygrid;
- uint8 *fMegaWalkData;
+ WalkGridHeader floorHeader;
+ int32 i;
+ uint8 *fPolygrid;
+ uint8 *fMegaWalkData;
- int32 floorId;
- int32 walkGridResourceId;
+ int32 floorId;
+ int32 walkGridResourceId;
Object *floorObject;
- int32 cnt;
+ int32 cnt;
uint32 cntu;
// load in floor grid for current mega
floorId = megaObject->o_place;
- //floorObject = (object *) Lock_object(floorId);
+ //floorObject = (object *)Lock_object(floorId);
floorObject = _objMan->fetchObject(floorId);
walkGridResourceId = floorObject->o_resource;
//Unlock_object(floorId);
- //ResOpen(walkGridResourceId); // mouse wiggle
- //fPolygrid = ResLock(walkGridResourceId); // mouse wiggle
- fPolygrid = (uint8*)_resMan->openFetchRes(walkGridResourceId);
+ //ResOpen(walkGridResourceId); // mouse wiggle
+ //fPolygrid = ResLock(walkGridResourceId); // mouse wiggle
+ fPolygrid = (uint8 *)_resMan->openFetchRes(walkGridResourceId);
fPolygrid += sizeof(Header);
- memcpy(&floorHeader,fPolygrid,sizeof(WalkGridHeader));
+ memcpy(&floorHeader, fPolygrid, sizeof(WalkGridHeader));
fPolygrid += sizeof(WalkGridHeader);
_nBars = _resMan->getUint32(floorHeader.numBars);
if (_nBars >= O_GRID_SIZE) {
- #ifdef DEBUG //check for id > number in file,
+#ifdef DEBUG //check for id > number in file,
error("RouteFinder Error too many _bars %d", _nBars);
- #endif
+#endif
_nBars = 0;
}
- _nNodes = _resMan->getUint32(floorHeader.numNodes)+1; //array starts at 0 begins at a start _node has nnodes nodes and a target _node
+ _nNodes = _resMan->getUint32(floorHeader.numNodes) + 1; //array starts at 0 begins at a start _node has nnodes nodes and a target _node
if (_nNodes >= O_GRID_SIZE) {
- #ifdef DEBUG //check for id > number in file,
- error("RouteFinder Error too many nodes %d", _nNodes);
- #endif
+#ifdef DEBUG //check for id > number in file,
+ error("RouteFinder Error too many nodes %d", _nNodes);
+#endif
_nNodes = 0;
}
@@ -1883,37 +1883,37 @@ int32 Router::LoadWalkResources(Object *megaObject, int32 x, int32 y, int32 dir)
/*j = 1;// leave _node 0 for start _node
do {
- memmove(&_node[j].x,fPolygrid,2*sizeof(int16));
- fPolygrid += 2*sizeof(int16);
- j ++;
+ memmove(&_node[j].x,fPolygrid,2*sizeof(int16));
+ fPolygrid += 2*sizeof(int16);
+ j ++;
} while (j < _nNodes);//array starts at 0*/
for (cnt = 1; cnt < _nNodes; cnt++) {
_node[cnt].x = _resMan->readUint16(fPolygrid); fPolygrid += 2;
_node[cnt].y = _resMan->readUint16(fPolygrid); fPolygrid += 2;
}
- //ResUnlock(walkGridResourceId); // mouse wiggle
- //ResClose(walkGridResourceId); // mouse wiggle
+ //ResUnlock(walkGridResourceId); // mouse wiggle
+ //ResClose(walkGridResourceId); // mouse wiggle
_resMan->resClose(walkGridResourceId);
// floor grid loaded
-// copy the mega structure into the local variables for use in all subroutines
+ // copy the mega structure into the local variables for use in all subroutines
_startX = megaObject->o_xcoord;
_startY = megaObject->o_ycoord;
_startDir = megaObject->o_dir;
_targetX = x;
- _targetY= y;
+ _targetY = y;
_targetDir = dir;
_scaleA = megaObject->o_scale_a;
_scaleB = megaObject->o_scale_b;
- //ResOpen(megaObject->o_mega_resource); // mouse wiggle
- //fMegaWalkData = ResLock(megaObject->o_mega_resource); // mouse wiggle
- fMegaWalkData = (uint8*)_resMan->openFetchRes(megaObject->o_mega_resource);
+ //ResOpen(megaObject->o_mega_resource); // mouse wiggle
+ //fMegaWalkData = ResLock(megaObject->o_mega_resource); // mouse wiggle
+ fMegaWalkData = (uint8 *)_resMan->openFetchRes(megaObject->o_mega_resource);
// Apparently this resource is in little endian in both the Mac and the PC version
_nWalkFrames = fMegaWalkData[0];
@@ -1945,28 +1945,28 @@ int32 Router::LoadWalkResources(Object *megaObject, int32 x, int32 y, int32 dir)
memmove(&_modY[0],fMegaWalkData,NO_DIRECTIONS*sizeof(int32));
fMegaWalkData += NO_DIRECTIONS*sizeof(int32);*/
- //ResUnlock(megaObject->o_mega_resource); // mouse wiggle
- //ResClose(megaObject->o_mega_resource); // mouse wiggle
+ //ResUnlock(megaObject->o_mega_resource); // mouse wiggle
+ //ResClose(megaObject->o_mega_resource); // mouse wiggle
_resMan->resClose(megaObject->o_mega_resource);
_diagonalx = _modX[3]; //36
_diagonaly = _modY[3]; //8
-// mega data ready
+ // mega data ready
-// finish setting grid by putting mega _node at begining
-// and target _node at end and reset current values
+ // finish setting grid by putting mega _node at begining
+ // and target _node at end and reset current values
_node[0].x = _startX;
_node[0].y = _startY;
_node[0].level = 1;
_node[0].prev = 0;
_node[0].dist = 0;
- i=1;
+ i = 1;
do {
_node[i].level = 0;
_node[i].prev = 0;
_node[i].dist = 9999;
- i=i+1;
+ i = i + 1;
} while (i < _nNodes);
_node[_nNodes].x = _targetX;
_node[_nNodes].y = _targetY;
@@ -2088,12 +2088,12 @@ void Router::extractRoute() {
#define DIAGONALY 8
int whatTarget(int32 startX, int32 startY, int32 destX, int32 destY) {
int tar_dir;
-//setting up
- int deltaX = destX-startX;
- int deltaY = destY-startY;
+ //setting up
+ int deltaX = destX - startX;
+ int deltaY = destY - startY;
int signX = (deltaX > 0);
int signY = (deltaY > 0);
- int slope;
+ int slope;
if ((ABS(deltaY) * DIAGONALX) < (ABS(deltaX) * DIAGONALY / 2))
slope = 0;// its flat
@@ -2103,22 +2103,22 @@ int whatTarget(int32 startX, int32 startY, int32 destX, int32 destY) {
slope = 1;// its diagonal
if (slope == 0) { //flat
- if (signX == 1) // going right
+ if (signX == 1) // going right
tar_dir = 2;
else
tar_dir = 6;
} else if (slope == 2) { //vertical
- if (signY == 1) // going down
+ if (signY == 1) // going down
tar_dir = 4;
else
tar_dir = 0;
} else if (signX == 1) { //right diagonal
- if (signY == 1) // going down
+ if (signY == 1) // going down
tar_dir = 3;
else
tar_dir = 1;
} else { //left diagonal
- if (signY == 1) // going down
+ if (signY == 1) // going down
tar_dir = 5;
else
tar_dir = 7;
diff --git a/engines/sword1/router.h b/engines/sword1/router.h
index 31c4291eed..82724b1e6e 100644
--- a/engines/sword1/router.h
+++ b/engines/sword1/router.h
@@ -27,7 +27,7 @@
namespace Sword1 {
-#include "common/pack-start.h" // START STRUCT PACKING
+#include "common/pack-start.h" // START STRUCT PACKING
struct BarData {
int16 x1;
@@ -38,9 +38,9 @@ struct BarData {
int16 ymin;
int16 xmax;
int16 ymax;
- int16 dx; // x2 - x1
- int16 dy; // y2 - y1
- int32 co; // co = (y1*dx) - (x1*dy) from an equation for a line y*dx = x*dy + co
+ int16 dx; // x2 - x1
+ int16 dy; // y2 - y1
+ int32 co; // co = (y1*dx) - (x1*dy) from an equation for a line y*dx = x*dy + co
} PACKED_STRUCT;
struct NodeData {
@@ -51,13 +51,13 @@ struct NodeData {
int16 dist;
} PACKED_STRUCT;
-#include "common/pack-end.h" // END STRUCT PACKING
+#include "common/pack-end.h" // END STRUCT PACKING
struct FloorData {
- int32 nbars;
- BarData *bars;
- int32 nnodes;
- NodeData *node;
+ int32 nbars;
+ BarData *bars;
+ int32 nnodes;
+ NodeData *node;
};
struct RouteData {
@@ -115,24 +115,24 @@ private:
int32 megaId;
- RouteData _route[O_ROUTE_SIZE];
- PathData _smoothPath[O_ROUTE_SIZE];
- PathData _modularPath[O_ROUTE_SIZE];
- int32 _routeLength;
-
- int32 _framesPerStep, _framesPerChar;
- uint8 _nWalkFrames, _nTurnFrames;
- int32 _dx[NO_DIRECTIONS + MAX_FRAMES_PER_CHAR];
- int32 _dy[NO_DIRECTIONS + MAX_FRAMES_PER_CHAR];
- int32 _modX[NO_DIRECTIONS];
- int32 _modY[NO_DIRECTIONS];
- int32 _diagonalx, _diagonaly;
- int32 standFrames;
- int32 turnFramesLeft, turnFramesRight;
- int32 walkFramesLeft, walkFramesRight; // left/right walking turn
- int32 slowInFrames, slowOutFrames;
-
- bool _slidyWalkAnimatorState;
+ RouteData _route[O_ROUTE_SIZE];
+ PathData _smoothPath[O_ROUTE_SIZE];
+ PathData _modularPath[O_ROUTE_SIZE];
+ int32 _routeLength;
+
+ int32 _framesPerStep, _framesPerChar;
+ uint8 _nWalkFrames, _nTurnFrames;
+ int32 _dx[NO_DIRECTIONS + MAX_FRAMES_PER_CHAR];
+ int32 _dy[NO_DIRECTIONS + MAX_FRAMES_PER_CHAR];
+ int32 _modX[NO_DIRECTIONS];
+ int32 _modY[NO_DIRECTIONS];
+ int32 _diagonalx, _diagonaly;
+ int32 standFrames;
+ int32 turnFramesLeft, turnFramesRight;
+ int32 walkFramesLeft, walkFramesRight; // left/right walking turn
+ int32 slowInFrames, slowOutFrames;
+
+ bool _slidyWalkAnimatorState;
int32 LoadWalkResources(Object *mega, int32 x, int32 y, int32 dir);
int32 getRoute();
diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp
index 1da89a1091..ae128b8c05 100644
--- a/engines/sword1/screen.cpp
+++ b/engines/sword1/screen.cpp
@@ -78,13 +78,9 @@ void Screen::useTextManager(Text *pTextMan) {
_textMan = pTextMan;
}
-int32 Screen::inRange(int32 a, int32 b, int32 c) { // return b(!) so that: a <= b <= c
- return (a > b) ? (a) : ((b < c) ? b : c);
-}
-
void Screen::setScrolling(int16 offsetX, int16 offsetY) {
- offsetX = inRange(0, offsetX, Logic::_scriptVars[MAX_SCROLL_OFFSET_X]);
- offsetY = inRange(0, offsetY, Logic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
+ offsetX = CLIP<int32>(offsetX, 0, Logic::_scriptVars[MAX_SCROLL_OFFSET_X]);
+ offsetY = CLIP<int32>(offsetY, 0, Logic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
if (Logic::_scriptVars[SCROLL_FLAG] == 2) { // first time on this screen - need absolute scroll immediately!
_oldScrollX = Logic::_scriptVars[SCROLL_OFFSET_X] = (uint32)offsetX;
@@ -101,18 +97,18 @@ void Screen::setScrolling(int16 offsetX, int16 offsetY) {
_oldScrollY = Logic::_scriptVars[SCROLL_OFFSET_Y];
int dx = offsetX - Logic::_scriptVars[SCROLL_OFFSET_X];
int dy = offsetY - Logic::_scriptVars[SCROLL_OFFSET_Y];
- int scrlDistX = inRange(-MAX_SCROLL_DISTANCE, (((SCROLL_FRACTION - 1) + ABS(dx)) / SCROLL_FRACTION) * ((dx > 0) ? 1 : -1), MAX_SCROLL_DISTANCE);
- int scrlDistY = inRange(-MAX_SCROLL_DISTANCE, (((SCROLL_FRACTION - 1) + ABS(dy)) / SCROLL_FRACTION) * ((dy > 0) ? 1 : -1), MAX_SCROLL_DISTANCE);
+ int scrlDistX = CLIP<int32>((((SCROLL_FRACTION - 1) + ABS(dx)) / SCROLL_FRACTION) * ((dx > 0) ? 1 : -1), -MAX_SCROLL_DISTANCE, MAX_SCROLL_DISTANCE);
+ int scrlDistY = CLIP<int32>((((SCROLL_FRACTION - 1) + ABS(dy)) / SCROLL_FRACTION) * ((dy > 0) ? 1 : -1), -MAX_SCROLL_DISTANCE, MAX_SCROLL_DISTANCE);
if ((scrlDistX != 0) || (scrlDistY != 0))
_fullRefresh = true;
- Logic::_scriptVars[SCROLL_OFFSET_X] = inRange(0, Logic::_scriptVars[SCROLL_OFFSET_X] + scrlDistX, Logic::_scriptVars[MAX_SCROLL_OFFSET_X]);
- Logic::_scriptVars[SCROLL_OFFSET_Y] = inRange(0, Logic::_scriptVars[SCROLL_OFFSET_Y] + scrlDistY, Logic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
+ Logic::_scriptVars[SCROLL_OFFSET_X] = CLIP<int32>(Logic::_scriptVars[SCROLL_OFFSET_X] + scrlDistX, 0, Logic::_scriptVars[MAX_SCROLL_OFFSET_X]);
+ Logic::_scriptVars[SCROLL_OFFSET_Y] = CLIP<int32>(Logic::_scriptVars[SCROLL_OFFSET_Y] + scrlDistY, 0, Logic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
} else {
// SCROLL_FLAG == 0, this usually means that the screen is smaller than 640x400 and doesn't need scrolling at all
// however, it can also mean that the gamescript overwrote the scrolling flag to take care of scrolling directly,
// (see bug report #1345130) so we ignore the offset arguments in this case
- Logic::_scriptVars[SCROLL_OFFSET_X] = inRange(0, Logic::_scriptVars[SCROLL_OFFSET_X], Logic::_scriptVars[MAX_SCROLL_OFFSET_X]);
- Logic::_scriptVars[SCROLL_OFFSET_Y] = inRange(0, Logic::_scriptVars[SCROLL_OFFSET_Y], Logic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
+ Logic::_scriptVars[SCROLL_OFFSET_X] = CLIP<int32>(Logic::_scriptVars[SCROLL_OFFSET_X], 0, Logic::_scriptVars[MAX_SCROLL_OFFSET_X]);
+ Logic::_scriptVars[SCROLL_OFFSET_Y] = CLIP<int32>(Logic::_scriptVars[SCROLL_OFFSET_Y], 0, Logic::_scriptVars[MAX_SCROLL_OFFSET_Y]);
if ((Logic::_scriptVars[SCROLL_OFFSET_X] != _oldScrollX) || (Logic::_scriptVars[SCROLL_OFFSET_Y] != _oldScrollY)) {
_fullRefresh = true;
_oldScrollX = Logic::_scriptVars[SCROLL_OFFSET_X];
@@ -134,13 +130,13 @@ void Screen::fadeUpPalette() {
}
void Screen::fnSetPalette(uint8 start, uint16 length, uint32 id, bool fadeUp) {
- uint8 *palData = (uint8*)_resMan->openFetchRes(id);
+ uint8 *palData = (uint8 *)_resMan->openFetchRes(id);
if (start == 0) // force color 0 to black
palData[0] = palData[1] = palData[2] = 0;
if (SwordEngine::isMac()) { // see bug #1701058
if (start != 0 && start + length == 256) // and force color 255 to black as well
- palData[(length-1)*3+0] = palData[(length-1)*3+1] = palData[(length-1)*3+2] = 0;
+ palData[(length - 1) * 3 + 0] = palData[(length - 1) * 3 + 1] = palData[(length - 1) * 3 + 2] = 0;
}
for (uint32 cnt = 0; cnt < length; cnt++) {
@@ -172,7 +168,7 @@ bool Screen::showScrollFrame() {
if ((!_fullRefresh) || Logic::_scriptVars[NEW_PALETTE] || _updatePalette)
return false; // don't draw an additional frame if we aren't scrolling or have to change the palette
if ((_oldScrollX == Logic::_scriptVars[SCROLL_OFFSET_X]) &&
- (_oldScrollY == Logic::_scriptVars[SCROLL_OFFSET_Y]))
+ (_oldScrollY == Logic::_scriptVars[SCROLL_OFFSET_Y]))
return false; // check again if we *really* are scrolling.
uint16 avgScrlX = (uint16)(_oldScrollX + Logic::_scriptVars[SCROLL_OFFSET_X]) / 2;
@@ -322,25 +318,25 @@ void Screen::newScreen(uint32 screen) {
if (SwordEngine::isPsx())
flushPsxCache();
- _screenBuf = (uint8*)malloc(_scrnSizeX * _scrnSizeY);
- _screenGrid = (uint8*)malloc(_gridSizeX * _gridSizeY);
+ _screenBuf = (uint8 *)malloc(_scrnSizeX * _scrnSizeY);
+ _screenGrid = (uint8 *)malloc(_gridSizeX * _gridSizeY);
memset(_screenGrid, 0, _gridSizeX * _gridSizeY);
for (cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers; cnt++) {
// open and lock all resources, will be closed in quitScreen()
- _layerBlocks[cnt] = (uint8*)_resMan->openFetchRes(_roomDefTable[_currentScreen].layers[cnt]);
+ _layerBlocks[cnt] = (uint8 *)_resMan->openFetchRes(_roomDefTable[_currentScreen].layers[cnt]);
if (cnt > 0)
_layerBlocks[cnt] += sizeof(Header);
}
for (cnt = 0; cnt < _roomDefTable[_currentScreen].totalLayers - 1; cnt++) {
// there's no grid for the background layer, so it's totalLayers - 1
- _layerGrid[cnt] = (uint16*)_resMan->openFetchRes(_roomDefTable[_currentScreen].grids[cnt]);
+ _layerGrid[cnt] = (uint16 *)_resMan->openFetchRes(_roomDefTable[_currentScreen].grids[cnt]);
_layerGrid[cnt] += 14;
}
_parallax[0] = _parallax[1] = NULL;
if (_roomDefTable[_currentScreen].parallax[0])
- _parallax[0] = (uint8*)_resMan->openFetchRes(_roomDefTable[_currentScreen].parallax[0]);
+ _parallax[0] = (uint8 *)_resMan->openFetchRes(_roomDefTable[_currentScreen].parallax[0]);
if (_roomDefTable[_currentScreen].parallax[1])
- _parallax[1] = (uint8*)_resMan->openFetchRes(_roomDefTable[_currentScreen].parallax[1]);
+ _parallax[1] = (uint8 *)_resMan->openFetchRes(_roomDefTable[_currentScreen].parallax[1]);
_updatePalette = true;
_fullRefresh = true;
@@ -393,13 +389,13 @@ void Screen::draw() {
src++;
dest++;
}
- }
+ }
} else if (!(SwordEngine::isPsx())) {
memcpy(_screenBuf, _layerBlocks[0], _scrnSizeX * _scrnSizeY);
} else { //We are using PSX version
if (_currentScreen == 45 || _currentScreen == 55 ||
- _currentScreen == 57 || _currentScreen == 63 || _currentScreen == 71) { // Width shrinked backgrounds
+ _currentScreen == 57 || _currentScreen == 63 || _currentScreen == 71) { // Width shrinked backgrounds
if (!_psxCache.decodedBackground)
_psxCache.decodedBackground = psxShrinkedBackgroundToIndexed(_layerBlocks[0], _scrnSizeX, _scrnSizeY);
} else {
@@ -431,7 +427,7 @@ void Screen::draw() {
if (!_psxCache.extPlxCache) {
Common::File parallax;
parallax.open("TRAIN.PLX");
- _psxCache.extPlxCache = (uint8*) malloc(parallax.size());
+ _psxCache.extPlxCache = (uint8 *)malloc(parallax.size());
parallax.read(_psxCache.extPlxCache, parallax.size());
parallax.close();
}
@@ -456,7 +452,7 @@ void Screen::processImage(uint32 id) {
else
frameHead = _resMan->fetchFrame(_resMan->openFetchRes(compact->o_resource), compact->o_frame);
- uint8 *sprData = ((uint8*)frameHead) + sizeof(FrameHeader);
+ uint8 *sprData = ((uint8 *)frameHead) + sizeof(FrameHeader);
uint16 spriteX = compact->o_anim_x;
uint16 spriteY = compact->o_anim_y;
@@ -474,8 +470,8 @@ void Screen::processImage(uint32 id) {
uint8 *tonyBuf = NULL;
uint8 *hifBuf = NULL;
if (SwordEngine::isPsx() && compact->o_type != TYPE_TEXT) { // PSX sprites are compressed with HIF
- hifBuf = (uint8*)malloc(_resMan->readUint16(&frameHead->width) * _resMan->readUint16(&frameHead->height)/2);
- memset(hifBuf, 0x00, (_resMan->readUint16(&frameHead->width) * _resMan->readUint16(&frameHead->height)/2));
+ hifBuf = (uint8 *)malloc(_resMan->readUint16(&frameHead->width) * _resMan->readUint16(&frameHead->height) / 2);
+ memset(hifBuf, 0x00, (_resMan->readUint16(&frameHead->width) * _resMan->readUint16(&frameHead->height) / 2));
decompressHIF(sprData, hifBuf);
sprData = hifBuf;
} else if (frameHead->runTimeComp[3] == '7') { // RLE7 encoded?
@@ -485,7 +481,7 @@ void Screen::processImage(uint32 id) {
decompressRLE0(sprData, _resMan->readUint32(&frameHead->compSize), _rleBuffer);
sprData = _rleBuffer;
} else if (frameHead->runTimeComp[1] == 'I') { // new type
- tonyBuf = (uint8*)malloc(_resMan->readUint16(&frameHead->width) * _resMan->readUint16(&frameHead->height));
+ tonyBuf = (uint8 *)malloc(_resMan->readUint16(&frameHead->width) * _resMan->readUint16(&frameHead->height));
decompressTony(sprData, _resMan->readUint32(&frameHead->compSize), tonyBuf);
sprData = tonyBuf;
}
@@ -538,16 +534,16 @@ void Screen::processImage(uint32 id) {
if ((sprSizeX > 0) && (sprSizeY > 0)) {
if ((!(SwordEngine::isPsx()) || (compact->o_type == TYPE_TEXT)
- || (compact->o_resource == LVSFLY) || (!(compact->o_resource == GEORGE_MEGA) && (sprSizeX < 260))))
+ || (compact->o_resource == LVSFLY) || (!(compact->o_resource == GEORGE_MEGA) && (sprSizeX < 260))))
drawSprite(sprData + incr, spriteX, spriteY, sprSizeX, sprSizeY, sprPitch);
else if (((sprSizeX >= 260) && (sprSizeX < 450)) || ((compact->o_resource == GMWRITH) && (sprSizeX < 515)) // a psx shrinked sprite (1/2 width)
- || ((compact->o_resource == GMPOWER) && (sprSizeX < 515))) // some needs to be hardcoded, headers don't give useful infos
+ || ((compact->o_resource == GMPOWER) && (sprSizeX < 515))) // some needs to be hardcoded, headers don't give useful infos
drawPsxHalfShrinkedSprite(sprData + incr, spriteX, spriteY, sprSizeX / 2, sprSizeY, sprPitch / 2);
else if (sprSizeX >= 450) // A PSX double shrinked sprite (1/3 width)
drawPsxFullShrinkedSprite(sprData + incr, spriteX, spriteY, sprSizeX / 3, sprSizeY, sprPitch / 3);
else // This is for psx half shrinked, walking george and remaining sprites
drawPsxHalfShrinkedSprite(sprData + incr, spriteX, spriteY, sprSizeX, sprSizeY, sprPitch);
- if (!(compact->o_status&STAT_FORE) && !(SwordEngine::isPsx() && (compact->o_resource == MOUBUSY))) // Check fixes moue sprite being masked by layer, happens only on psx
+ if (!(compact->o_status & STAT_FORE) && !(SwordEngine::isPsx() && (compact->o_resource == MOUBUSY))) // Check fixes moue sprite being masked by layer, happens only on psx
verticalMask(spriteX, spriteY, sprSizeX, sprSizeY);
}
@@ -636,8 +632,8 @@ void Screen::renderParallax(uint8 *data) {
if (SwordEngine::isPsx()) //Parallax headers are different in PSX version
fetchPsxParallaxSize(data, &paraSizeX, &paraSizeY);
else {
- header = (ParallaxHeader*)data;
- lineIndexes = (uint32*)(data + sizeof(ParallaxHeader));
+ header = (ParallaxHeader *)data;
+ lineIndexes = (uint32 *)(data + sizeof(ParallaxHeader));
paraSizeX = _resMan->getUint16(header->sizeX);
paraSizeY = _resMan->getUint16(header->sizeY);
}
@@ -832,7 +828,7 @@ void Screen::addToGraphicList(uint8 listId, uint32 objId) {
_sortList[_sortLength].id = objId;
_sortList[_sortLength].y = cpt->o_anim_y; // gives feet coords if boxed mega, otherwise top of sprite box
if (!(cpt->o_status & STAT_SHRINK)) { // not a boxed mega using shrinking
- Header *frameRaw = (Header*)_resMan->openFetchRes(cpt->o_resource);
+ Header *frameRaw = (Header *)_resMan->openFetchRes(cpt->o_resource);
FrameHeader *frameHead = _resMan->fetchFrame(frameRaw, cpt->o_frame);
_sortList[_sortLength].y += _resMan->readUint16(&frameHead->height) - 1; // now pointing to base of sprite
_resMan->resClose(cpt->o_resource);
@@ -845,7 +841,7 @@ void Screen::addToGraphicList(uint8 listId, uint32 objId) {
}
}
-uint8* Screen::psxBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint32 bakYres) {
+uint8 *Screen::psxBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint32 bakYres) {
uint32 xresInTiles = bakXres / 16;
uint32 yresInTiles = ((bakYres / 2) % 16) ? (bakYres / 32) + 1 : (bakYres / 32);
uint32 totTiles = xresInTiles * yresInTiles;
@@ -867,7 +863,7 @@ uint8* Screen::psxBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint
if (isCompressed)
decompressHIF(psxBackground + tileOffset - 4, decomp_tile); //Decompress the tile into decomp_tile
else
- memcpy(decomp_tile, psxBackground + tileOffset - 4, 16*16);
+ memcpy(decomp_tile, psxBackground + tileOffset - 4, 16 * 16);
if (currentTile > 0 && !(currentTile % xresInTiles)) { //Finished a line of tiles, going down
tileYpos++;
@@ -887,7 +883,7 @@ uint8* Screen::psxBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint
}
// needed because some psx backgrounds are half width and half height
-uint8* Screen::psxShrinkedBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint32 bakYres) {
+uint8 *Screen::psxShrinkedBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint32 bakYres) {
uint32 xresInTiles = ((bakXres / 2) % 16) ? (bakXres / 32) + 1 : (bakXres / 32);
uint32 yresInTiles = ((bakYres / 2) % 16) ? (bakYres / 32) + 1 : (bakYres / 32);
uint32 totTiles = xresInTiles * yresInTiles;
@@ -899,7 +895,7 @@ uint8* Screen::psxShrinkedBackgroundToIndexed(uint8 *psxBackground, uint32 bakXr
uint8 *fullres_buffer = (uint8 *)malloc(bakXres * (yresInTiles + 1) * 32);
memset(fullres_buffer, 0, bakXres * (yresInTiles + 1) * 32);
- bool isCompressed = (READ_LE_UINT32(psxBackground) == MKTAG('C','O','M','P'));
+ bool isCompressed = (READ_LE_UINT32(psxBackground) == MKTAG('C', 'O', 'M', 'P'));
totTiles -= xresInTiles;
psxBackground += 4; //We skip the id tag
@@ -1182,7 +1178,7 @@ void Screen::spriteClipAndSet(uint16 *pSprX, uint16 *pSprY, uint16 *pSprWidth, u
if (*pSprWidth && *pSprHeight) {
// sprite will be drawn, so mark it in the grid buffer
uint16 gridH = (*pSprHeight + (sprY & (SCRNGRID_Y - 1)) + (SCRNGRID_Y - 1)) / SCRNGRID_Y;
- uint16 gridW = (*pSprWidth + (sprX & (SCRNGRID_X - 1)) + (SCRNGRID_X - 1)) / SCRNGRID_X;
+ uint16 gridW = (*pSprWidth + (sprX & (SCRNGRID_X - 1)) + (SCRNGRID_X - 1)) / SCRNGRID_X;
if (SwordEngine::isPsx()) {
gridH *= 2; // This will correct the PSX sprite being cut at half height
@@ -1229,10 +1225,10 @@ void Screen::showFrame(uint16 x, uint16 y, uint32 resId, uint32 frameNo, const b
if (resId != 0xffffffff) {
FrameHeader *frameHead = _resMan->fetchFrame(_resMan->openFetchRes(resId), frameNo);
- uint8 *frameData = ((uint8*)frameHead) + sizeof(FrameHeader);
+ uint8 *frameData = ((uint8 *)frameHead) + sizeof(FrameHeader);
if (SwordEngine::isPsx()) { //We need to decompress PSX frames
- uint8 *frameBufferPSX = (uint8 *)malloc(_resMan->getUint16(frameHead->width) * _resMan->getUint16(frameHead->height)/2);
+ uint8 *frameBufferPSX = (uint8 *)malloc(_resMan->getUint16(frameHead->width) * _resMan->getUint16(frameHead->height) / 2);
decompressHIF(frameData, frameBufferPSX);
for (i = 0; i < _resMan->getUint16(frameHead->height) / 2; i++) {
diff --git a/engines/sword1/screen.h b/engines/sword1/screen.h
index ff4df8c7c6..7586e937a7 100644
--- a/engines/sword1/screen.h
+++ b/engines/sword1/screen.h
@@ -38,14 +38,14 @@ struct SortSpr {
};
struct RoomDef {
- int totalLayers;
- int sizeX;
- int sizeY;
- int gridWidth; //number of 16*16 grid blocks across - including off screen edges.
- uint32 layers[4];
- uint32 grids[3];
- uint32 palettes[2];
- uint32 parallax[2];
+ int totalLayers;
+ int sizeX;
+ int sizeY;
+ int gridWidth; //number of 16*16 grid blocks across - including off screen edges.
+ uint32 layers[4];
+ uint32 grids[3];
+ uint32 palettes[2];
+ uint32 parallax[2];
};
struct PSXDataCache { // Cache for PSX screen, to avoid decompressing background at every screen update
@@ -68,7 +68,7 @@ struct PSXDataCache { // Cache for PSX screen, to avoid decompressing background
class ResMan;
class ObjectMan;
class Text; // Text objects use sprites that are created internally at run-time
- // the buffer belongs to Text, so we need a reference here.
+ // the buffer belongs to Text, so we need a reference here.
class Screen {
public:
@@ -118,15 +118,14 @@ private:
void drawSprite(uint8 *sprData, uint16 sprX, uint16 sprY, uint16 sprWidth, uint16 sprHeight, uint16 sprPitch);
void drawPsxHalfShrinkedSprite(uint8 *sprData, uint16 sprX, uint16 sprY, uint16 sprWidth, uint16 sprHeight, uint16 sprPitch);
void drawPsxFullShrinkedSprite(uint8 *sprData, uint16 sprX, uint16 sprY, uint16 sprWidth, uint16 sprHeight, uint16 sprPitch);
- uint8* psxBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint32 bakYres);
- uint8* psxShrinkedBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint32 bakYres);
+ uint8 *psxBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint32 bakYres);
+ uint8 *psxShrinkedBackgroundToIndexed(uint8 *psxBackground, uint32 bakXres, uint32 bakYres);
void fetchPsxParallaxSize(uint8 *psxParallax, uint16 *paraSizeX, uint16 *paraSizeY);
void drawPsxParallax(uint8 *psxParallax, uint16 paraScrlX, uint16 scrnScrlX, uint16 scrnWidth);
void decompressRLE7(uint8 *src, uint32 compSize, uint8 *dest);
void decompressRLE0(uint8 *src, uint32 compSize, uint8 *dest);
void decompressTony(uint8 *src, uint32 compSize, uint8 *dest);
void fastShrink(uint8 *src, uint32 width, uint32 height, uint32 scale, uint8 *dest);
- int32 inRange(int32 a, int32 b, int32 c);
void fadePalette();
void flushPsxCache();
@@ -163,7 +162,7 @@ private:
uint8 _fadingStep;
int8 _fadingDirection; // 1 for fade up, -1 for fade down
bool _isBlack; // if the logic already faded down the palette, this is set to show the
- // mainloop that no further fading is necessary.
+ // mainloop that no further fading is necessary.
};
} // End of namespace Sword1
diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp
index 677a9869ce..b74cd8c393 100644
--- a/engines/sword1/sound.cpp
+++ b/engines/sword1/sound.cpp
@@ -124,10 +124,10 @@ void Sound::checkSpeechFileEndianness() {
size = 2000;
else
size /= 2;
- int16 prev_be_value = (int16)SWAP_BYTES_16(*((uint16*)(data)));
+ int16 prev_be_value = (int16)SWAP_BYTES_16(*((uint16 *)(data)));
for (uint32 i = 1; i < size; ++i) {
- le_diff_sum += fabs((double)(data[i] - data[i-1]));
- int16 be_value = (int16)SWAP_BYTES_16(*((uint16*)(data + i)));
+ le_diff_sum += fabs((double)(data[i] - data[i - 1]));
+ int16 be_value = (int16)SWAP_BYTES_16(*((uint16 *)(data + i)));
be_diff_sum += fabs((double)(be_value - prev_be_value));
prev_be_value = be_value;
}
@@ -187,7 +187,7 @@ void Sound::engine() {
} else {
if (!_mixer->isSoundHandleActive(_fxQueue[cnt2].handle)) { // sound finished
_resMan->resClose(_fxList[_fxQueue[cnt2].id].sampleId);
- if (cnt2 != _endOfQueue-1)
+ if (cnt2 != _endOfQueue - 1)
_fxQueue[cnt2] = _fxQueue[_endOfQueue - 1];
_endOfQueue--;
}
@@ -201,8 +201,8 @@ void Sound::fnStopFx(int32 fxNo) {
if (_fxQueue[cnt].id == (uint32)fxNo) {
if (!_fxQueue[cnt].delay) // sound was started
_resMan->resClose(_fxList[_fxQueue[cnt].id].sampleId);
- if (cnt != _endOfQueue-1)
- _fxQueue[cnt] = _fxQueue[_endOfQueue-1];
+ if (cnt != _endOfQueue - 1)
+ _fxQueue[cnt] = _fxQueue[_endOfQueue - 1];
_endOfQueue--;
return;
}
@@ -243,36 +243,36 @@ void Sound::quitScreen() {
}
void Sound::playSample(QueueElement *elem) {
- uint8 *sampleData = (uint8*)_resMan->fetchRes(_fxList[elem->id].sampleId);
+ uint8 *sampleData = (uint8 *)_resMan->fetchRes(_fxList[elem->id].sampleId);
for (uint16 cnt = 0; cnt < MAX_ROOMS_PER_FX; cnt++) {
if (_fxList[elem->id].roomVolList[cnt].roomNo) {
if ((_fxList[elem->id].roomVolList[cnt].roomNo == (int)Logic::_scriptVars[SCREEN]) ||
- (_fxList[elem->id].roomVolList[cnt].roomNo == -1)) {
-
- uint8 volL = (_fxList[elem->id].roomVolList[cnt].leftVol * 10 * _sfxVolL) / 255;
- uint8 volR = (_fxList[elem->id].roomVolList[cnt].rightVol * 10 * _sfxVolR) / 255;
- int8 pan = (volR - volL) / 2;
- uint8 volume = (volR + volL) / 2;
-
- if (SwordEngine::isPsx()) {
- // We ignore FX_LOOP as XA has its own looping mechanism
- uint32 size = READ_LE_UINT32(sampleData);
- Audio::AudioStream *audStream = Audio::makeXAStream(new Common::MemoryReadStream(sampleData + 4, size-4), 11025);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &elem->handle, audStream, elem->id, volume, pan);
- } else {
- uint32 size = READ_LE_UINT32(sampleData + 0x28);
- uint8 flags;
- if (READ_LE_UINT16(sampleData + 0x22) == 16)
- flags = Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN;
- else
- flags = Audio::FLAG_UNSIGNED;
- if (READ_LE_UINT16(sampleData + 0x16) == 2)
- flags |= Audio::FLAG_STEREO;
- Audio::AudioStream *stream = Audio::makeLoopingAudioStream(
- Audio::makeRawStream(sampleData + 0x2C, size, 11025, flags, DisposeAfterUse::NO),
- (_fxList[elem->id].type == FX_LOOP) ? 0 : 1);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, &elem->handle, stream, elem->id, volume, pan);
- }
+ (_fxList[elem->id].roomVolList[cnt].roomNo == -1)) {
+
+ uint8 volL = (_fxList[elem->id].roomVolList[cnt].leftVol * 10 * _sfxVolL) / 255;
+ uint8 volR = (_fxList[elem->id].roomVolList[cnt].rightVol * 10 * _sfxVolR) / 255;
+ int8 pan = (volR - volL) / 2;
+ uint8 volume = (volR + volL) / 2;
+
+ if (SwordEngine::isPsx()) {
+ // We ignore FX_LOOP as XA has its own looping mechanism
+ uint32 size = READ_LE_UINT32(sampleData);
+ Audio::AudioStream *audStream = Audio::makeXAStream(new Common::MemoryReadStream(sampleData + 4, size - 4), 11025);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &elem->handle, audStream, elem->id, volume, pan);
+ } else {
+ uint32 size = READ_LE_UINT32(sampleData + 0x28);
+ uint8 flags;
+ if (READ_LE_UINT16(sampleData + 0x22) == 16)
+ flags = Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN;
+ else
+ flags = Audio::FLAG_UNSIGNED;
+ if (READ_LE_UINT16(sampleData + 0x16) == 2)
+ flags |= Audio::FLAG_STEREO;
+ Audio::AudioStream *stream = Audio::makeLoopingAudioStream(
+ Audio::makeRawStream(sampleData + 0x2C, size, 11025, flags, DisposeAfterUse::NO),
+ (_fxList[elem->id].type == FX_LOOP) ? 0 : 1);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, &elem->handle, stream, elem->id, volume, pan);
+ }
}
} else
break;
@@ -294,7 +294,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
uint16 i;
if (!file.open("speech.lis")) {
- warning ("Could not open speech.lis");
+ warning("Could not open speech.lis");
return false;
}
@@ -306,12 +306,12 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
file.close();
if (locIndex == 0xFFFFFFFF) {
- warning ("Could not find room %d in speech.lis", roomNo);
+ warning("Could not find room %d in speech.lis", roomNo);
return false;
}
if (!file.open("speech.inf")) {
- warning ("Could not open speech.inf");
+ warning("Could not open speech.inf");
return false;
}
@@ -333,7 +333,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
}
if (locIndex == 0xFFFFFFFF) {
- warning ("Could not find local number %d in room %d in speech.inf", roomNo, localNo);
+ warning("Could not find local number %d in room %d in speech.inf", roomNo, localNo);
return false;
}
@@ -421,7 +421,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
}
int16 *Sound::uncompressSpeech(uint32 index, uint32 cSize, uint32 *size) {
- uint8 *fBuf = (uint8*)malloc(cSize);
+ uint8 *fBuf = (uint8 *)malloc(cSize);
_cowFile.seek(index);
_cowFile.read(fBuf, cSize);
uint32 headerPos = 0;
@@ -456,7 +456,7 @@ int16 *Sound::uncompressSpeech(uint32 index, uint32 cSize, uint32 *size) {
resSize >>= 1;
} else {
resSize = 0;
- srcData = (int16*)fBuf;
+ srcData = (int16 *)fBuf;
srcPos = headerPos >> 1;
while (srcPos < cSize) {
length = (int16)READ_LE_UINT16(srcData + srcPos);
@@ -472,10 +472,10 @@ int16 *Sound::uncompressSpeech(uint32 index, uint32 cSize, uint32 *size) {
}
}
assert(!(headerPos & 1));
- srcData = (int16*)fBuf;
+ srcData = (int16 *)fBuf;
srcPos = headerPos >> 1;
uint32 dstPos = 0;
- int16 *dstData = (int16*)malloc(resSize * 2);
+ int16 *dstData = (int16 *)malloc(resSize * 2);
int32 samplesLeft = resSize;
while (srcPos < cSize && samplesLeft > 0) {
length = (int16)(_bigEndianSpeech ? READ_BE_UINT16(srcData + srcPos) : READ_LE_UINT16(srcData + srcPos));
@@ -486,7 +486,7 @@ int16 *Sound::uncompressSpeech(uint32 index, uint32 cSize, uint32 *size) {
length = samplesLeft;
int16 value;
if (_bigEndianSpeech) {
- value = (int16)SWAP_BYTES_16(*((uint16*)(srcData + srcPos)));
+ value = (int16)SWAP_BYTES_16(*((uint16 *)(srcData + srcPos)));
} else {
value = srcData[srcPos];
}
@@ -498,7 +498,7 @@ int16 *Sound::uncompressSpeech(uint32 index, uint32 cSize, uint32 *size) {
length = samplesLeft;
if (_bigEndianSpeech) {
for (uint16 cnt = 0; cnt < (uint16)length; cnt++)
- dstData[dstPos++] = (int16)SWAP_BYTES_16(*((uint16*)(srcData + (srcPos++))));
+ dstData[dstPos++] = (int16)SWAP_BYTES_16(*((uint16 *)(srcData + (srcPos++))));
} else {
memcpy(dstData + dstPos, srcData + srcPos, length * 2);
dstPos += length;
@@ -511,7 +511,7 @@ int16 *Sound::uncompressSpeech(uint32 index, uint32 cSize, uint32 *size) {
memset(dstData + dstPos, 0, samplesLeft * 2);
}
if (_cowMode == CowDemo) // demo has wave output size embedded in the compressed data
- *(uint32*)dstData = 0;
+ *(uint32 *)dstData = 0;
free(fBuf);
*size = resSize * 2;
calcWaveVolume(dstData, resSize);
@@ -607,7 +607,7 @@ void Sound::initCowSystem() {
_currentCowFile = SwordEngine::_systemVars.currentCD;
if (!_cowFile.isOpen()) {
if (!_cowFile.open("speech.dat"))
- error ("Could not open speech.dat");
+ error("Could not open speech.dat");
_cowMode = CowPSX;
}
}
@@ -626,7 +626,7 @@ void Sound::initCowSystem() {
// Get data from the external table file
Common::File tableFile;
if (!tableFile.open("speech.tab"))
- error ("Could not open speech.tab");
+ error("Could not open speech.tab");
_cowHeaderSize = tableFile.size();
_cowHeader = (uint32 *)malloc(_cowHeaderSize);
if (_cowHeaderSize & 3)
@@ -635,7 +635,7 @@ void Sound::initCowSystem() {
_cowHeader[cnt] = tableFile.readUint32LE();
} else {
_cowHeaderSize = _cowFile.readUint32LE();
- _cowHeader = (uint32*)malloc(_cowHeaderSize);
+ _cowHeader = (uint32 *)malloc(_cowHeaderSize);
if (_cowHeaderSize & 3)
error("Unexpected cow header size %d", _cowHeaderSize);
for (uint32 cnt = 0; cnt < (_cowHeaderSize / 4) - 1; cnt++)
diff --git a/engines/sword1/sound.h b/engines/sword1/sound.h
index a6313f85eb..112ae5b6aa 100644
--- a/engines/sword1/sound.h
+++ b/engines/sword1/sound.h
@@ -36,9 +36,9 @@ class Mixer;
namespace Sword1 {
-#define TOTAL_FX_PER_ROOM 7 // total loop & random fx per room (see fx_list.c)
-#define MAX_ROOMS_PER_FX 7 // max no. of rooms in the fx's room,vol list
-#define MAX_FXQ_LENGTH 32 // max length of sound queue - ie. max number of fx that can be stored up/playing together
+#define TOTAL_FX_PER_ROOM 7 // total loop & random fx per room (see fx_list.c)
+#define MAX_ROOMS_PER_FX 7 // max no. of rooms in the fx's room,vol list
+#define MAX_FXQ_LENGTH 32 // max length of sound queue - ie. max number of fx that can be stored up/playing together
#define FX_SPOT 1
#define FX_LOOP 2
@@ -105,15 +105,15 @@ private:
bool _waveVolume[WAVE_VOL_TAB_LENGTH];
uint16 _waveVolPos;
Common::File _cowFile;
- uint32 *_cowHeader;
- uint32 _cowHeaderSize;
- uint8 _currentCowFile;
- CowMode _cowMode;
+ uint32 *_cowHeader;
+ uint32 _cowHeaderSize;
+ uint8 _currentCowFile;
+ CowMode _cowMode;
Audio::SoundHandle _speechHandle, _fxHandle;
Common::RandomSource _rnd;
QueueElement _fxQueue[MAX_FXQ_LENGTH];
- uint8 _endOfQueue;
+ uint8 _endOfQueue;
Audio::Mixer *_mixer;
ResMan *_resMan;
bool _bigEndianSpeech;
diff --git a/engines/sword1/staticres.cpp b/engines/sword1/staticres.cpp
index 402e349576..60c6877232 100644
--- a/engines/sword1/staticres.cpp
+++ b/engines/sword1/staticres.cpp
@@ -7055,7 +7055,7 @@ const uint8 g_genWhiteCoat[] = {
INIT_SEQ_END
};
-const uint8 *Logic::_startData[] = {
+const uint8 *const Logic::_startData[] = {
g_startPos0,
g_startPos1,
g_startPos2,
@@ -7139,7 +7139,7 @@ const uint8 *Logic::_startData[] = {
g_startPos80
};
-const uint8 *Logic::_helperData[] = {
+const uint8 *const Logic::_helperData[] = {
g_genIreland,
g_genSyria,
g_genSpain,
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index 23dff4dec2..865e025786 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -48,9 +48,9 @@ SystemVars SwordEngine::_systemVars;
SwordEngine::SwordEngine(OSystem *syst)
: Engine(syst) {
- if (!scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1demo") ||
- !scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1psxdemo") ||
- !scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1macdemo"))
+ if (!scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1demo") ||
+ !scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1psxdemo") ||
+ !scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1macdemo"))
_features = GF_DEMO;
else
_features = 0;
@@ -85,11 +85,11 @@ Common::Error SwordEngine::init() {
initGraphics(640, 480, true);
- if ( 0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1mac") ||
- 0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1macdemo") )
+ if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1mac") ||
+ 0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1macdemo"))
_systemVars.platform = Common::kPlatformMacintosh;
- else if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1psx") ||
- 0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1psxdemo") )
+ else if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1psx") ||
+ 0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1psxdemo"))
_systemVars.platform = Common::kPlatformPSX;
else
_systemVars.platform = Common::kPlatformWindows;
@@ -240,7 +240,7 @@ void SwordEngine::flagsToBool(bool *dest, uint8 flags) {
}
}
-static const char *errorMsgs[] = {
+static const char *const errorMsgs[] = {
"The file \"%s\" is missing and the game doesn't work without it.\n"
"Please copy it from CD %d and try starting the game again.\n"
"The Readme file also contains further information.",
@@ -279,18 +279,18 @@ const CdFile SwordEngine::_pcCdFileList[] = {
{ "text.clu", FLAG_CD1 | FLAG_DEMO },
{ "cows.mad", FLAG_DEMO },
{ "speech1.clu", FLAG_SPEECH1 },
- { "speech2.clu", FLAG_SPEECH2 }
+ { "speech2.clu", FLAG_SPEECH2 }
#ifdef USE_FLAC
- ,{ "speech1.clf", FLAG_SPEECH1 },
- { "speech2.clf", FLAG_SPEECH2 }
+ , { "speech1.clf", FLAG_SPEECH1 },
+ { "speech2.clf", FLAG_SPEECH2 }
#endif
#ifdef USE_VORBIS
- ,{ "speech1.clv", FLAG_SPEECH1 },
- { "speech2.clv", FLAG_SPEECH2 }
+ , { "speech1.clv", FLAG_SPEECH1 },
+ { "speech2.clv", FLAG_SPEECH2 }
#endif
#ifdef USE_MAD
- ,{ "speech1.cl3", FLAG_SPEECH1 },
- { "speech2.cl3", FLAG_SPEECH2 }
+ , { "speech1.cl3", FLAG_SPEECH1 },
+ { "speech2.cl3", FLAG_SPEECH2 }
#endif
};
@@ -311,18 +311,18 @@ const CdFile SwordEngine::_macCdFileList[] = {
{ "swordres.rif", FLAG_CD1 | FLAG_DEMO | FLAG_IMMED },
{ "text.clm", FLAG_CD1 | FLAG_DEMO },
{ "speech1.clu", FLAG_SPEECH1 },
- { "speech2.clu", FLAG_SPEECH2 }
+ { "speech2.clu", FLAG_SPEECH2 }
#ifdef USE_FLAC
,{ "speech1.clf", FLAG_SPEECH1 },
- { "speech2.clf", FLAG_SPEECH2 }
+ { "speech2.clf", FLAG_SPEECH2 }
#endif
#ifdef USE_VORBIS
,{ "speech1.clv", FLAG_SPEECH1 },
- { "speech2.clv", FLAG_SPEECH2 }
+ { "speech2.clv", FLAG_SPEECH2 }
#endif
#ifdef USE_MAD
,{ "speech1.cl3", FLAG_SPEECH1 },
- { "speech2.cl3", FLAG_SPEECH2 }
+ { "speech2.cl3", FLAG_SPEECH2 }
#endif
};
@@ -364,7 +364,7 @@ void SwordEngine::showFileErrorMsg(uint8 type, bool *fileExists) {
int msgId = (type == TYPE_IMMED) ? 0 : 2;
if (missCnt == 1) {
sprintf(msg, errorMsgs[msgId],
- _macCdFileList[missNum].name, (_macCdFileList[missNum].flags & FLAG_CD2) ? 2 : 1);
+ _macCdFileList[missNum].name, (_macCdFileList[missNum].flags & FLAG_CD2) ? 2 : 1);
warning("%s", msg);
} else {
char *pos = msg + sprintf(msg, errorMsgs[msgId + 1], missCnt);
@@ -407,7 +407,7 @@ void SwordEngine::showFileErrorMsg(uint8 type, bool *fileExists) {
int msgId = (type == TYPE_IMMED) ? 0 : 2;
if (missCnt == 1) {
sprintf(msg, errorMsgs[msgId],
- _pcCdFileList[missNum].name, (_pcCdFileList[missNum].flags & FLAG_CD2) ? 2 : 1);
+ _pcCdFileList[missNum].name, (_pcCdFileList[missNum].flags & FLAG_CD2) ? 2 : 1);
warning("%s", msg);
} else {
char *pos = msg + sprintf(msg, errorMsgs[msgId + 1], missCnt);
@@ -454,9 +454,9 @@ void SwordEngine::checkCdFiles() { // check if we're running from cd, hdd or wha
if (Common::File::exists(_psxCdFileList[fcnt].name)) {
fileExists[fcnt] = true;
flagsToBool(foundTypes, _psxCdFileList[fcnt].flags);
- if (!(_psxCdFileList[fcnt].flags & FLAG_DEMO))
+ if (!(_psxCdFileList[fcnt].flags & FLAG_DEMO))
isFullVersion = true;
- cd2FilesFound = true;
+ cd2FilesFound = true;
} else {
flagsToBool(missingTypes, _psxCdFileList[fcnt].flags);
fileExists[fcnt] = false;
@@ -486,9 +486,9 @@ void SwordEngine::checkCdFiles() { // check if we're running from cd, hdd or wha
if (foundTypes[TYPE_SPEECH2]) // same for speech2
missingTypes[TYPE_SPEECH2] = false;
- if (isFullVersion) // if this is the full version...
+ if (isFullVersion) // if this is the full version...
missingTypes[TYPE_DEMO] = false; // then we don't need demo files...
- else // and vice versa
+ else // and vice versa
missingTypes[TYPE_SPEECH1] = missingTypes[TYPE_SPEECH2] = missingTypes[TYPE_CD1] = missingTypes[TYPE_CD2] = false;
bool somethingMissing = false;
@@ -526,13 +526,13 @@ void SwordEngine::checkCdFiles() { // check if we're running from cd, hdd or wha
showFileErrorMsg(TYPE_IMMED, fileExists);
} else if ((!missingTypes[TYPE_CD1]) && !cd2FilesFound) {
/* we have all the data from cd one, but not a single one from CD2.
- I'm not sure how we should handle this, for now I'll just assume that the
- user has set up the extrapath correctly and copied the necessary files to HDD.
- A quite optimistic assumption, I'd say. Maybe we should change this for the release
- to warn the user? */
+ I'm not sure how we should handle this, for now I'll just assume that the
+ user has set up the extrapath correctly and copied the necessary files to HDD.
+ A quite optimistic assumption, I'd say. Maybe we should change this for the release
+ to warn the user? */
warning("CD2 data files not found. I hope you know what you're doing and that\n"
- "you have set up the extrapath and additional data correctly.\n"
- "If you didn't, you should better read the ScummVM readme file");
+ "you have set up the extrapath and additional data correctly.\n"
+ "If you didn't, you should better read the ScummVM readme file");
_systemVars.runningFromCd = true;
_systemVars.playSpeech = true;
} else if (missingTypes[TYPE_CD1] || missingTypes[TYPE_CD2]) {
@@ -542,13 +542,13 @@ void SwordEngine::checkCdFiles() { // check if we're running from cd, hdd or wha
// not so important, but there won't be any voices
if (missingTypes[TYPE_SPEECH1] && missingTypes[TYPE_SPEECH2])
warning("Unable to find the speech files. The game will work, but you won't hear any voice output.\n"
- "Please copy the SPEECH.CLU files from both CDs and rename them to SPEECH1.CLU and SPEECH2.CLU,\n"
- "corresponding to the CD number.\n"
- "Please read the ScummVM Readme file for more information");
+ "Please copy the SPEECH.CLU files from both CDs and rename them to SPEECH1.CLU and SPEECH2.CLU,\n"
+ "corresponding to the CD number.\n"
+ "Please read the ScummVM Readme file for more information");
else
warning("Unable to find the speech file from CD %d.\n"
- "You won't hear any voice output in that part of the game.\n"
- "Please read the ScummVM Readme file for more information", missingTypes[TYPE_SPEECH1] ? 1 : 2);
+ "You won't hear any voice output in that part of the game.\n"
+ "Please read the ScummVM Readme file for more information", missingTypes[TYPE_SPEECH1] ? 1 : 2);
} else if (missingTypes[TYPE_DEMO]) {
// for the demo version, we simply expect to have all files immediately
showFileErrorMsg(TYPE_IMMED, fileExists);
@@ -618,9 +618,9 @@ void SwordEngine::checkCd() {
_music->startMusic(0, 0); //
_sound->closeCowSystem(); // close music and sound files before changing CDs
_systemVars.currentCD = needCd; // askForCd will ask the player to insert _systemVars.currentCd,
- _control->askForCd(); // so it has to be updated before calling it.
+ _control->askForCd(); // so it has to be updated before calling it.
}
- } else { // we're running from HDD, we don't have to care about music files and Sound will take care of
+ } else { // we're running from HDD, we don't have to care about music files and Sound will take care of
if (needCd) // switching sound.clu files on Sound::newScreen by itself, so there's nothing to be done.
_systemVars.currentCD = needCd;
else if (_systemVars.currentCD == 0)
@@ -673,7 +673,7 @@ uint8 SwordEngine::mainLoop() {
// The control panel is triggered by F5 or ESC.
else if (((_keyPressed.keycode == Common::KEYCODE_F5 || _keyPressed.keycode == Common::KEYCODE_ESCAPE)
- && (Logic::_scriptVars[MOUSE_STATUS] & 1)) || (_systemVars.controlPanelMode)) {
+ && (Logic::_scriptVars[MOUSE_STATUS] & 1)) || (_systemVars.controlPanelMode)) {
retCode = _control->runPanel();
if (retCode == CONTROL_NOTHING_DONE)
_screen->fullRefresh();
diff --git a/engines/sword1/sword1.h b/engines/sword1/sword1.h
index 2d6db21d19..e973c12754 100644
--- a/engines/sword1/sword1.h
+++ b/engines/sword1/sword1.h
@@ -63,16 +63,16 @@ class Music;
class Control;
struct SystemVars {
- bool runningFromCd;
- uint32 currentCD; // starts at zero, then either 1 or 2 depending on section being played
- uint32 justRestoredGame; // see main() in sword.c & New_screen() in gtm_core.c
-
- uint8 controlPanelMode; // 1 death screen version of the control panel, 2 = successful end of game, 3 = force restart
- bool forceRestart;
- bool wantFade; // when true => fade during scene change, else cut.
- uint8 playSpeech;
- uint8 showText;
- uint8 language;
+ bool runningFromCd;
+ uint32 currentCD; // starts at zero, then either 1 or 2 depending on section being played
+ uint32 justRestoredGame; // see main() in sword.c & New_screen() in gtm_core.c
+
+ uint8 controlPanelMode; // 1 death screen version of the control panel, 2 = successful end of game, 3 = force restart
+ bool forceRestart;
+ bool wantFade; // when true => fade during scene change, else cut.
+ uint8 playSpeech;
+ uint8 showText;
+ uint8 language;
bool isDemo;
Common::Platform platform;
};
@@ -131,18 +131,18 @@ private:
uint16 _mouseState;
Common::KeyState _keyPressed;
- ResMan *_resMan;
- ObjectMan *_objectMan;
- Screen *_screen;
- Mouse *_mouse;
- Logic *_logic;
- Sound *_sound;
- Menu *_menu;
- Music *_music;
- Control *_control;
+ ResMan *_resMan;
+ ObjectMan *_objectMan;
+ Screen *_screen;
+ Mouse *_mouse;
+ Logic *_logic;
+ Sound *_sound;
+ Menu *_menu;
+ Music *_music;
+ Control *_control;
static const uint8 _cdList[TOTAL_SECTIONS];
- static const CdFile _pcCdFileList[];
- static const CdFile _macCdFileList[];
+ static const CdFile _pcCdFileList[];
+ static const CdFile _macCdFileList[];
static const CdFile _psxCdFileList[];
};
diff --git a/engines/sword1/sworddefs.h b/engines/sword1/sworddefs.h
index 15736dcae0..db4146f37e 100644
--- a/engines/sword1/sworddefs.h
+++ b/engines/sword1/sworddefs.h
@@ -29,13 +29,13 @@ namespace Sword1 {
#define LOOPED 1
-#define FRAME_RATE 12 // number of frames per second (max rate)
-#define SCREEN_WIDTH 640
-#define SCREEN_DEPTH 400
-#define SCREEN_LEFT_EDGE 128
-#define SCREEN_RIGHT_EDGE (128+SCREEN_WIDTH-1)
-#define SCREEN_TOP_EDGE 128
-#define SCREEN_BOTTOM_EDGE (128+SCREEN_DEPTH-1)
+#define FRAME_RATE 12 // number of frames per second (max rate)
+#define SCREEN_WIDTH 640
+#define SCREEN_DEPTH 400
+#define SCREEN_LEFT_EDGE 128
+#define SCREEN_RIGHT_EDGE (128+SCREEN_WIDTH-1)
+#define SCREEN_TOP_EDGE 128
+#define SCREEN_BOTTOM_EDGE (128+SCREEN_DEPTH-1)
#define TYPE_FLOOR 1
#define TYPE_MOUSE 2
#define TYPE_SPRITE 3
@@ -81,22 +81,22 @@ namespace Sword1 {
#define TOTAL_subjects (375-256+1)
#define BASE_SUBJECT 256
-#define TOTAL_SECTIONS 150 //number of sections, rooms + mega sections
-#define TOTAL_ROOMS 100 //total number of rooms
-#define ITM_PER_SEC 0x10000 //65536 items per section -> was originally called "SIZE"
-#define ITM_ID 0xFFFF //& with this -> originally "NuSIZE"
+#define TOTAL_SECTIONS 150 //number of sections, rooms + mega sections
+#define TOTAL_ROOMS 100 //total number of rooms
+#define ITM_PER_SEC 0x10000 //65536 items per section -> was originally called "SIZE"
+#define ITM_ID 0xFFFF //& with this -> originally "NuSIZE"
-#define MAX_text_obs 2 //text compacts
-#define TEXT_sect 149 //text compacts exist in section 149, probably after all the megas
+#define MAX_text_obs 2 //text compacts
+#define TEXT_sect 149 //text compacts exist in section 149, probably after all the megas
-#include "common/pack-start.h" // START STRUCT PACKING
+#include "common/pack-start.h" // START STRUCT PACKING
struct Header {
char type[6];
uint16 version;
- uint32 comp_length;
- char compression[4];
- uint32 decomp_length;
+ uint32 comp_length;
+ char compression[4];
+ uint32 decomp_length;
} PACKED_STRUCT;
struct FrameHeader {
@@ -132,7 +132,7 @@ struct WalkGridHeader {
int32 numNodes;
} PACKED_STRUCT;
-#include "common/pack-end.h" // END STRUCT PACKING
+#include "common/pack-end.h" // END STRUCT PACKING
enum fileTypes {
TYPE_CD1 = 0,
@@ -144,12 +144,12 @@ enum fileTypes {
};
enum fileFlags {
- FLAG_CD1 = (1 << TYPE_CD1), // this file is on cd1
- FLAG_CD2 = (1 << TYPE_CD2), // this file is on cd2
- FLAG_DEMO = (1 << TYPE_DEMO), // file for the demo version
- FLAG_IMMED = (1 << TYPE_IMMED), // this file is needed immediately, game won't start without it
- FLAG_SPEECH1 = (1 << TYPE_SPEECH1),
- FLAG_SPEECH2 = (1 << TYPE_SPEECH2)
+ FLAG_CD1 = (1 << TYPE_CD1), // this file is on cd1
+ FLAG_CD2 = (1 << TYPE_CD2), // this file is on cd2
+ FLAG_DEMO = (1 << TYPE_DEMO), // file for the demo version
+ FLAG_IMMED = (1 << TYPE_IMMED), // this file is needed immediately, game won't start without it
+ FLAG_SPEECH1 = (1 << TYPE_SPEECH1),
+ FLAG_SPEECH2 = (1 << TYPE_SPEECH2)
};
struct CdFile {
@@ -167,29 +167,29 @@ enum Language {
BS1_PORT
};
-#define SAM 2162689
-#define PLAYER 8388608
-#define GEORGE 8388608
-#define NICO 8454144
-#define BENOIR 8585216
-#define ROSSO 8716288
-#define DUANE 8781824
-#define MOUE 9502720
-#define ALBERT 9568256
+#define SAM 2162689
+#define PLAYER 8388608
+#define GEORGE 8388608
+#define NICO 8454144
+#define BENOIR 8585216
+#define ROSSO 8716288
+#define DUANE 8781824
+#define MOUE 9502720
+#define ALBERT 9568256
-#define STAND 0
-#define UP 0
-#define UP_RIGHT 1
-#define U_R 1
-#define RIGHT 2
-#define DOWN_RIGHT 3
-#define D_R 3
-#define DOWN 4
-#define DOWN_LEFT 5
-#define D_L 5
-#define LEFT 6
-#define UP_LEFT 7
-#define U_L 7
+#define STAND 0
+#define UP 0
+#define UP_RIGHT 1
+#define U_R 1
+#define RIGHT 2
+#define DOWN_RIGHT 3
+#define D_R 3
+#define DOWN 4
+#define DOWN_LEFT 5
+#define D_L 5
+#define LEFT 6
+#define UP_LEFT 7
+#define U_L 7
#define BEER_TOWEL 3
#define HOTEL_KEY 4
@@ -373,10 +373,10 @@ enum Language {
#define IT_MINUS 12
#define IT_AND 13
#define IT_OR 14
-#define IT_GTE 15 // >=
-#define IT_LTE 16 // <=
-#define IT_DEVIDE 17 // <=
-#define IT_GT 18 // >
+#define IT_GTE 15 // >=
+#define IT_LTE 16 // <=
+#define IT_DEVIDE 17 // <=
+#define IT_GT 18 // >
#define IT_SCRIPTEND 20
#define IT_POPVAR 21
diff --git a/engines/sword1/text.cpp b/engines/sword1/text.cpp
index 2d4b07020f..3bd2fdb2e6 100644
--- a/engines/sword1/text.cpp
+++ b/engines/sword1/text.cpp
@@ -35,7 +35,7 @@ namespace Sword1 {
#define OVERLAP 3
#define SPACE ' '
-#define MAX_LINES 30
+#define MAX_LINES 30
Text::Text(ObjectMan *pObjMan, ResMan *pResMan, bool czechVersion) {
@@ -43,7 +43,7 @@ Text::Text(ObjectMan *pObjMan, ResMan *pResMan, bool czechVersion) {
_resMan = pResMan;
_textCount = 0;
_fontId = (czechVersion) ? CZECH_GAME_FONT : GAME_FONT;
- _font = (uint8*)_resMan->openFetchRes(_fontId);
+ _font = (uint8 *)_resMan->openFetchRes(_fontId);
_joinWidth = charWidth(SPACE) - 2 * OVERLAP;
_charHeight = _resMan->getUint16(_resMan->fetchFrame(_font, 0)->height); // all chars have the same height
@@ -86,16 +86,16 @@ void Text::makeTextSprite(uint8 slot, const uint8 *text, uint16 maxWidth, uint8
uint16 sprHeight = _charHeight * numLines;
uint32 sprSize = sprWidth * sprHeight;
assert(!_textBlocks[slot]); // if this triggers, the speechDriver failed to call Text::releaseText.
- _textBlocks[slot] = (FrameHeader*)malloc(sprSize + sizeof(FrameHeader));
+ _textBlocks[slot] = (FrameHeader *)malloc(sprSize + sizeof(FrameHeader));
memcpy(_textBlocks[slot]->runTimeComp, "Nu ", 4);
- _textBlocks[slot]->compSize = 0;
- _textBlocks[slot]->width = _resMan->toUint16(sprWidth);
- _textBlocks[slot]->height = _resMan->toUint16(sprHeight);
- _textBlocks[slot]->offsetX = 0;
- _textBlocks[slot]->offsetY = 0;
+ _textBlocks[slot]->compSize = 0;
+ _textBlocks[slot]->width = _resMan->toUint16(sprWidth);
+ _textBlocks[slot]->height = _resMan->toUint16(sprHeight);
+ _textBlocks[slot]->offsetX = 0;
+ _textBlocks[slot]->offsetY = 0;
- uint8 *linePtr = ((uint8*)_textBlocks[slot]) + sizeof(FrameHeader);
+ uint8 *linePtr = ((uint8 *)_textBlocks[slot]) + sizeof(FrameHeader);
memset(linePtr, NO_COL, sprSize);
for (lineCnt = 0; lineCnt < numLines; lineCnt++) {
uint8 *sprPtr = linePtr + (sprWidth - lines[lineCnt].width) / 2; // center the text
@@ -132,7 +132,7 @@ uint16 Text::analyzeSentence(const uint8 *text, uint16 maxWidth, LineInfo *line)
text++;
wordWidth += OVERLAP; // no overlap on final letter of word!
- if (firstWord) { // first word on first line, so no separating SPACE needed
+ if (firstWord) { // first word on first line, so no separating SPACE needed
line[0].width = wordWidth;
line[0].length = wordLength;
firstWord = false;
@@ -144,7 +144,7 @@ uint16 Text::analyzeSentence(const uint8 *text, uint16 maxWidth, LineInfo *line)
if (line[lineNo].width + spaceNeeded <= maxWidth) {
line[lineNo].width += spaceNeeded;
line[lineNo].length += 1 + wordLength; // NB. space+word characters
- } else { // put word (without separating SPACE) at start of next line
+ } else { // put word (without separating SPACE) at start of next line
lineNo++;
assert(lineNo < MAX_LINES);
line[lineNo].width = wordWidth;
@@ -152,21 +152,21 @@ uint16 Text::analyzeSentence(const uint8 *text, uint16 maxWidth, LineInfo *line)
}
}
}
- return lineNo+1; // return no of lines
+ return lineNo + 1; // return no of lines
}
uint16 Text::copyChar(uint8 ch, uint8 *sprPtr, uint16 sprWidth, uint8 pen) {
FrameHeader *chFrame = _resMan->fetchFrame(_font, ch - SPACE);
- uint8 *chData = ((uint8*)chFrame) + sizeof(FrameHeader);
+ uint8 *chData = ((uint8 *)chFrame) + sizeof(FrameHeader);
uint8 *dest = sprPtr;
uint8 *decBuf = NULL;
uint8 *decChr;
uint16 frameHeight = 0;
if (SwordEngine::isPsx()) {
- frameHeight = _resMan->getUint16(chFrame->height)/2;
+ frameHeight = _resMan->getUint16(chFrame->height) / 2;
if (_fontId == CZECH_GAME_FONT) { //Czech game fonts are compressed
- decBuf = (uint8*) malloc((_resMan->getUint16(chFrame->width))*(_resMan->getUint16(chFrame->height)/2));
+ decBuf = (uint8 *)malloc((_resMan->getUint16(chFrame->width)) * (_resMan->getUint16(chFrame->height) / 2));
Screen::decompressHIF(chData, decBuf);
decChr = decBuf;
} else //Normal game fonts are not compressed
diff --git a/engines/sword1/text.h b/engines/sword1/text.h
index 2224fbcac5..4dcb9e26a7 100644
--- a/engines/sword1/text.h
+++ b/engines/sword1/text.h
@@ -30,17 +30,17 @@ namespace Sword1 {
#define MAX_TEXT_OBS 3
-#define BORDER_COL 200
+#define BORDER_COL 200
#define BORDER_COL_PSX 199
-#define LETTER_COL 193
-#define NO_COL 0 // sprite background - 0 for transparency
+#define LETTER_COL 193
+#define NO_COL 0 // sprite background - 0 for transparency
class ObjectMan;
class ResMan;
struct LineInfo {
- uint16 width; // width of line in pixels
- uint16 length; // length of line in characters
+ uint16 width; // width of line in pixels
+ uint16 length; // length of line in characters
};
class Text {
diff --git a/engines/tinsel/pcode.cpp b/engines/tinsel/pcode.cpp
index 2ab1e653d4..ae4c0d3ce1 100644
--- a/engines/tinsel/pcode.cpp
+++ b/engines/tinsel/pcode.cpp
@@ -394,7 +394,7 @@ INT_CONTEXT *RestoreInterpretContext(INT_CONTEXT *ric) {
memcpy(ic, ric, sizeof(INT_CONTEXT));
ic->pProc = g_scheduler->getCurrentProcess();
- ic->resumeState = RES_1;
+ ic->resumeState = RES_NOT;
LockCode(ic);
diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index 80f02ff8d1..635845ab26 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -778,7 +778,7 @@ static const GameSettings tinselSettings[] = {
// For the languages, refer to the LANGUAGE enum in dw.h
-const char *TinselEngine::_sampleIndices[][3] = {
+const char *const TinselEngine::_sampleIndices[][3] = {
{ "english.idx", "english1.idx", "english2.idx" }, // English
{ "french.idx", "french1.idx", "french2.idx" }, // French
{ "german.idx", "german1.idx", "german2.idx" }, // German
@@ -789,7 +789,7 @@ const char *TinselEngine::_sampleIndices[][3] = {
{ "english.idx", "english1.idx", "english2.idx" }, // Japanese (FIXME: not sure if this is correct)
{ "us.idx", "us1.idx", "us2.idx" } // US English
};
-const char *TinselEngine::_sampleFiles[][3] = {
+const char *const TinselEngine::_sampleFiles[][3] = {
{ "english.smp", "english1.smp", "english2.smp" }, // English
{ "french.smp", "french1.smp", "french2.smp" }, // French
{ "german.smp", "german1.smp", "german2.smp" }, // German
@@ -800,7 +800,7 @@ const char *TinselEngine::_sampleFiles[][3] = {
{ "english.smp", "english1.smp", "english2.smp" }, // Japanese (FIXME: not sure if this is correct)
{ "us.smp", "us1.smp", "us2.smp" }, // US English
};
-const char *TinselEngine::_textFiles[][3] = {
+const char *const TinselEngine::_textFiles[][3] = {
{ "english.txt", "english1.txt", "english2.txt" }, // English
{ "french.txt", "french1.txt", "french2.txt" }, // French
{ "german.txt", "german1.txt", "german2.txt" }, // German
diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index e18216cdf7..59344c44f4 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -156,9 +156,9 @@ class TinselEngine : public Engine {
Console *_console;
Scheduler *_scheduler;
- static const char *_sampleIndices[][3];
- static const char *_sampleFiles[][3];
- static const char *_textFiles[][3];
+ static const char *const _sampleIndices[][3];
+ static const char *const _sampleFiles[][3];
+ static const char *const _textFiles[][3];
protected:
diff --git a/engines/toon/anim.cpp b/engines/toon/anim.cpp
index 07d51ef1b9..a529001af5 100644
--- a/engines/toon/anim.cpp
+++ b/engines/toon/anim.cpp
@@ -693,7 +693,7 @@ AnimationManager::AnimationManager(ToonEngine *vm) : _vm(vm) {
bool AnimationManager::hasInstance(AnimationInstance* instance) {
for (uint32 i = 0; i < _instances.size(); i++) {
- if(_instances[i] == instance)
+ if (_instances[i] == instance)
return true;
}
return false;
@@ -709,7 +709,7 @@ void AnimationManager::addInstance(AnimationInstance *instance) {
// if the instance already exists, we skip the add
for (uint32 i = 0; i < _instances.size(); i++) {
- if(_instances[i] == instance)
+ if (_instances[i] == instance)
return;
}
diff --git a/engines/toon/audio.cpp b/engines/toon/audio.cpp
index 4a4a84e62c..5b2d06b74d 100644
--- a/engines/toon/audio.cpp
+++ b/engines/toon/audio.cpp
@@ -65,7 +65,7 @@ void AudioManager::muteMusic(bool muted) {
}
void AudioManager::muteVoice(bool muted) {
- if(voiceStillPlaying() && _channels[2]) {
+ if (voiceStillPlaying() && _channels[2]) {
_channels[2]->setVolume(muted ? 0 : 255);
}
_voiceMuted = muted;
@@ -272,7 +272,7 @@ AudioStreamInstance::~AudioStreamInstance() {
int AudioStreamInstance::readBuffer(int16 *buffer, const int numSamples) {
debugC(5, kDebugAudio, "readBuffer(buffer, %d)", numSamples);
- if(_stopped)
+ if (_stopped)
return 0;
handleFade(numSamples);
@@ -598,7 +598,7 @@ void AudioManager::updateAmbientSFX()
for (int32 i = 0; i < 4; i++) {
AudioAmbientSFX* ambient = &_ambientSFXs[i];
if (ambient->_enabled && (ambient->_channel < 0 || !(_channels[ambient->_channel] && _channels[ambient->_channel]->isPlaying()))) {
- if(ambient->_mode == 1) {
+ if (ambient->_mode == 1) {
if (_vm->randRange(0, 32767) < ambient->_delay) {
ambient->_channel = playSFX(ambient->_id, ambient->_volume, false);
}
diff --git a/engines/toon/picture.cpp b/engines/toon/picture.cpp
index 295e304765..6367165d6f 100644
--- a/engines/toon/picture.cpp
+++ b/engines/toon/picture.cpp
@@ -323,7 +323,7 @@ void Picture::drawLineOnMask(int32 x, int32 y, int32 x2, int32 y2, bool walkable
int32 rx = bx >> 16;
int32 ry = by >> 16;
- if( rx >= 0 && rx < _width-1 && ry >= 0 && ry < _height) { // sanity check: some lines in the game
+ if ( rx >= 0 && rx < _width-1 && ry >= 0 && ry < _height) { // sanity check: some lines in the game
// were drawing outside the screen causing corruption
if (!walkable) {
_data[_width * ry + rx] &= 0xe0;
diff --git a/engines/toon/resource.cpp b/engines/toon/resource.cpp
index cef916c7de..384a363d7d 100644
--- a/engines/toon/resource.cpp
+++ b/engines/toon/resource.cpp
@@ -41,7 +41,7 @@ Resources::~Resources() {
delete temp;
}
- while(!_pakFiles.empty()) {
+ while (!_pakFiles.empty()) {
PakFile *temp = _pakFiles.back();
_pakFiles.pop_back();
delete temp;
diff --git a/engines/toon/script_func.cpp b/engines/toon/script_func.cpp
index 005a299502..e9b7534198 100644
--- a/engines/toon/script_func.cpp
+++ b/engines/toon/script_func.cpp
@@ -223,7 +223,7 @@ ScriptFunc::ScriptFunc(ToonEngine *vm) {
}
ScriptFunc::~ScriptFunc(void) {
- while(!_opcodes.empty()) {
+ while (!_opcodes.empty()) {
const OpcodeV2 *temp = _opcodes.back();
_opcodes.pop_back();
delete temp;
@@ -655,13 +655,15 @@ int32 ScriptFunc::sys_Cmd_Set_Flux_Facing_Point(EMCState *state) {
int32 fx = stackPos(0);
int32 fy = stackPos(1);
_vm->getFlux()->setFacing(_vm->getFlux()->getFacingFromDirection(fx - _vm->getFlux()->getX(), fy - _vm->getFlux()->getY()));
- _vm->getFlux()->playStandingAnim();
+ if (_vm->getFlux()->getFlag() == 0) // don't reset the animation unless Flux is in idle mode
+ _vm->getFlux()->playStandingAnim();
return 1;
}
int32 ScriptFunc::sys_Cmd_Set_Flux_Facing(EMCState *state) {
_vm->getFlux()->forceFacing(stackPos(0));
- _vm->getFlux()->playStandingAnim();
+ if (_vm->getFlux()->getFlag() == 0) // don't reset the animation unless Flux is in idle mode
+ _vm->getFlux()->playStandingAnim();
return 0;
}
@@ -990,7 +992,7 @@ int32 ScriptFunc::sys_Cmd_Set_Scene_Animation_Active_Flag(EMCState *state) {
if (sceneAnim->_active) {
sceneAnim->_animInstance->setVisible(activeFlag > 0);
- if(activeFlag) {
+ if (activeFlag) {
_vm->getAnimationManager()->addInstance(sceneAnim->_animInstance);
}
}
diff --git a/engines/toon/tools.cpp b/engines/toon/tools.cpp
index c2ee8acf8a..added39940 100644
--- a/engines/toon/tools.cpp
+++ b/engines/toon/tools.cpp
@@ -383,7 +383,7 @@ int32 RncDecoder::unpackM1(const void *input, uint16 inputSize, void *output) {
uint16 b;
if (_inputByteLeft <= 2)
b = 0;
- else if(_inputByteLeft == 3)
+ else if (_inputByteLeft == 3)
b = *(_srcPtr + 2);
else
b = READ_LE_UINT16(_srcPtr + 2);
diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp
index cff6c24469..b3ab591ba7 100644
--- a/engines/toon/toon.cpp
+++ b/engines/toon/toon.cpp
@@ -191,11 +191,11 @@ void ToonEngine::parseInput() {
_audioManager->stopCurrentVoice();
}
if (event.kbd.keycode == Common::KEYCODE_F5 && !hasModifier) {
- if(canSaveGameStateCurrently())
+ if (canSaveGameStateCurrently())
saveGame(-1, Common::String());
}
if (event.kbd.keycode == Common::KEYCODE_F6 && !hasModifier) {
- if(canLoadGameStateCurrently())
+ if (canLoadGameStateCurrently())
loadGame(-1);
}
if (event.kbd.ascii == 't' && !hasModifier) {
@@ -509,7 +509,7 @@ void ToonEngine::copyToVirtualScreen(bool updateScreen) {
Common::Rect rect = _oldDirtyRects[i];
rect.translate(-state()->_currentScrollValue, 0);
offX = 0;
- if(rect.right <= 0)
+ if (rect.right <= 0)
continue;
if (rect.left < 0) {
offX = -rect.left;
@@ -663,7 +663,7 @@ bool ToonEngine::showMainmenu(bool &loadedGame) {
while (!clickRelease) {
- if(_dirtyAll) {
+ if (_dirtyAll) {
mainmenuPicture->draw(*_mainSurface, 0, 0, 0, 0);
addDirtyRect(0, 0, TOON_SCREEN_WIDTH, TOON_SCREEN_HEIGHT);
} else {
@@ -936,7 +936,7 @@ ToonEngine::~ToonEngine() {
delete _animationManager;
delete _moviePlayer;
- if(_mainSurface) {
+ if (_mainSurface) {
_mainSurface->free();
delete _mainSurface;
}
@@ -1503,7 +1503,7 @@ void ToonEngine::clickEvent() {
if (leftButton)
createMouseItem(104);
else
- characterTalk(518);
+ characterTalk(1104);
}
}
if (_currentHotspotItem == -4) {
@@ -4677,7 +4677,7 @@ void ToonEngine::makeLineWalkable(int32 x, int32 y, int32 x2, int32 y2) {
}
void ToonEngine::playRoomMusic() {
- if(_gameState->_inConversation) {
+ if (_gameState->_inConversation) {
const char* music = getSpecialConversationMusic(_gameState->_currentConversationId);
if (music) {
_audioManager->playMusic(_gameState->_locations[_gameState->_currentScene]._name, music);
diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp
new file mode 100644
index 0000000000..86feceb015
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_dialogs.cpp
@@ -0,0 +1,434 @@
+/* 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 "common/translation.h"
+
+#include "gui/dialog.h"
+#include "gui/widget.h"
+
+#include "tsage/tsage.h"
+#include "tsage/core.h"
+#include "tsage/dialogs.h"
+#include "tsage/staticres.h"
+#include "tsage/globals.h"
+#include "tsage/blue_force/blueforce_dialogs.h"
+#include "tsage/ringworld/ringworld_logic.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+/**
+ * This dialog implements the right-click dialog
+ */
+RightClickDialog::RightClickDialog() : GfxDialog() {
+ // Setup button areas
+ _rectList1[0] = Rect(7, 50, 41, 67);
+ _rectList1[1] = Rect(13, 27, 50, 50);
+ _rectList1[2] = Rect(49, 27, 84, 50);
+ _rectList1[3] = Rect(56, 50, 90, 67);
+ _rectList1[4] = Rect(26, 68, 69, 99);
+
+ _rectList3[0] = Rect(12, 49, 27, 64);
+ _rectList3[1] = Rect(27, 31, 42, 46);
+ _rectList3[2] = Rect(56, 31, 71, 46);
+ _rectList3[3] = Rect(72, 50, 87, 65);
+ _rectList3[4] = Rect(41, 81, 56, 96);
+
+ // Set the palette and change the cursor
+ GfxSurface cursor = surfaceFromRes(1, 5, 9);
+ BF_GLOBALS._events.setCursor(cursor);
+
+ setPalette();
+
+ // Get the dialog image
+ _surface = surfaceFromRes(1, 1, 1);
+
+ // Set the dialog position
+ Rect dialogRect;
+ dialogRect.resize(_surface, 0, 0, 100);
+ dialogRect.center(g_globals->_events._mousePos.x, g_globals->_events._mousePos.y);
+
+ // Ensure the dialog will be entirely on-screen
+ Rect screenRect = g_globals->gfxManager()._bounds;
+ screenRect.collapse(4, 4);
+ dialogRect.contain(screenRect);
+
+ // Load selected button images
+ _btnImages.setVisage(1, 2);
+
+ _bounds = dialogRect;
+ _gfxManager._bounds = _bounds;
+
+ _highlightedAction = -1;
+ _selectedAction = -1;
+}
+
+RightClickDialog::~RightClickDialog() {
+}
+
+void RightClickDialog::draw() {
+ // Save the covered background area
+ _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
+
+ // Draw the dialog image
+ g_globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top);
+
+ // Pre-process rect lists
+ for (int idx = 0; idx < 5; ++idx) {
+ _rectList2[idx] = _rectList1[idx];
+ _rectList4[idx] = _rectList3[idx];
+
+ _rectList2[idx].translate(_bounds.left, _bounds.top);
+ _rectList4[idx].translate(_bounds.left, _bounds.top);
+ }
+}
+
+bool RightClickDialog::process(Event &event) {
+ switch (event.eventType) {
+ case EVENT_MOUSE_MOVE: {
+ // Check whether a button is highlighted
+ int buttonIndex = 0;
+ while ((buttonIndex < 5) && !_rectList1[buttonIndex].contains(event.mousePos))
+ ++buttonIndex;
+ if (buttonIndex == 5)
+ buttonIndex = -1;
+
+ // If selection has changed, handle it
+ if (buttonIndex != _highlightedAction) {
+ if (_highlightedAction != -1) {
+ // Another button was previously selected, so restore dialog
+ _gfxManager.copyFrom(_surface, 0, 0);
+ }
+
+ if (buttonIndex != -1) {
+ // Draw newly selected button
+ GfxSurface btn = _btnImages.getFrame(buttonIndex + 1);
+ _gfxManager.copyFrom(btn, _rectList3[buttonIndex].left, _rectList3[buttonIndex].top);
+ }
+
+ _highlightedAction = buttonIndex;
+ }
+
+ event.handled = true;
+ return true;
+ }
+
+ case EVENT_BUTTON_DOWN:
+ // Specify the selected action
+ _selectedAction = (_highlightedAction == -1) ? 5 : _highlightedAction;
+ event.handled = true;
+ return true;
+
+ default:
+ break;
+ }
+
+ return false;
+}
+
+void RightClickDialog::execute() {
+ // Draw the dialog
+ draw();
+
+ // Dialog event handler loop
+ _gfxManager.activate();
+
+ while (!g_vm->shouldQuit() && (_selectedAction == -1)) {
+ Event evt;
+ while (g_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) {
+ evt.mousePos.x -= _bounds.left;
+ evt.mousePos.y -= _bounds.top;
+
+ process(evt);
+ }
+
+ g_system->delayMillis(10);
+ g_system->updateScreen();
+ }
+
+ // Execute the specified action
+ CursorType cursorNum = CURSOR_NONE;
+ switch (_selectedAction) {
+ case 0:
+ // Walk action
+ cursorNum = BF_GLOBALS._player._canWalk ? CURSOR_WALK : CURSOR_USE;
+ break;
+ case 1:
+ // Use action
+ cursorNum = CURSOR_USE;
+ break;
+ case 2:
+ // Look action
+ cursorNum = CURSOR_LOOK;
+ break;
+ case 3:
+ // Talk action
+ cursorNum = CURSOR_TALK;
+ break;
+ case 4:
+ // Options dialog
+ break;
+ }
+
+ if (cursorNum != CURSOR_NONE)
+ BF_GLOBALS._events.setCursor(cursorNum);
+
+ _gfxManager.deactivate();
+}
+
+/*--------------------------------------------------------------------------*/
+
+AmmoBeltDialog::AmmoBeltDialog() : GfxDialog() {
+ _cursorNum = BF_GLOBALS._events.getCursor();
+ _inDialog = -1;
+ _closeFlag = false;
+
+ // Get the dialog image
+ _surface = surfaceFromRes(9, 5, 2);
+
+ // Set the dialog position
+ _dialogRect.resize(_surface, 0, 0, 100);
+ _dialogRect.center(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);
+
+ _bounds = _dialogRect;
+ _gfxManager._bounds = _bounds;
+ _savedArea = NULL;
+
+ // Set up area rects
+ _gunRect.set(0, 0, 82, 48);
+ _clip1Rect.set(90, 6, _bounds.width(), 39);
+ _clip2Rect.set(90, 40, _bounds.width(), _bounds.height());
+ _loadedRect.set(50, 40, 60, 50);
+}
+
+AmmoBeltDialog::~AmmoBeltDialog() {
+ BF_GLOBALS._events.setCursor(_cursorNum);
+}
+
+void AmmoBeltDialog::execute() {
+ // Draw the dialog
+ draw();
+
+ // Dialog event handler loop
+ _gfxManager.activate();
+
+ while (!g_vm->shouldQuit() && !_closeFlag) {
+ Event evt;
+ while (g_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) {
+ evt.mousePos.x -= _bounds.left;
+ evt.mousePos.y -= _bounds.top;
+
+ process(evt);
+ }
+
+ g_system->delayMillis(10);
+ g_system->updateScreen();
+ }
+
+ _gfxManager.deactivate();
+}
+
+bool AmmoBeltDialog::process(Event &event) {
+ switch (event.eventType) {
+ case EVENT_MOUSE_MOVE: {
+ // Handle updating cursor depending on whether cursor is in dialog or not
+ int inDialog = Rect(0, 0, _bounds.width(), _bounds.height()).contains(event.mousePos);
+ if (inDialog != _inDialog) {
+ // Update cursor
+ BF_GLOBALS._events.setCursor(inDialog ? CURSOR_USE : CURSOR_EXIT);
+ _inDialog = inDialog;
+ }
+ return true;
+ }
+
+ case EVENT_BUTTON_DOWN:
+ if (!_inDialog)
+ // Clicked outside dialog, so flag to close it
+ _closeFlag = true;
+ else {
+ int v = (BF_GLOBALS.getFlag(fGunLoaded) ? 1 : 0) * (BF_GLOBALS.getFlag(fLoadedSpare) ? 2 : 1);
+
+ // Handle first clip
+ if ((v != 1) && _clip1Rect.contains(event.mousePos)) {
+ if (BF_GLOBALS.getFlag(fGunLoaded)) {
+ event.mousePos.x = event.mousePos.y = 0;
+ }
+
+ BF_GLOBALS.setFlag(fGunLoaded);
+ BF_GLOBALS.clearFlag(fLoadedSpare);
+ }
+
+ // Handle second clip
+ if ((v != 2) && _clip2Rect.contains(event.mousePos)) {
+ if (BF_GLOBALS.getFlag(fGunLoaded)) {
+ event.mousePos.x = event.mousePos.y = 0;
+ }
+
+ BF_GLOBALS.setFlag(fGunLoaded);
+ BF_GLOBALS.setFlag(fLoadedSpare);
+ }
+
+ if (_gunRect.contains(event.mousePos) && BF_GLOBALS.getFlag(fGunLoaded)) {
+ BF_GLOBALS.clearFlag(fGunLoaded);
+ v = (BF_GLOBALS.getFlag(fGunLoaded) ? 1 : 0) * (BF_GLOBALS.getFlag(fLoadedSpare) ? 2 : 1);
+
+ if (v != 2)
+ BF_GLOBALS.clearFlag(fLoadedSpare);
+ }
+
+ draw();
+ }
+
+ return true;
+
+ case EVENT_KEYPRESS:
+ if ((event.kbd.keycode == Common::KEYCODE_ESCAPE) || (event.kbd.keycode == Common::KEYCODE_RETURN)) {
+ // Escape pressed, so flag to close dialog
+ _closeFlag = true;
+ return true;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return false;
+}
+
+void AmmoBeltDialog::draw() {
+ Rect bounds = _bounds;
+
+ if (!_savedArea) {
+ // Save the covered background area
+ _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
+ } else {
+ bounds.moveTo(0, 0);
+ }
+
+ // Draw the dialog image
+ g_globals->gfxManager().copyFrom(_surface, bounds.left, bounds.top);
+
+ // Setup clip flags
+ bool clip1 = true, clip2 = true;
+ bool gunLoaded = BF_GLOBALS.getFlag(fGunLoaded);
+ if (gunLoaded) {
+ // A clip is currently loaded. Hide the appropriate clip
+ if (BF_GLOBALS.getFlag(fLoadedSpare))
+ clip2 = false;
+ else
+ clip1 = false;
+ }
+
+ // Draw the first clip if necessary
+ if (clip1) {
+ GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip1Bullets);
+ _clip1Rect.resize(clipSurface, _clip1Rect.left, _clip1Rect.top, 100);
+ g_globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip1Rect.left,
+ bounds.top + _clip1Rect.top);
+ }
+
+ // Draw the second clip if necessary
+ if (clip2) {
+ GfxSurface clipSurface = surfaceFromRes(9, 6, BF_GLOBALS._clip2Bullets);
+ _clip2Rect.resize(clipSurface, _clip2Rect.left, _clip2Rect.top, 100);
+ g_globals->gfxManager().copyFrom(clipSurface, bounds.left + _clip2Rect.left,
+ bounds.top + _clip2Rect.top);
+ }
+
+ // If a clip is loaded, draw the 'loaded' portion of the gun
+ if (gunLoaded) {
+ GfxSurface loadedSurface = surfaceFromRes(9, 7, 1);
+ _loadedRect.resize(loadedSurface, _loadedRect.left, _loadedRect.top, 100);
+ g_globals->gfxManager().copyFrom(loadedSurface, bounds.left + _loadedRect.left,
+ bounds.top + _loadedRect.top);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+RadioConvDialog::RadioConvDialog() : GfxDialog() {
+ int idx;
+
+ // Set up the list of buttons
+ int maxWidth = 0;
+ for (idx = 0; idx < 8; ++idx) {
+ _buttons[idx].setText(RADIO_BTN_LIST[idx]);
+ maxWidth = MAX(maxWidth, (int)_buttons[idx]._bounds.width());
+
+ add(&_buttons[idx]);
+ }
+
+ // Set up the button positions and add them to the dialog
+ for (idx = 0; idx < 8; ++idx) {
+ _buttons[idx]._bounds.moveTo((idx % 2) * maxWidth + 2,
+ idx / 2 * _buttons[idx]._bounds.height() + 2);
+ _buttons[idx]._bounds.setWidth(maxWidth);
+
+ add(&_buttons[idx]);
+ }
+
+ // Set the dialog size and position
+ setDefaults();
+ setTopLeft(8, 92);
+
+ BF_GLOBALS._events.setCursor(CURSOR_ARROW);
+}
+
+RadioConvDialog::~RadioConvDialog() {
+ BF_GLOBALS._events.setCursor(CURSOR_WALK);
+}
+
+int RadioConvDialog::execute() {
+ GfxButton *btn = GfxDialog::execute();
+
+ // Get which button was pressed
+ int btnIndex = -1;
+ for (int idx = 0; idx < 8; ++idx) {
+ if (btn == &_buttons[idx]) {
+ btnIndex = idx;
+ break;
+ }
+ }
+
+ return btnIndex;
+}
+
+int RadioConvDialog::show() {
+ // Show the dialog
+ RadioConvDialog *dlg = new RadioConvDialog();
+ dlg->draw();
+
+ int btnIndex = dlg->execute();
+
+ // Close the dialog
+ dlg->remove();
+ delete dlg;
+
+ return btnIndex;
+}
+
+
+} // End of namespace BlueForce
+
+} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_dialogs.h b/engines/tsage/blue_force/blueforce_dialogs.h
new file mode 100644
index 0000000000..ca51c97aa2
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_dialogs.h
@@ -0,0 +1,92 @@
+/* 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.
+ *
+ */
+
+#ifndef TSAGE_BLUEFORCE_DIALOGS_H
+#define TSAGE_BLUEFORCE_DIALOGS_H
+
+#include "gui/options.h"
+#include "tsage/dialogs.h"
+#include "tsage/events.h"
+#include "tsage/graphics.h"
+#include "common/list.h"
+#include "common/rect.h"
+#include "common/system.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+using namespace TsAGE;
+
+class RightClickDialog : public GfxDialog {
+private:
+ GfxSurface _surface;
+ Visage _btnImages;
+ Rect _rectList1[5];
+ Rect _rectList2[5];
+ Rect _rectList3[5];
+ Rect _rectList4[5];
+
+ int _highlightedAction;
+ int _selectedAction;
+public:
+ RightClickDialog();
+ ~RightClickDialog();
+
+ virtual void draw();
+ virtual bool process(Event &event);
+ void execute();
+};
+
+class AmmoBeltDialog : public GfxDialog {
+private:
+ GfxSurface _surface;
+ Visage _cursorImages;
+ Rect _dialogRect, _loadedRect, _gunRect, _clip1Rect, _clip2Rect;
+ CursorType _cursorNum;
+ int _inDialog;
+ bool _closeFlag;
+public:
+ AmmoBeltDialog();
+ ~AmmoBeltDialog();
+
+ virtual void draw();
+ virtual bool process(Event &event);
+ void execute();
+};
+
+class RadioConvDialog : public GfxDialog {
+private:
+ GfxButton _buttons[8];
+public:
+ RadioConvDialog();
+ virtual ~RadioConvDialog();
+ int execute();
+
+ static int show();
+};
+
+} // End of namespace BlueForce
+
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/blue_force/blueforce_logic.cpp b/engines/tsage/blue_force/blueforce_logic.cpp
index 60bbddbabc..247fc4b9f2 100644
--- a/engines/tsage/blue_force/blueforce_logic.cpp
+++ b/engines/tsage/blue_force/blueforce_logic.cpp
@@ -21,9 +21,17 @@
*/
#include "tsage/blue_force/blueforce_logic.h"
+#include "tsage/blue_force/blueforce_dialogs.h"
#include "tsage/blue_force/blueforce_scenes0.h"
#include "tsage/blue_force/blueforce_scenes1.h"
+#include "tsage/blue_force/blueforce_scenes2.h"
#include "tsage/blue_force/blueforce_scenes3.h"
+#include "tsage/blue_force/blueforce_scenes4.h"
+#include "tsage/blue_force/blueforce_scenes5.h"
+#include "tsage/blue_force/blueforce_scenes6.h"
+#include "tsage/blue_force/blueforce_scenes7.h"
+#include "tsage/blue_force/blueforce_scenes8.h"
+#include "tsage/blue_force/blueforce_scenes9.h"
#include "tsage/scenes.h"
#include "tsage/tsage.h"
#include "tsage/graphics.h"
@@ -35,9 +43,9 @@ namespace BlueForce {
void BlueForceGame::start() {
// Start the game
- _globals->_sceneManager.changeScene(300);
+ g_globals->_sceneManager.changeScene(300);
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
}
Scene *BlueForceGame::createScene(int sceneNumber) {
@@ -47,9 +55,11 @@ Scene *BlueForceGame::createScene(int sceneNumber) {
// Tsunami Title Screen
return new Scene20();
case 50:
+ // Map screen
return new Scene50();
case 60:
- error("Scene group 0 not implemented");
+ // Motorcycle
+ return new Scene60();
/* Scene Group #1 */
case 100:
// Tsnunami Title Screen #2
@@ -58,7 +68,6 @@ Scene *BlueForceGame::createScene(int sceneNumber) {
// Introduction Bar Room
return new Scene109();
case 110:
-
case 114:
case 115:
case 125:
@@ -66,75 +75,205 @@ Scene *BlueForceGame::createScene(int sceneNumber) {
case 150:
case 160:
case 180:
- case 190:
error("Scene group 1 not implemented");
+ case 190:
+ // Front of Police Station
+ return new Scene190();
case 200:
+ // Credits - Motorcycle Training
+ return new Scene200();
case 210:
+ // Credits - Car Training
+ return new Scene210();
case 220:
+ // Credits - Martial Arts
+ return new Scene220();
case 225:
+ // Credits - Gun Training
+ return new Scene225();
case 265:
+ // Graduation Article
+ return new Scene265();
case 270:
+ // Living Room & Kitchen
+ return new Scene270();
case 271:
+ // Living Room & Kitchen #2
+ return new Scene271();
case 280:
error("Scene group 2 not implemented");
case 300:
// Outside Police Station
return new Scene300();
case 315:
+ // Inside Police Station
+ return new Scene315();
case 325:
+ // Police Station Conference Room
+ return new Scene325();
case 330:
+ // Approaching Marina
+ return new Scene330();
case 340:
+ // Marina, Domestic Disturbance
+ return new Scene340();
case 342:
+ // Marina, Normal
+ return new Scene342();
case 350:
+ // Marina, Outside Boat
+ return new Scene350();
case 355:
+ // Future Wave Exterior
+ return new Scene355();
case 360:
+ // Future Wave Interior
+ return new Scene360();
case 370:
+ // Future Wave Bedroom
+ return new Scene370();
case 380:
+ // Outside City Hall & Jail
+ return new Scene380();
case 385:
+ // City Hall
+ return new Scene385();
case 390:
- error("Scene group 3 not implemented");
+ // City Jail
+ return new Scene390();
case 410:
+ // Traffic Stop Gang Members
+ return new Scene410();
case 415:
+ // Searching Truck
+ return new Scene415();
case 440:
+ // Outside Alleycat Bowl
+ return new Scene440();
case 450:
- error("Scene group 4 not implemented");
+ // Inside Alleycat Bowl
+ return new Scene450();
case 550:
+ // Outside Bikini Hut
+ return new Scene550();
case 551:
+ // Outside Bikini Hut (Drunk Stop)
+ return new Scene551();
case 560:
+ // Study
+ return new Scene560();
case 570:
+ // Computer
+ return new Scene570();
case 580:
+ // Child Protective Services Parking Lot
+ return new Scene580();
case 590:
- error("Scene group 5 not implemented");
+ // Child Protective Services
+ return new Scene590();
case 600:
+ // Crash cut-scene
+ return new Scene600();
case 620:
+ // Hospital cut-scene
+ return new Scene620();
case 666:
+ // Death scene
+ return new Scene666();
case 690:
- error("Scene group 6 not implemented");
+ // Decking
+ return new Scene690();
case 710:
- error("Scene group 7 not implemented");
+ return new Scene710();
case 800:
+ // Jamison & Ryan
+ return new Scene800();
case 810:
case 820:
+ error("Scene group 8 not implemented");
case 830:
+ // Outside Boat Rentals
+ return new Scene830();
case 840:
+ // Boat Rentals
+ return new Scene840();
case 850:
case 860:
case 870:
case 880:
error("Scene group 8 not implemented");
case 900:
+ // Outside Warehouse
+ return new Scene900();
case 910:
+ error("Scene group 9 not implemented");
case 920:
+ // Inside Warehouse: Secret room
+ return new Scene920();
case 930:
+ // Inside the caravan
+ return new Scene930();
case 935:
+ // Hidden in the wardrobe
+ return new Scene935();
case 940:
- error("Scene group 9 not implemented");
+ return new Scene940();
default:
error("Unknown scene number - %d", sceneNumber);
break;
}
}
+void BlueForceGame::rightClick() {
+ RightClickDialog *dlg = new RightClickDialog();
+ dlg->execute();
+ delete dlg;
+}
+
+void BlueForceGame::processEvent(Event &event) {
+ if (event.eventType == EVENT_KEYPRESS) {
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_F1:
+ // F1 - Help
+ MessageDialog::show(HELP_MSG, OK_BTN_STRING);
+ break;
+
+ case Common::KEYCODE_F2:
+ // F2 - Sound Options
+ SoundDialog::execute();
+ break;
+
+ case Common::KEYCODE_F3:
+ // F3 - Quit
+ quitGame();
+ event.handled = false;
+ break;
+
+ case Common::KEYCODE_F4:
+ // F4 - Restart
+ restartGame();
+ g_globals->_events.setCursorFromFlag();
+ break;
+
+ case Common::KEYCODE_F7:
+ // F7 - Restore
+ restoreGame();
+ g_globals->_events.setCursorFromFlag();
+ break;
+
+ case Common::KEYCODE_F10:
+ // F10 - Pause
+ GfxDialog::setPalette();
+ MessageDialog::show(GAME_PAUSED_MSG, OK_BTN_STRING);
+ g_globals->_events.setCursorFromFlag();
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
/*--------------------------------------------------------------------------*/
AObjectArray::AObjectArray(): EventHandler() {
@@ -150,7 +289,7 @@ void AObjectArray::clear() {
void AObjectArray::synchronize(Serializer &s) {
EventHandler::synchronize(s);
for (int i = 0; i < OBJ_ARRAY_SIZE; ++i)
- SYNC_POINTER(_objList[i]);
+ SYNC_POINTER(_objList[i]);
}
void AObjectArray::process(Event &event) {
@@ -205,13 +344,13 @@ void AObjectArray::remove(EventHandler *obj) {
Timer::Timer() {
_endFrame = 0;
- _endAction = NULL;
+ _endHandler = NULL;
_tickAction = NULL;
}
void Timer::remove() {
_endFrame = 0;
- _endAction = NULL;
+ _endHandler = NULL;
((Scene100 *)BF_GLOBALS._sceneManager._scene)->removeTimer(this);
}
@@ -219,15 +358,15 @@ void Timer::remove() {
void Timer::synchronize(Serializer &s) {
EventHandler::synchronize(s);
SYNC_POINTER(_tickAction);
- SYNC_POINTER(_endAction);
+ SYNC_POINTER(_endHandler);
s.syncAsUint32LE(_endFrame);
}
void Timer::signal() {
- assert(_endAction);
- Action *action = _endAction;
+ assert(_endHandler);
+ EventHandler *item = _endHandler;
remove();
- action->signal();
+ item->signal();
}
void Timer::dispatch() {
@@ -242,11 +381,11 @@ void Timer::dispatch() {
}
}
-void Timer::set(uint32 delay, Action *endAction) {
+void Timer::set(uint32 delay, EventHandler *endHandler) {
assert(delay != 0);
_endFrame = BF_GLOBALS._sceneHandler->getFrameDifference() + delay;
- _endAction = endAction;
+ _endHandler = endHandler;
((SceneExt *)BF_GLOBALS._sceneManager._scene)->addTimer(this);
}
@@ -257,9 +396,9 @@ TimerExt::TimerExt(): Timer() {
_action = NULL;
}
-void TimerExt::set(uint32 delay, Action *endAction, Action *newAction) {
+void TimerExt::set(uint32 delay, EventHandler *endHandler, Action *newAction) {
_newAction = newAction;
- Timer::set(delay, endAction);
+ Timer::set(delay, endHandler);
}
void TimerExt::synchronize(Serializer &s) {
@@ -269,22 +408,18 @@ void TimerExt::synchronize(Serializer &s) {
void TimerExt::remove() {
_action = NULL;
- remove();
+ Timer::remove();
}
void TimerExt::signal() {
- Action *endAction = _endAction;
+ EventHandler *endHandler = _endHandler;
Action *newAction = _newAction;
remove();
// If the end action doesn't have an action anymore, set it to the specified new action
- assert(endAction);
- if (!endAction->_action)
- endAction->setAction(newAction);
-}
-
-void TimerExt::dispatch() {
-
+ assert(endHandler);
+ if (!endHandler->_action)
+ endHandler->setAction(newAction);
}
/*--------------------------------------------------------------------------*/
@@ -307,7 +442,39 @@ void NamedObject::synchronize(Serializer &s) {
s.syncAsSint16LE(_useLineNum);
}
-void NamedObject::setup(int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) {
+bool NamedObject::startAction(CursorType action, Event &event) {
+ bool handled = true;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ if (_lookLineNum == -1)
+ handled = false;
+ else
+ SceneItem::display2(_resNum, _lookLineNum);
+ break;
+ case CURSOR_USE:
+ if (_useLineNum == -1)
+ handled = false;
+ else
+ SceneItem::display2(_resNum, _useLineNum);
+ break;
+ case CURSOR_TALK:
+ if (_talkLineNum == -1)
+ handled = false;
+ else
+ SceneItem::display2(_resNum, _talkLineNum);
+ break;
+ default:
+ handled = false;
+ break;
+ }
+
+ if (!handled)
+ handled = ((SceneExt *)BF_GLOBALS._sceneManager._scene)->display(action);
+ return handled;
+}
+
+void NamedObject::setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) {
_resNum = resNum;
_lookLineNum = lookLineNum;
_talkLineNum = talkLineNum;
@@ -315,20 +482,27 @@ void NamedObject::setup(int resNum, int lookLineNum, int talkLineNum, int useLin
switch (mode) {
case 2:
- _globals->_sceneItems.push_front(this);
+ g_globals->_sceneItems.push_front(this);
break;
case 4:
- _globals->_sceneItems.addBefore(item, this);
+ g_globals->_sceneItems.addBefore(item, this);
break;
case 5:
- _globals->_sceneItems.addAfter(item, this);
+ g_globals->_sceneItems.addAfter(item, this);
break;
default:
- _globals->_sceneItems.push_back(this);
+ g_globals->_sceneItems.push_back(this);
break;
}
}
+void NamedObject::setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum) {
+ _resNum = resNum;
+ _lookLineNum = lookLineNum;
+ _talkLineNum = talkLineNum;
+ _useLineNum = useLineNum;
+}
+
/*--------------------------------------------------------------------------*/
CountdownObject::CountdownObject(): NamedObject() {
@@ -412,17 +586,84 @@ void FollowerObject::setup(SceneObject *object, int visage, int frameNum, int yD
/*--------------------------------------------------------------------------*/
-SceneExt::SceneExt(): Scene() {
- warning("TODO: dword_503AA/dword_503AE/dword_53030");
+FocusObject::FocusObject(): NamedObject() {
+ _img = surfaceFromRes(1, 5, 7);
+}
- _field372 = 0;
- _field37A = 0;
- _eventHandler = NULL;
+void FocusObject::postInit(SceneObjectList *OwnerList) {
+ NamedObject::postInit(OwnerList);
+ _resNum = 560;
+ _lookLineNum = 43;
+ _talkLineNum = 44;
+ _useLineNum = -1;
+ _v90 = 0;
+ _v92 = 1;
+
+ SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene;
+ scene->_focusObject = this;
+ BF_GLOBALS._sceneItems.push_front(this);
+}
+
+void FocusObject::synchronize(Serializer &s) {
+ NamedObject::synchronize(s);
+ s.syncAsSint16LE(_v90);
+ s.syncAsSint16LE(_v92);
+}
+
+void FocusObject::remove() {
+ BF_GLOBALS._sceneItems.remove(this);
+
+ SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene;
+ if (scene->_focusObject == this)
+ scene->_focusObject = NULL;
+
+ BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor());
+ NamedObject::remove();
+}
+
+void FocusObject::process(Event &event) {
+ if (BF_GLOBALS._player._enabled) {
+ if (_bounds.contains(event.mousePos)) {
+ // Reset the cursor back to normal
+ BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor());
+
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == CURSOR_WALK) &&
+ (event.btnState == 3)) {
+ BF_GLOBALS._events.setCursor(CURSOR_USE);
+ event.handled = true;
+ }
+ } else if (event.mousePos.y < 168) {
+ // Change the cursor to an 'Exit' image
+ BF_GLOBALS._events.setCursor(_img);
+ if (event.eventType == EVENT_BUTTON_DOWN) {
+ // Remove the object from display
+ event.handled = true;
+ remove();
+ }
+ }
+ }
+
+ if (_action)
+ _action->process(event);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SceneExt::SceneExt(): Scene() {
+ _stripManager._onBegin = SceneExt::startStrip;
+ _stripManager._onEnd = SceneExt::endStrip;
+
+ _field372 = _field37A = 0;
+ _savedPlayerEnabled = false;
+ _savedUiEnabled = false;
+ _savedCanWalk = false;
+ _focusObject = NULL;
+ _cursorVisage.setVisage(1, 8);
}
void SceneExt::postInit(SceneObjectList *OwnerList) {
Scene::postInit(OwnerList);
- if (BF_GLOBALS._v4CEA2) {
+ if (BF_GLOBALS._dayNumber) {
// Blank out the bottom portion of the screen
BF_GLOBALS._interfaceY = BF_INTERFACE_Y;
@@ -441,11 +682,11 @@ void SceneExt::dispatch() {
_timerList.dispatch();
if (_field37A) {
- if ((--_field37A == 0) && BF_GLOBALS._v4CEA2) {
- if (BF_GLOBALS._v4E238 && (BF_GLOBALS._v4CF9E == 1)) {
- warning("sub_1B052");
+ if ((--_field37A == 0) && BF_GLOBALS._dayNumber) {
+ if (BF_GLOBALS._uiElements._active && BF_GLOBALS._player._enabled) {
+ BF_GLOBALS._uiElements.show();
}
-
+
_field37A = 0;
}
}
@@ -455,330 +696,543 @@ void SceneExt::dispatch() {
void SceneExt::loadScene(int sceneNum) {
Scene::loadScene(sceneNum);
-
+
_v51C34.top = 0;
_v51C34.bottom = 300;
}
+void SceneExt::checkGun() {
+ // Remove a bullet from the currently loaded clip
+ if (BF_GLOBALS.getFlag(fLoadedSpare) && (BF_GLOBALS._clip2Bullets > 0)) {
+ if (--BF_GLOBALS._clip2Bullets == 0)
+ BF_GLOBALS.clearFlag(fGunLoaded);
+ } else {
+ if (BF_GLOBALS._clip1Bullets > 0)
+ --BF_GLOBALS._clip1Bullets;
+
+ if (!BF_GLOBALS._clip1Bullets)
+ BF_GLOBALS.clearFlag(fGunLoaded);
+ }
+
+ BF_GLOBALS._sound3.play(4);
+}
+
+bool SceneExt::display(CursorType action) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(9000, BF_GLOBALS._randomSource.getRandomNumber(2));
+ break;
+ case CURSOR_USE:
+ SceneItem::display2(9000, BF_GLOBALS._randomSource.getRandomNumber(2) + 6);
+ break;
+ case CURSOR_TALK:
+ SceneItem::display2(9000, BF_GLOBALS._randomSource.getRandomNumber(2) + 3);
+ break;
+ case INV_COLT45:
+ gunDisplay();
+ break;
+ default:
+ if (action < BF_LAST_INVENT)
+ SceneItem::display2(9002, (int)action);
+ else
+ return false;
+ break;
+ }
+
+ return true;
+}
+
+void SceneExt::fadeOut() {
+ uint32 black = 0;
+ BF_GLOBALS._scenePalette.fade((const byte *)&black, false, 100);
+}
+
+void SceneExt::gunDisplay() {
+ if (!BF_GLOBALS.getFlag(gunDrawn)) {
+ // Gun not drawn
+ SceneItem::display2(1, BF_GLOBALS.getFlag(fCanDrawGun) ? 0 : 4);
+ } else if (!BF_GLOBALS.getFlag(fGunLoaded)) {
+ // Gun not loaded
+ SceneItem::display2(1, 1);
+ } else if (!BF_GLOBALS.getHasBullets()) {
+ // Out of ammunition
+ SceneItem::display2(1, 2);
+ } else {
+ // Check scene for whether gun can fire
+ checkGun();
+ }
+}
+
+void SceneExt::startStrip() {
+ SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene;
+ scene->_field372 = 1;
+ scene->_savedPlayerEnabled = BF_GLOBALS._player._enabled;
+
+ if (scene->_savedPlayerEnabled) {
+ scene->_savedUiEnabled = BF_GLOBALS._player._uiEnabled;
+ scene->_savedCanWalk = BF_GLOBALS._player._canWalk;
+ BF_GLOBALS._player.disableControl();
+
+ if (!BF_GLOBALS._v50696 && BF_GLOBALS._uiElements._active)
+ BF_GLOBALS._uiElements.hide();
+ }
+}
+
+void SceneExt::endStrip() {
+ SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene;
+ scene->_field372 = 0;
+
+ if (scene->_savedPlayerEnabled) {
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player._uiEnabled = scene->_savedUiEnabled;
+ BF_GLOBALS._player._canWalk = scene->_savedCanWalk;
+
+ if (!BF_GLOBALS._v50696 && BF_GLOBALS._uiElements._active)
+ BF_GLOBALS._uiElements.show();
+ }
+}
+
+void SceneExt::clearScreen() {
+ BF_GLOBALS._screenSurface.fillRect(BF_GLOBALS._screenSurface.getBounds(), 0);
+}
+
/*--------------------------------------------------------------------------*/
-GameScene::GameScene() {
+PalettedScene::PalettedScene(): SceneExt() {
+ _field794 = 0;
+}
+void PalettedScene::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_field794);
}
-void GameScene::postInit(SceneObjectList *OwnerList) {
+void PalettedScene::postInit(SceneObjectList *OwnerList) {
_field794 = 0;
- _field412 = 1;
+ _palette._field412 = 1;
SceneExt::postInit(OwnerList);
}
-void GameScene::remove() {
+void PalettedScene::remove() {
SceneExt::remove();
if (_field794 == 1) {
for (SynchronizedList<SceneObject *>::iterator i = BF_GLOBALS._sceneObjects->begin();
i != BF_GLOBALS._sceneObjects->end(); ++i)
(*i)->remove();
-
+
BF_GLOBALS._sceneObjects->draw();
BF_GLOBALS._scenePalette.loadPalette(2);
BF_GLOBALS._v51C44 = 1;
- BF_GLOBALS._v51C42 = 1;
+ BF_GLOBALS._sceneManager._hasPalette = true;
}
- BF_GLOBALS._scenePalette._field412 = 1;
+ BF_GLOBALS._scenePalette._field412 = 0;
}
-/*--------------------------------------------------------------------------*/
-
-void SceneHandlerExt::postInit(SceneObjectList *OwnerList) {
- SceneHandler::postInit(OwnerList);
-
- // Load the low end palette data
- GLOBALS._scenePalette.loadPalette(2);
- GLOBALS._scenePalette.refresh();
+PaletteFader *PalettedScene::addFader(const byte *arrBufferRGB, int step, Action *action) {
+ _field794 = 1;
+ return BF_GLOBALS._scenePalette.addFader(arrBufferRGB, 1, step, action);
}
-void SceneHandlerExt::process(Event &event) {
- SceneHandler::process(event);
-
- // TODO: All the new stuff from Blue Force
+void PalettedScene::add2Faders(const byte *arrBufferRGB, int step, int paletteNum, Action *action) {
+ BF_GLOBALS._scenePalette.addFader(arrBufferRGB, 1, 100, NULL);
+ _palette.loadPalette(paletteNum);
+ _palette.loadPalette(2);
+ BF_GLOBALS._scenePalette.addFader(_palette._palette, 256, step, action);
}
-/*--------------------------------------------------------------------------*/
+void PalettedScene::sub15E4F(const byte *arrBufferRGB, int arg8, int paletteNum, Action *action, int fromColor1, int fromColor2, int toColor1, int toColor2, bool flag) {
+ byte tmpPalette[768];
-VisualSpeaker::VisualSpeaker(): Speaker() {
- _textWidth = 312;
- _color1 = 19;
- _hideObjects = false;
- _removeObject1 = false;
- _removeObject2 = false;
- _field20E = 160;
- _fontNumber = 4;
- _color2 = 82;
- _offsetPos = Common::Point(4, 170);
- _numFrames = 0;
-}
-
-void VisualSpeaker::remove() {
- if (_removeObject2)
- _object2.remove();
- if (_removeObject1)
- _object1.remove();
-
- Speaker::remove();
-}
-
-void VisualSpeaker::synchronize(Serializer &s) {
- Speaker::synchronize(s);
-
- s.syncAsByte(_removeObject1);
- s.syncAsByte(_removeObject2);
- s.syncAsSint16LE(_field20C);
- s.syncAsSint16LE(_field20E);
- s.syncAsSint16LE(_numFrames);
- s.syncAsSint16LE(_offsetPos.x);
- s.syncAsSint16LE(_offsetPos.y);
-}
-
-void VisualSpeaker::proc12(Action *action) {
- Speaker::proc12(action);
- _textPos = Common::Point(_offsetPos.x + BF_GLOBALS._sceneManager._scene->_sceneBounds.left,
- _offsetPos.y + BF_GLOBALS._sceneManager._scene->_sceneBounds.top);
- _numFrames = 0;
-}
-
-void VisualSpeaker::setText(const Common::String &msg) {
- BF_GLOBALS._events.waitForPress();
- _objectList.draw();
-
- _sceneText._color1 = _color1;
- _sceneText._color2 = _color2;
- _sceneText._color3 = _color3;
- _sceneText._width = _textWidth;
- _sceneText._fontNumber = _fontNumber;
- _sceneText._textMode = _textMode;
- _sceneText.setup(msg);
-
- // Get the string bounds
- GfxFont f;
- f.setFontNumber(_fontNumber);
- Rect bounds;
- f.getStringBounds(msg.c_str(), bounds, _textWidth);
-
- // Set the position for the text
- switch (_textMode) {
- case ALIGN_LEFT:
- case ALIGN_JUSTIFIED:
- _sceneText.setPosition(_textPos);
- break;
- case ALIGN_CENTER:
- _sceneText.setPosition(Common::Point(_textPos.x + (_textWidth - bounds.width()) / 2, _textPos.y));
- break;
- case ALIGN_RIGHT:
- _sceneText.setPosition(Common::Point(_textPos.x + _textWidth - bounds.width(), _textPos.y));
- break;
- default:
- break;
+ _palette.loadPalette(paletteNum);
+ _palette.loadPalette(2);
+ if (!flag) {
+ for (int i = fromColor1; i <= fromColor2; i++) {
+ tmpPalette[(3 * i)] = BF_GLOBALS._scenePalette._palette[(3 * i)];
+ tmpPalette[(3 * i) + 1] = BF_GLOBALS._scenePalette._palette[(3 * i) + 1];
+ tmpPalette[(3 * i) + 2] = BF_GLOBALS._scenePalette._palette[(3 * i) + 2];
+ }
+ } else {
+ for (int i = fromColor1; i <= fromColor2; i++) {
+ tmpPalette[(3 * i)] = _palette._palette[(3 * i)];
+ tmpPalette[(3 * i) + 1] = _palette._palette[(3 * i) + 1];
+ tmpPalette[(3 * i) + 2] = _palette._palette[(3 * i) + 2];
+ }
}
- // Ensure the text is in the foreground
- _sceneText.fixPriority(256);
-
- // Count the number of words (by spaces) in the string
- const char *s = msg.c_str();
- int spaceCount = 0;
- while (*s) {
- if (*s++ == ' ')
- ++spaceCount;
+ for (int i = toColor1; i <= toColor2; i++) {
+ tmpPalette[i] = _palette._palette[i] - ((_palette._palette[i] - arrBufferRGB[0]) * (100 - arg8)) / 100;
+ tmpPalette[i + 1] = _palette._palette[i + 1] - ((_palette._palette[i + 1] - arrBufferRGB[1]) * (100 - arg8)) / 100;
+ tmpPalette[i + 2] = _palette._palette[i + 2] - ((_palette._palette[i + 2] - arrBufferRGB[2]) * (100 - arg8)) / 100;
}
- _numFrames = spaceCount * 3 + 2;
+ BF_GLOBALS._scenePalette.addFader((const byte *)tmpPalette, 256, 100, action);
}
+
/*--------------------------------------------------------------------------*/
-SpeakerSutter::SpeakerSutter() {
- _speakerName = "SUTTER";
- _color1 = 20;
- _color2 = 22;
- _textMode = ALIGN_CENTER;
+void SceneHandlerExt::postInit(SceneObjectList *OwnerList) {
+ SceneHandler::postInit(OwnerList);
+
+ // Load the low end palette data
+ BF_GLOBALS._scenePalette.loadPalette(2);
+ BF_GLOBALS._scenePalette.refresh();
}
-void SpeakerSutter::setText(const Common::String &msg) {
- _removeObject1 = _removeObject2 = true;
+void SceneHandlerExt::process(Event &event) {
+ SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene;
+ if (scene && scene->_focusObject)
+ scene->_focusObject->process(event);
- _object1.postInit();
- _object1.setVisage(329);
- _object1.setStrip2(2);
- _object1.fixPriority(254);
- _object1.changeZoom(100);
- _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 45,
- BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+ if (BF_GLOBALS._uiElements._active) {
+ BF_GLOBALS._uiElements.process(event);
+ if (event.handled)
+ return;
+ }
- _object2.postInit();
- _object2.setVisage(329);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 45,
- BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+ // If the strip proxy is currently being controlled by the strip manager,
+ // then pass all events to it first
+ if (BF_GLOBALS._stripProxy._action) {
+ BF_GLOBALS._stripProxy._action->process(event);
+ if (event.handled)
+ return;
+ }
- VisualSpeaker::setText(msg);
- _object2.fixCountdown(8, _numFrames);
+ SceneHandler::process(event);
}
-/*--------------------------------------------------------------------------*/
-
-SpeakerDoug::SpeakerDoug(): VisualSpeaker() {
- _color1 = 32;
- _speakerName = "DOUG";
+void SceneHandlerExt::playerAction(Event &event) {
+ if (BF_GLOBALS._events.getCursor() == INV_DOG_WHISTLE) {
+ SceneItem::display2(1, 6);
+ event.handled = true;
+ }
}
-/*--------------------------------------------------------------------------*/
-
-SpeakerJakeNoHead::SpeakerJakeNoHead(): VisualSpeaker() {
- _color1 = 13;
- _speakerName = "JAKE_NO_HEAD";
+void SceneHandlerExt::processEnd(Event &event) {
+ // Check for a fallback text display for the given cursor/item being used in the scene
+ if (!event.handled && BF_GLOBALS._sceneManager._scene) {
+ CursorType cursor = BF_GLOBALS._events.getCursor();
+ if (((SceneExt *)BF_GLOBALS._sceneManager._scene)->display(cursor))
+ event.handled = true;
+ }
}
/*--------------------------------------------------------------------------*/
BlueForceInvObjectList::BlueForceInvObjectList():
- _business_card(9, 4, 2, 0),
- _lauras_sweater(9, 4, 3, 0),
- _handcuffs(9, 1, 4, 0),
- _magnum(9, 1, 5, 0),
- _ticket_book(9, 1, 6, 0),
- _miranda_card(9, 1, 7, 0),
- _forest_follet(9, 1, 8, 0),
- _bradford_id(9, 1, 9, 0),
- _baseball_card(9, 1, 10, 0),
- _slip_bradford(9, 1, 11, 0),
- _flare(9, 1, 12, 0),
- _rap_sheet(9, 1, 13, 0),
- _cartridges(9, 1, 14, 0),
- _rifle(9, 1, 15, 0),
- _wig(9, 1, 16, 0),
- _frankies_id(9, 1, 17, 0),
- _tyrones_id(9, 1, 18, 0),
- _pistol22(9, 1, 19, 0),
- _unused(1, 1, 1, 0),
- _slip_frankie(9, 2, 1, 0),
- _slip_tyrone(9, 2, 2, 0),
- _atf_teletype(9, 2, 3, 0),
- _da_note(9, 2, 4, 0),
- _blueprints(9, 2, 5, 0),
- _planter_key(9, 2, 6, 0),
- _center_punch(9, 2, 7, 0),
- _tranquilizer(9, 2, 8, 0),
- _boat_hook(9, 2, 9, 0),
- _oily_rags(9, 2, 10, 0),
- _fuel_jar(9, 2, 11, 0),
- _screwdriver(9, 2, 12, 0),
- _floppy_disk1(9, 2, 13, 0),
- _floppy_disk2(9, 2, 14, 0),
- _driftwood(9, 2, 15, 0),
- _crate_piece1(9, 2, 16, 0),
- _crate_piece2(9, 2, 17, 0),
- _shoebox(9, 2, 18, 0),
- _badge(9, 2, 19, 0),
- _unused2(1, 1, 1, 0),
- _rental_coupons(9, 3, 1, 0),
- _nickel(9, 3, 2, 0),
- _calendar(9, 3, 3, 0),
- _dixon_note(9, 3, 4, 0),
- _cobb_mugshot(9, 3, 5, 0),
- _murder_article(9, 3, 6, 0),
- _microfiche(9, 3, 7, 0),
- _future_wave_keys(9, 3, 8, 0),
- _rental_boat_keys(9, 3, 9, 0),
- _napkin(9, 3, 10, 0),
- _cobb_printout(9, 3, 11, 0),
- _fishing_net(9, 3, 12, 0),
- _id(9, 3, 13, 0),
- _rounds_9mm(9, 3, 14, 0),
- _dates_note(9, 3, 15, 0),
- _hand_grenade(9, 3, 16, 0),
- _cord_110(9, 3, 17, 0),
- _cord_110_plug(9, 3, 18, 0),
- _cord_220(9, 3, 19, 0),
- _unused3(1, 1, 1, 0),
- _cord_220_plug(9, 4, 1, 0),
- _official_document(9, 4, 2, 0),
- _red_sweater(9, 4, 3, 0),
- _jackknife(9, 4, 4, 0),
- _whistle(9, 4, 5, 0),
- _gun(9, 1, 2, 0),
- _alley_cat_key(9, 4, 7, 0) {
+ _none(9, 5, 1),
+ _colt45(9, 1, 1),
+ _ammoClip(9, 4, 2),
+ _spareClip(9, 4, 3),
+ _handcuffs(9, 1, 4),
+ _greensGun(9, 1, 5),
+ _ticketBook(9, 1, 6),
+ _mirandaCard(9, 1, 7),
+ _forestRap(9, 1, 8),
+ _greenId(9, 1, 9),
+ _baseballCard(9, 1, 10),
+ _bookingGreen(9, 1, 11),
+ _flare(9, 1, 12),
+ _cobbRap(9, 1, 13),
+ _bullet22(9, 1, 14),
+ _autoRifle(9, 1, 15),
+ _wig(9, 1, 16),
+ _frankieId(9, 1, 17),
+ _tyroneId(9, 1, 18),
+ _snub22(9, 1, 19),
+ _bug(1, 1, 1),
+ _bookingFrankie(9, 2, 1),
+ _bookingGang(9, 2, 2),
+ _fbiTeletype(9, 2, 3),
+ _daNote(9, 2, 4),
+ _printOut(9, 2, 5),
+ _warehouseKeys(9, 2, 6),
+ _centerPunch(9, 2, 7),
+ _tranqGun(9, 2, 8),
+ _hook(9, 2, 9),
+ _rags(9, 2, 10),
+ _jar(9, 2, 11),
+ _screwdriver(9, 2, 12),
+ _dFloppy(9, 2, 13),
+ _blankDisk(9, 2, 14),
+ _stick(9, 2, 15),
+ _crate1(9, 2, 16),
+ _crate2(9, 2, 17),
+ _shoebox(9, 2, 18),
+ _badge(9, 2, 19),
+ _bug2(1, 1, 1),
+ _rentalCoupon(9, 3, 1),
+ _nickel(9, 3, 2),
+ _lyleCard(9, 3, 3),
+ _carterNote(9, 3, 4),
+ _mugshot(9, 3, 5),
+ _clipping(9, 3, 6),
+ _microfilm(9, 3, 7),
+ _waveKeys(9, 3, 8),
+ _rentalKeys(9, 3, 9),
+ _napkin(9, 3, 10),
+ _dmvPrintout(9, 3, 11),
+ _fishingNet(9, 3, 12),
+ _id(9, 3, 13),
+ _bullets9mm(9, 3, 14),
+ _schedule(9, 3, 15),
+ _grenades(9, 3, 16),
+ _yellowCord(9, 3, 17),
+ _halfYellowCord(9, 3, 18),
+ _blackCord(9, 3, 19),
+ _bug3(1, 1, 1),
+ _halfBlackCord(9, 4, 1),
+ _warrant(9, 4, 2),
+ _jacket(9, 4, 3),
+ _greensKnife(9, 4, 4),
+ _dogWhistle(9, 4, 5),
+ _ammoBelt(9, 1, 2),
+ _alleyCatKey(9, 4, 7) {
// Add the items to the list
- _itemList.push_back(&_business_card);
- _itemList.push_back(&_lauras_sweater);
+ _itemList.push_back(&_none);
+ _itemList.push_back(&_colt45);
+ _itemList.push_back(&_ammoClip);
+ _itemList.push_back(&_spareClip);
_itemList.push_back(&_handcuffs);
- _itemList.push_back(&_magnum);
- _itemList.push_back(&_ticket_book);
- _itemList.push_back(&_miranda_card);
- _itemList.push_back(&_forest_follet);
- _itemList.push_back(&_bradford_id);
- _itemList.push_back(&_baseball_card);
- _itemList.push_back(&_slip_bradford);
+ _itemList.push_back(&_greensGun);
+ _itemList.push_back(&_ticketBook);
+ _itemList.push_back(&_mirandaCard);
+ _itemList.push_back(&_forestRap);
+ _itemList.push_back(&_greenId);
+ _itemList.push_back(&_baseballCard);
+ _itemList.push_back(&_bookingGreen);
_itemList.push_back(&_flare);
- _itemList.push_back(&_rap_sheet);
- _itemList.push_back(&_cartridges);
- _itemList.push_back(&_rifle);
+ _itemList.push_back(&_cobbRap);
+ _itemList.push_back(&_bullet22);
+ _itemList.push_back(&_autoRifle);
_itemList.push_back(&_wig);
- _itemList.push_back(&_frankies_id);
- _itemList.push_back(&_tyrones_id);
- _itemList.push_back(&_pistol22);
- _itemList.push_back(&_unused);
- _itemList.push_back(&_slip_frankie);
- _itemList.push_back(&_slip_tyrone);
- _itemList.push_back(&_atf_teletype);
- _itemList.push_back(&_da_note);
- _itemList.push_back(&_blueprints);
- _itemList.push_back(&_planter_key);
- _itemList.push_back(&_center_punch);
- _itemList.push_back(&_tranquilizer);
- _itemList.push_back(&_boat_hook);
- _itemList.push_back(&_oily_rags);
- _itemList.push_back(&_fuel_jar);
+ _itemList.push_back(&_frankieId);
+ _itemList.push_back(&_tyroneId);
+ _itemList.push_back(&_snub22);
+ _itemList.push_back(&_bug);
+ _itemList.push_back(&_bookingFrankie);
+ _itemList.push_back(&_bookingGang);
+ _itemList.push_back(&_fbiTeletype);
+ _itemList.push_back(&_daNote);
+ _itemList.push_back(&_printOut);
+ _itemList.push_back(&_warehouseKeys);
+ _itemList.push_back(&_centerPunch);
+ _itemList.push_back(&_tranqGun);
+ _itemList.push_back(&_hook);
+ _itemList.push_back(&_rags);
+ _itemList.push_back(&_jar);
_itemList.push_back(&_screwdriver);
- _itemList.push_back(&_floppy_disk1);
- _itemList.push_back(&_floppy_disk2);
- _itemList.push_back(&_driftwood);
- _itemList.push_back(&_crate_piece1);
- _itemList.push_back(&_crate_piece2);
+ _itemList.push_back(&_dFloppy);
+ _itemList.push_back(&_blankDisk);
+ _itemList.push_back(&_stick);
+ _itemList.push_back(&_crate1);
+ _itemList.push_back(&_crate2);
_itemList.push_back(&_shoebox);
_itemList.push_back(&_badge);
- _itemList.push_back(&_unused2);
- _itemList.push_back(&_rental_coupons);
+ _itemList.push_back(&_bug2);
+ _itemList.push_back(&_rentalCoupon);
_itemList.push_back(&_nickel);
- _itemList.push_back(&_calendar);
- _itemList.push_back(&_dixon_note);
- _itemList.push_back(&_cobb_mugshot);
- _itemList.push_back(&_murder_article);
- _itemList.push_back(&_microfiche);
- _itemList.push_back(&_future_wave_keys);
- _itemList.push_back(&_rental_boat_keys);
+ _itemList.push_back(&_lyleCard);
+ _itemList.push_back(&_carterNote);
+ _itemList.push_back(&_mugshot);
+ _itemList.push_back(&_clipping);
+ _itemList.push_back(&_microfilm);
+ _itemList.push_back(&_waveKeys);
+ _itemList.push_back(&_rentalKeys);
_itemList.push_back(&_napkin);
- _itemList.push_back(&_cobb_printout);
- _itemList.push_back(&_fishing_net);
+ _itemList.push_back(&_dmvPrintout);
+ _itemList.push_back(&_fishingNet);
_itemList.push_back(&_id);
- _itemList.push_back(&_rounds_9mm);
- _itemList.push_back(&_dates_note);
- _itemList.push_back(&_hand_grenade);
- _itemList.push_back(&_cord_110);
- _itemList.push_back(&_cord_110_plug);
- _itemList.push_back(&_cord_220);
- _itemList.push_back(&_unused3);
- _itemList.push_back(&_cord_220_plug);
- _itemList.push_back(&_official_document);
- _itemList.push_back(&_red_sweater);
- _itemList.push_back(&_jackknife);
- _itemList.push_back(&_whistle);
- _itemList.push_back(&_gun);
- _itemList.push_back(&_alley_cat_key);
+ _itemList.push_back(&_bullets9mm);
+ _itemList.push_back(&_schedule);
+ _itemList.push_back(&_grenades);
+ _itemList.push_back(&_yellowCord);
+ _itemList.push_back(&_halfYellowCord);
+ _itemList.push_back(&_blackCord);
+ _itemList.push_back(&_bug3);
+ _itemList.push_back(&_halfBlackCord);
+ _itemList.push_back(&_warrant);
+ _itemList.push_back(&_jacket);
+ _itemList.push_back(&_greensKnife);
+ _itemList.push_back(&_dogWhistle);
+ _itemList.push_back(&_ammoBelt);
+ _itemList.push_back(&_alleyCatKey);
+}
+
+void BlueForceInvObjectList::reset() {
+ // Reset all object scene numbers
+ SynchronizedList<InvObject *>::iterator i;
+ for (i = _itemList.begin(); i != _itemList.end(); ++i) {
+ (*i)->_sceneNumber = 0;
+ }
+
+ // Set up default inventory
+ setObjectScene(INV_COLT45, 1);
+ setObjectScene(INV_HANDCUFFS, 1);
+ setObjectScene(INV_AMMO_BELT, 1);
+ setObjectScene(INV_ID, 1);
+
+ // Set default room for other objects
+ setObjectScene(INV_TICKET_BOOK, 60);
+ setObjectScene(INV_MIRANDA_CARD, 60);
+ setObjectScene(INV_FOREST_RAP, 320);
+ setObjectScene(INV_GREEN_ID, 370);
+ setObjectScene(INV_BASEBALL_CARD, 840);
+ setObjectScene(INV_BOOKING_GREEN, 390);
+ setObjectScene(INV_FLARE, 355);
+ setObjectScene(INV_COBB_RAP, 810);
+ setObjectScene(INV_22_BULLET, 415);
+ setObjectScene(INV_AUTO_RIFLE, 415);
+ setObjectScene(INV_WIG, 415);
+ setObjectScene(INV_FRANKIE_ID, 410);
+ setObjectScene(INV_TYRONE_ID, 410);
+ setObjectScene(INV_22_SNUB, 410);
+ setObjectScene(INV_FBI_TELETYPE, 320);
+ setObjectScene(INV_DA_NOTE, 320);
+ setObjectScene(INV_PRINT_OUT, 570);
+ setObjectScene(INV_WAREHOUSE_KEYS, 360);
+ setObjectScene(INV_CENTER_PUNCH, 0);
+ setObjectScene(INV_TRANQ_GUN, 830);
+ setObjectScene(INV_HOOK, 350);
+ setObjectScene(INV_RAGS, 870);
+ setObjectScene(INV_JAR, 870);
+ setObjectScene(INV_SCREWDRIVER, 355);
+ setObjectScene(INV_D_FLOPPY, 570);
+ setObjectScene(INV_BLANK_DISK, 560);
+ setObjectScene(INV_STICK, 710);
+ setObjectScene(INV_CRATE1, 710);
+ setObjectScene(INV_CRATE2, 870);
+ setObjectScene(INV_SHOEBOX, 270);
+ setObjectScene(INV_BADGE, 560);
+ setObjectScene(INV_RENTAL_COUPON, 0);
+ setObjectScene(INV_NICKEL, 560);
+ setObjectScene(INV_LYLE_CARD, 270);
+ setObjectScene(INV_CARTER_NOTE, 830);
+ setObjectScene(INV_MUG_SHOT, 810);
+ setObjectScene(INV_CLIPPING, 810);
+ setObjectScene(INV_MICROFILM, 810);
+ setObjectScene(INV_WAVE_KEYS, 840);
+ setObjectScene(INV_RENTAL_KEYS, 840);
+ setObjectScene(INV_NAPKIN, 115);
+ setObjectScene(INV_DMV_PRINTOUT, 810);
+ setObjectScene(INV_FISHING_NET, 830);
+ setObjectScene(INV_9MM_BULLETS, 930);
+ setObjectScene(INV_SCHEDULE, 930);
+ setObjectScene(INV_GRENADES, 355);
+ setObjectScene(INV_GREENS_KNIFE, 370);
+ setObjectScene(INV_JACKET, 880);
+ setObjectScene(INV_DOG_WHISTLE, 880);
+ setObjectScene(INV_YELLOW_CORD, 910);
+ setObjectScene(INV_BLACK_CORD, 910);
+}
+
+void BlueForceInvObjectList::setObjectScene(int objectNum, int sceneNumber) {
+ // Find the appropriate object
+ int num = objectNum;
+ SynchronizedList<InvObject *>::iterator i = _itemList.begin();
+ while (num-- > 0) ++i;
+ (*i)->_sceneNumber = sceneNumber;
+
+ // If the item is the currently active one, default back to the use cursor
+ if (BF_GLOBALS._events.getCursor() == objectNum)
+ BF_GLOBALS._events.setCursor(CURSOR_USE);
+
+ // Update the user interface if necessary
+ BF_GLOBALS._uiElements.updateInventory();
}
+void BlueForceInvObjectList::alterInventory(int mode) {
+ // Check for existing specific items in player's inventory
+ bool hasPrintout = getObjectScene(INV_PRINT_OUT) == 1;
+ bool hasRags = getObjectScene(INV_RAGS) == 1;
+ bool hasJar = getObjectScene(INV_JAR) == 1;
+ bool hasNickel = getObjectScene(INV_NICKEL) == 1;
+ bool hasCrate1 = getObjectScene(INV_CRATE1) == 1; //di
+ bool hasForestRap = getObjectScene(INV_FOREST_RAP) == 1;
+ bool hasRentalCoupon = getObjectScene(INV_RENTAL_COUPON) == 1; //si
+ bool hasWarehouseKeys = getObjectScene(INV_WAREHOUSE_KEYS) == 1;
+ bool hasCobbRap = getObjectScene(INV_COBB_RAP) == 1;
+ bool hasHook = getObjectScene(INV_HOOK) == 1;
+ bool hasMugShot = getObjectScene(INV_MUG_SHOT) == 1;
+
+ // Remove any items currently in player's inventory
+ SynchronizedList<InvObject *>::iterator i;
+ for (i = _itemList.begin(); i != _itemList.end(); ++i) {
+ if ((*i)->_sceneNumber == 1)
+ (*i)->_sceneNumber = 0;
+ }
+
+ // Give basic set of items back into inventory
+ setObjectScene(INV_COLT45, 1);
+ setObjectScene(INV_HANDCUFFS, 1);
+ setObjectScene(INV_AMMO_BELT, 1);
+ setObjectScene(INV_ID, 1);
+
+ // Reset ticket book and miranda card back to motorcycle
+ setObjectScene(INV_TICKET_BOOK, 60);
+ setObjectScene(INV_MIRANDA_CARD, 60);
+
+ BF_GLOBALS._v4CEC4 = 0;
+
+ switch (mode) {
+ case 2:
+ if (hasPrintout)
+ setObjectScene(INV_PRINT_OUT, 1);
+ if (hasNickel)
+ setObjectScene(INV_NICKEL, 1);
+ if (hasForestRap)
+ setObjectScene(INV_FOREST_RAP, 1);
+ if (hasCrate1)
+ setObjectScene(INV_CRATE1, 1);
+ if (hasRentalCoupon)
+ setObjectScene(INV_RENTAL_COUPON, 1);
+ if (hasHook)
+ setObjectScene(INV_HOOK, 1);
+ break;
+ case 3:
+ if (hasPrintout)
+ setObjectScene(INV_PRINT_OUT, 1);
+ if (hasNickel)
+ setObjectScene(INV_NICKEL, 1);
+ if (hasForestRap)
+ setObjectScene(INV_FOREST_RAP, 1);
+ if (hasCrate1)
+ setObjectScene(INV_CRATE1, 1);
+ if (hasRentalCoupon)
+ setObjectScene(INV_RENTAL_COUPON, 1);
+ if (hasCobbRap)
+ setObjectScene(INV_COBB_RAP, 1);
+ if (hasHook)
+ setObjectScene(INV_HOOK, 1);
+ if (hasMugShot)
+ setObjectScene(INV_MUG_SHOT, 1);
+ break;
+ case 4:
+ if (hasNickel)
+ setObjectScene(INV_NICKEL, 1);
+ if (hasRentalCoupon)
+ setObjectScene(INV_RENTAL_COUPON, 1);
+ if (hasHook)
+ setObjectScene(INV_HOOK, 1);
+ break;
+ case 5:
+ if (hasRags)
+ setObjectScene(INV_RAGS, 1);
+ if (hasJar)
+ setObjectScene(INV_JAR, 1);
+ if (hasRentalCoupon)
+ setObjectScene(INV_RENTAL_COUPON, 1);
+ if (hasWarehouseKeys)
+ setObjectScene(INV_WAREHOUSE_KEYS, 1);
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
} // End of namespace BlueForce
diff --git a/engines/tsage/blue_force/blueforce_logic.h b/engines/tsage/blue_force/blueforce_logic.h
index d756d85cb3..dcaea52444 100644
--- a/engines/tsage/blue_force/blueforce_logic.h
+++ b/engines/tsage/blue_force/blueforce_logic.h
@@ -35,12 +35,14 @@ namespace BlueForce {
using namespace TsAGE;
-#define BLUE_INVENTORY (*((::TsAGE::BlueForce::BlueForceInvObjectList *)_globals->_inventory))
+#define BF_INVENTORY (*((::TsAGE::BlueForce::BlueForceInvObjectList *)g_globals->_inventory))
class BlueForceGame: public Game {
public:
virtual void start();
virtual Scene *createScene(int sceneNumber);
+ virtual void rightClick();
+ virtual void processEvent(Event &event);
};
#define OBJ_ARRAY_SIZE 10
@@ -65,11 +67,11 @@ public:
class Timer: public EventHandler {
public:
Action *_tickAction;
- Action *_endAction;
+ EventHandler *_endHandler;
uint32 _endFrame;
public:
Timer();
- void set(uint32 delay, Action *endAction);
+ void set(uint32 delay, EventHandler *endHandler);
virtual Common::String getClassName() { return "Timer"; }
virtual void synchronize(Serializer &s);
@@ -81,16 +83,28 @@ public:
class TimerExt: public Timer {
public:
Action *_newAction;
-public:
+public:
TimerExt();
- void set(uint32 delay, Action *endAction, Action *action);
+ void set(uint32 delay, EventHandler *endHandler, Action *action);
virtual Common::String getClassName() { return "TimerExt"; }
virtual void synchronize(Serializer &s);
virtual void remove();
virtual void signal();
- virtual void dispatch();
-};
+};
+
+
+class SceneHotspotExt: public SceneHotspot {
+public:
+ int _state;
+
+ SceneHotspotExt() { _state = 0; }
+ virtual Common::String getClassName() { return "SceneHotspotExt"; }
+ virtual void synchronize(Serializer &s) {
+ SceneHotspot::synchronize(s);
+ s.syncAsSint16LE(_state);
+ }
+};
class SceneItemType2: public SceneHotspot {
public:
@@ -105,8 +119,35 @@ public:
virtual Common::String getClassName() { return "NamedObject"; }
virtual void synchronize(Serializer &s);
virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual bool startAction(CursorType action, Event &event);
- void setup(int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item);
+ void setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item);
+ void setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum);
+};
+
+class NamedObjectExt: public NamedObject {
+public:
+ int _flag;
+
+ NamedObjectExt() { _flag = 0; }
+ virtual Common::String getClassName() { return "NamedObjectExt"; }
+ virtual void synchronize(Serializer &s) {
+ NamedObject::synchronize(s);
+ s.syncAsSint16LE(_flag);
+ }
+};
+
+class NamedObject2: public NamedObject {
+public:
+ int _v1, _v2;
+
+ NamedObject2() { _v1 = _v2 = 0; }
+ virtual Common::String getClassName() { return "NamedObject2"; }
+ virtual void synchronize(Serializer &s) {
+ NamedObject::synchronize(s);
+ s.syncAsSint16LE(_v1);
+ s.syncAsSint16LE(_v2);
+ }
};
class CountdownObject: public NamedObject {
@@ -125,7 +166,7 @@ public:
SceneObject *_object;
FollowerObject();
- virtual Common::String getClassName() { return "SceneObjectExt4"; }
+ virtual Common::String getClassName() { return "FollowerObject"; }
virtual void synchronize(Serializer &s);
virtual void remove();
virtual void dispatch();
@@ -134,12 +175,35 @@ public:
void setup(SceneObject *object, int visage, int frameNum, int yDiff);
};
+class FocusObject: public NamedObject {
+public:
+ int _v90, _v92;
+ GfxSurface _img;
+
+ FocusObject();
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void synchronize(Serializer &s);
+ virtual void remove();
+ virtual void process(Event &event);
+};
+
+enum ExitFrame { EXITFRAME_N = 1, EXITFRAME_NE = 2, EXITFRAME_E = 3, EXITFRAME_SE = 4,
+ EXITFRAME_S = 5, EXITFRAME_SW = 6, EXITFRAME_W = 7, EXITFRAME_NW = 8 };
+
class SceneExt: public Scene {
+private:
+ static void startStrip();
+ static void endStrip();
public:
AObjectArray _timerList, _objArray2;
int _field372;
+ bool _savedPlayerEnabled;
+ bool _savedUiEnabled;
+ bool _savedCanWalk;
int _field37A;
- EventHandler *_eventHandler;
+
+ FocusObject *_focusObject;
+ Visage _cursorVisage;
Rect _v51C34;
public:
@@ -150,139 +214,115 @@ public:
virtual void process(Event &event);
virtual void dispatch();
virtual void loadScene(int sceneNum);
- virtual void proc13() { warning("TODO: SceneExt::proc13"); }
+ virtual void checkGun();
void addTimer(Timer *timer) { _timerList.add(timer); }
void removeTimer(Timer *timer) { _timerList.remove(timer); }
+ bool display(CursorType action);
+ void fadeOut();
+ void gunDisplay();
+ void clearScreen();
};
-class GameScene: public SceneExt {
+class PalettedScene: public SceneExt {
public:
- int _field412;
+ ScenePalette _palette;
int _field794;
public:
- GameScene();
+ PalettedScene();
+ virtual void synchronize(Serializer &s);
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void remove();
+ PaletteFader *addFader(const byte *arrBufferRGB, int step, Action *action);
+ void add2Faders(const byte *arrBufferRGB, int step, int paletteNum, Action *action);
+ void sub15E4F(const byte *arrBufferRGB, int arg8, int paletteNum, Action *action, int fromColor1, int fromColor2, int toColor1, int toColor2, bool flag);
};
class SceneHandlerExt: public SceneHandler {
public:
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void process(Event &event);
-};
-
-class VisualSpeaker: public Speaker {
-public:
- NamedObject _object1;
- CountdownObject _object2;
- bool _removeObject1, _removeObject2;
- int _field20C, _field20E;
- int _numFrames;
- Common::Point _offsetPos;
-public:
- VisualSpeaker();
-
- virtual Common::String getClassName() { return "VisualSpeaker"; }
- virtual void synchronize(Serializer &s);
- virtual void remove();
- virtual void proc12(Action *action);
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerSutter: public VisualSpeaker {
-public:
- SpeakerSutter();
-
- virtual Common::String getClassName() { return "SpeakerSutter"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerDoug: public VisualSpeaker {
-public:
- SpeakerDoug();
-
- virtual Common::String getClassName() { return "SpeakerDoug"; }
-};
-
-class SpeakerJakeNoHead: public VisualSpeaker {
-public:
- SpeakerJakeNoHead();
- virtual Common::String getClassName() { return "SpeakerJakeNoHead"; }
+ virtual void playerAction(Event &event);
+ virtual void processEnd(Event &event);
};
class BlueForceInvObjectList : public InvObjectList {
public:
- InvObject _business_card;
- InvObject _lauras_sweater;
+ InvObject _none;
+ InvObject _colt45;
+ InvObject _ammoClip;
+ InvObject _spareClip;
InvObject _handcuffs;
- InvObject _magnum;
- InvObject _ticket_book;
- InvObject _miranda_card;
- InvObject _forest_follet;
- InvObject _bradford_id;
- InvObject _baseball_card;
- InvObject _slip_bradford;
+ InvObject _greensGun;
+ InvObject _ticketBook;
+ InvObject _mirandaCard;
+ InvObject _forestRap;
+ InvObject _greenId;
+ InvObject _baseballCard;
+ InvObject _bookingGreen;
InvObject _flare;
- InvObject _rap_sheet;
- InvObject _cartridges;
- InvObject _rifle;
+ InvObject _cobbRap;
+ InvObject _bullet22;
+ InvObject _autoRifle;
InvObject _wig;
- InvObject _frankies_id;
- InvObject _tyrones_id;
- InvObject _pistol22;
- InvObject _unused;
- InvObject _slip_frankie;
- InvObject _slip_tyrone;
- InvObject _atf_teletype;
- InvObject _da_note;
- InvObject _blueprints;
- InvObject _planter_key;
- InvObject _center_punch;
- InvObject _tranquilizer;
- InvObject _boat_hook;
- InvObject _oily_rags;
- InvObject _fuel_jar;
+ InvObject _frankieId;
+ InvObject _tyroneId;
+ InvObject _snub22;
+ InvObject _bug;
+ InvObject _bookingFrankie;
+ InvObject _bookingGang;
+ InvObject _fbiTeletype;
+ InvObject _daNote;
+ InvObject _printOut;
+ InvObject _warehouseKeys;
+ InvObject _centerPunch;
+ InvObject _tranqGun;
+ InvObject _hook;
+ InvObject _rags;
+ InvObject _jar;
InvObject _screwdriver;
- InvObject _floppy_disk1;
- InvObject _floppy_disk2;
- InvObject _driftwood;
- InvObject _crate_piece1;
- InvObject _crate_piece2;
+ InvObject _dFloppy;
+ InvObject _blankDisk;
+ InvObject _stick;
+ InvObject _crate1;
+ InvObject _crate2;
InvObject _shoebox;
InvObject _badge;
- InvObject _unused2;
- InvObject _rental_coupons;
+ InvObject _bug2;
+ InvObject _rentalCoupon;
InvObject _nickel;
- InvObject _calendar;
- InvObject _dixon_note;
- InvObject _cobb_mugshot;
- InvObject _murder_article;
- InvObject _microfiche;
- InvObject _future_wave_keys;
- InvObject _rental_boat_keys;
+ InvObject _lyleCard;
+ InvObject _carterNote;
+ InvObject _mugshot;
+ InvObject _clipping;
+ InvObject _microfilm;
+ InvObject _waveKeys;
+ InvObject _rentalKeys;
InvObject _napkin;
- InvObject _cobb_printout;
- InvObject _fishing_net;
+ InvObject _dmvPrintout;
+ InvObject _fishingNet;
InvObject _id;
- InvObject _rounds_9mm;
- InvObject _dates_note;
- InvObject _hand_grenade;
- InvObject _cord_110;
- InvObject _cord_110_plug;
- InvObject _cord_220;
- InvObject _unused3;
- InvObject _cord_220_plug;
- InvObject _official_document;
- InvObject _red_sweater;
- InvObject _jackknife;
- InvObject _whistle;
- InvObject _gun;
- InvObject _alley_cat_key;
+ InvObject _bullets9mm;
+ InvObject _schedule;
+ InvObject _grenades;
+ InvObject _yellowCord;
+ InvObject _halfYellowCord;
+ InvObject _blackCord;
+ InvObject _bug3;
+ InvObject _halfBlackCord;
+ InvObject _warrant;
+ InvObject _jacket;
+ InvObject _greensKnife;
+ InvObject _dogWhistle;
+ InvObject _ammoBelt;
+ InvObject _alleyCatKey;
BlueForceInvObjectList();
+ void reset();
+ void setObjectScene(int objectNum, int sceneNumber);
+ void alterInventory(int mode);
virtual Common::String getClassName() { return "BlueForceInvObjectList"; }
};
diff --git a/engines/tsage/blue_force/blueforce_scenes0.cpp b/engines/tsage/blue_force/blueforce_scenes0.cpp
index f1b714ec6c..1e8c535f5f 100644
--- a/engines/tsage/blue_force/blueforce_scenes0.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes0.cpp
@@ -21,6 +21,7 @@
*/
#include "tsage/blue_force/blueforce_scenes0.h"
+#include "tsage/blue_force/blueforce_dialogs.h"
#include "tsage/scenes.h"
#include "tsage/tsage.h"
#include "tsage/staticres.h"
@@ -191,6 +192,7 @@ void Scene20::postInit(SceneObjectList *OwnerList) {
_object8.changeZoom(100);
setAction(&_action1);
+ BF_GLOBALS._dialogCenter.y = 165;
}
/*--------------------------------------------------------------------------
@@ -263,34 +265,36 @@ void Scene50::Tooltip::highlight(bool btnDown) {
update();
if (btnDown) {
- if ((BF_GLOBALS._bikiniHutState == 14) && BF_GLOBALS.getFlag(98))
+ if ((BF_GLOBALS._bookmark == bCalledToDrunkStop) && BF_GLOBALS.getFlag(beenToJRDay2))
scene->_sceneNumber = 600;
- else if (BF_GLOBALS._bikiniHutState == 5)
+ else if (BF_GLOBALS._bookmark == bBookedGreen)
scene->_sceneNumber = 410;
else {
- BF_GLOBALS._v4CEF4 = _newSceneNumber;
+ BF_GLOBALS._driveToScene = _newSceneNumber;
- switch (BF_GLOBALS._v4CEF2) {
+ switch (BF_GLOBALS._driveFromScene) {
case 330:
case 340:
case 342:
BF_GLOBALS._player.disableControl();
- if (_locationId != BF_GLOBALS._mapLocationId) {
+ BF_GLOBALS._mapLocationId = _locationId;
+
+ if (BF_GLOBALS._driveToScene != 330) {
scene->_sceneNumber = 330;
} else {
- scene->_sceneNumber = (BF_GLOBALS._v4CEA2 != 1) || (BF_GLOBALS._bikiniHutState < 1) ||
- (BF_GLOBALS._bikiniHutState >= 2) ? 342 : 340;
+ scene->_sceneNumber = (BF_GLOBALS._dayNumber != 1) || (BF_GLOBALS._bookmark < bStartOfGame) ||
+ (BF_GLOBALS._bookmark >= bCalledToDomesticViolence) ? 342 : 340;
}
break;
case 410:
case 551:
- if (BF_GLOBALS.getFlag((BF_GLOBALS._v4CEF2 == 410) ? 41 : 40)) {
+ if (BF_GLOBALS.getFlag((BF_GLOBALS._driveFromScene == 410) ? fSearchedTruck : didDrunk)) {
BF_GLOBALS._mapLocationId = _locationId;
BF_GLOBALS._player.disableControl();
scene->_sceneNumber = _newSceneNumber;
} else {
- BF_GLOBALS._v4CEA8 = 4;
+ BF_GLOBALS._deathReason = 4;
BF_GLOBALS._sceneManager.changeScene(666);
return;
}
@@ -298,7 +302,7 @@ void Scene50::Tooltip::highlight(bool btnDown) {
case 300:
if (_locationId == 1) {
- BF_GLOBALS._v4CEF4 = 300;
+ BF_GLOBALS._driveToScene = 300;
_newSceneNumber = 300;
}
// Deliberate fall through to default
@@ -308,11 +312,11 @@ void Scene50::Tooltip::highlight(bool btnDown) {
scene->_sceneNumber = _newSceneNumber;
break;
}
-
- // Signal the scene to change to the new scene
- scene->_sceneMode = 1;
- scene->signal();
}
+
+ // Signal the scene to change to the new scene
+ scene->_sceneMode = 1;
+ scene->signal();
}
}
@@ -327,13 +331,13 @@ void Scene50::postInit(SceneObjectList *OwnerList) {
SceneExt::postInit();
BF_GLOBALS._interfaceY = 200;
+ BF_GLOBALS._uiElements._active = false;
BF_GLOBALS._player.postInit();
BF_GLOBALS._player.setVisage(830);
BF_GLOBALS._player.setStrip(3);
BF_GLOBALS._player.setPosition(Common::Point(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2));
BF_GLOBALS._player.hide();
- BF_GLOBALS._player.enableControl();
- BF_GLOBALS._player._uiEnabled = false;
+ BF_GLOBALS._player.disableControl();
BF_GLOBALS._scrollFollower = NULL;
_text._color1 = 19;
@@ -353,8 +357,8 @@ void Scene50::postInit(SceneObjectList *OwnerList) {
_location6.set(Rect(242, 131, 264, 144), 440, ALLEY_CAT, 64);
_location5.set(Rect(383, 57, 402, 70), 380, CITY_HALL_JAIL, 32);
_location7.set(Rect(128, 32, 143, 42), 800, JAMISON_RYAN, 128);
- _location9.set(Rect(349, 125, 359, 132),
- (BF_GLOBALS._bikiniHutState == 13) || (BF_GLOBALS._bikiniHutState == 14) ? 551 : 550,
+ _location9.set(Rect(349, 125, 359, 132),
+ (BF_GLOBALS._bookmark == bInspectionDone) || (BF_GLOBALS._bookmark == bCalledToDrunkStop) ? 551 : 550,
BIKINI_HUT, 16);
_item.setBounds(Rect(0, 0, SCREEN_WIDTH * 2, SCREEN_HEIGHT));
@@ -415,43 +419,43 @@ void Scene50::postInit(SceneObjectList *OwnerList) {
void Scene50::remove() {
// Blank out the screen
- BF_GLOBALS._screenSurface.fillRect(BF_GLOBALS._screenSurface.getBounds(), 0);
+ clearScreen();
SceneExt::remove();
- BF_GLOBALS._v4E238 = 1;
+ BF_GLOBALS._uiElements._active = true;
}
void Scene50::signal() {
if (_sceneMode == 1) {
// Destination selected
- if ((BF_GLOBALS._v4CEF2 == 551) && (_sceneNumber != BF_GLOBALS._v4CEF2)) {
- BF_GLOBALS.setFlag(109);
- BF_GLOBALS.setFlag(115);
- BF_GLOBALS.setFlag(121);
- BF_GLOBALS.setFlag(127);
- BF_GLOBALS.setFlag(133);
+ if ((BF_GLOBALS._driveFromScene == 551) && (_sceneNumber != BF_GLOBALS._driveFromScene)) {
+ BF_GLOBALS.clearFlag(f1015Drunk);
+ BF_GLOBALS.clearFlag(f1027Drunk);
+ BF_GLOBALS.clearFlag(f1035Drunk);
+ BF_GLOBALS.clearFlag(f1097Drunk);
+ BF_GLOBALS.clearFlag(f1098Drunk);
}
- if ((BF_GLOBALS._v4CEF2 == 410) && (_sceneNumber != BF_GLOBALS._v4CEF2)) {
+ if ((BF_GLOBALS._driveFromScene == 410) && (_sceneNumber != BF_GLOBALS._driveFromScene)) {
BF_GLOBALS.setFlag(125);
}
- if ((BF_GLOBALS._v4CEF2 == 340) && (_sceneNumber != BF_GLOBALS._v4CEF2)) {
+ if ((BF_GLOBALS._driveFromScene == 340) && (_sceneNumber != BF_GLOBALS._driveFromScene)) {
BF_GLOBALS.setFlag(123);
}
- if ((BF_GLOBALS._v4CEF2 == 380) && (_sceneNumber != BF_GLOBALS._v4CEF2)) {
- if (BF_GLOBALS._bikiniHutState >= 4)
- BF_GLOBALS.setFlag(129);
- if (BF_GLOBALS._bikiniHutState >= 6)
- BF_GLOBALS.setFlag(131);
- if (BF_GLOBALS._bikiniHutState == 3) {
- BF_GLOBALS._v4CEA8 = 19;
+ if ((BF_GLOBALS._driveFromScene == 380) && (_sceneNumber != BF_GLOBALS._driveFromScene)) {
+ if (BF_GLOBALS._bookmark >= bLauraToParamedics)
+ BF_GLOBALS.setFlag(f1098Marina);
+ if (BF_GLOBALS._bookmark >= bStoppedFrankie)
+ BF_GLOBALS.setFlag(f1098Frankie);
+ if (BF_GLOBALS._bookmark == bArrestedGreen) {
+ BF_GLOBALS._deathReason = 19;
_sceneNumber = 666;
}
}
- if ((_sceneNumber == 551) && BF_GLOBALS.getFlag(147))
+ if ((_sceneNumber == 551) && BF_GLOBALS.getFlag(fHasDrivenFromDrunk))
_sceneNumber = 550;
BF_GLOBALS._sound1.fadeOut2(NULL);
@@ -461,6 +465,7 @@ void Scene50::signal() {
// Initial delay complete, time to switch to interactive mode
_text.remove();
BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._events.setCursor(CURSOR_WALK);
_sceneMode = 0;
_field380 = 0;
}
@@ -496,6 +501,634 @@ void Scene50::process(Event &event) {
}
}
+/*--------------------------------------------------------------------------
+ * Scene 60 - Motorcycle
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene60::Ignition::startAction(CursorType action, Event &event) {
+ Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene;
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(60, 15);
+ break;
+ default:
+ switch (BF_GLOBALS._dayNumber) {
+ case 1:
+ if (BF_GLOBALS.getFlag(onDuty) && check1())
+ return true;
+ break;
+ case 2:
+ if (BF_GLOBALS.getFlag(onDuty) && check2())
+ return true;
+ }
+
+ BF_GLOBALS._sound1.play(BF_GLOBALS.getFlag(fWithLyle) ? 80 : 31);
+ BF_GLOBALS._sound1.holdAt(1);
+ scene->fadeOut();
+ BF_GLOBALS._sceneManager.changeScene(50);
+ break;
+ }
+
+ return true;
+}
+
+bool Scene60::Ignition::check1() {
+ if (BF_GLOBALS._bookmark >= bStoppedFrankie) {
+ BF_GLOBALS._v5098C |= 1;
+ return false;
+ } else {
+ if ((BF_GLOBALS._bookmark == bBookedGreen) && BF_GLOBALS.getFlag(fArrivedAtGangStop)) {
+ BF_GLOBALS.set2Flags(f1035Frankie);
+ BF_GLOBALS._sceneManager.changeScene(410);
+ }
+
+ if (BF_GLOBALS._bookmark >= bLauraToParamedics) {
+ if (BF_GLOBALS.getFlag(fLeftTraceIn910)) {
+ if (BF_GLOBALS._bookmark < bBookedGreen) {
+ BF_GLOBALS._bookmark = bBookedGreen;
+ BF_GLOBALS.clearFlag(fCalledBackup);
+ BF_GLOBALS.set2Flags(f1035Frankie);
+ return false;
+ } else if (BF_GLOBALS._bookmark == bBookedGreen) {
+ if (!BF_GLOBALS.getFlag(fCalledBackup))
+ BF_GLOBALS.setFlag(f1035Frankie);
+
+ BF_GLOBALS._sceneManager.changeScene(410);
+ return true;
+ }
+ }
+
+ } else if (BF_GLOBALS._bookmark < bStartOfGame) {
+ // Should never reach here
+ } else if (BF_GLOBALS._bookmark < bCalledToDomesticViolence) {
+ if ((BF_GLOBALS._v5098C >> 1) & 1)
+ BF_GLOBALS.setFlag(fLateToMarina);
+ else
+ BF_GLOBALS._v5098C |= 2;
+ } else {
+ int v = (((BF_GLOBALS._v5098C >> 2) & 15) + 1) & 15;
+ BF_GLOBALS._v5098C = (BF_GLOBALS._v5098C & 0xC3) | (v << 2);
+
+ if ((v != 1) && (v != 2)) {
+ BF_GLOBALS._deathReason = 19;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ return true;
+ }
+ }
+ }
+
+ BF_GLOBALS._v5098C |= 1;
+ return false;
+}
+
+bool Scene60::Ignition::check2() {
+ switch (BF_GLOBALS._bookmark) {
+ case bInspectionDone:
+ if (BF_GLOBALS._v5098D & 1) {
+ BF_GLOBALS.setFlag(fLateToDrunkStop);
+ } else {
+ BF_GLOBALS._v5098D |= 1;
+ }
+ break;
+ case bCalledToDrunkStop:
+ BF_GLOBALS.setFlag(fHasDrivenFromDrunk);
+ break;
+ default:
+ break;
+ }
+
+ BF_GLOBALS._v5098C |= 0x80;
+ return false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene60::Item3::startAction(CursorType action, Event &event) {
+ Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene;
+ scene->fadeOut();
+ BF_GLOBALS._sceneManager.changeScene(scene->_newScene);
+ return true;
+}
+
+bool Scene60::Radio::startAction(CursorType action, Event &event) {
+ Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene;
+
+ switch(action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(60, 0);
+ break;
+ case CURSOR_USE:
+ case CURSOR_TALK:
+ scene->_sound.play(32);
+ scene->setAction(&scene->_action1);
+ break;
+ default:
+ SceneItem::display2(60, 1);
+ break;
+ }
+ return true;
+}
+
+bool Scene60::Compartment::startAction(CursorType action, Event &event) {
+ Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene;
+
+ switch(action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(60, 8);
+ break;
+ case CURSOR_USE:
+ if ((BF_INVENTORY.getObjectScene(INV_TICKET_BOOK) == 1) &&
+ (BF_INVENTORY.getObjectScene(INV_MIRANDA_CARD) == 1)) {
+ SceneItem::display2(60, 9);
+ }
+ break;
+ case CURSOR_TALK:
+ SceneItem::display2(60, 10);
+ break;
+ case INV_TICKET_BOOK:
+ SceneItem::display2(60, 11);
+ scene->_ticketBook.show();
+ BF_INVENTORY.setObjectScene(INV_TICKET_BOOK, 60);
+ BF_GLOBALS._events.setCursor(CURSOR_USE);
+ BF_GLOBALS._sceneItems.addBefore(&scene->_radio, &scene->_ticketBook);
+ break;
+ case INV_MIRANDA_CARD:
+ SceneItem::display2(60, 12);
+ scene->_mirandaCard.show();
+ BF_INVENTORY.setObjectScene(INV_MIRANDA_CARD, 60);
+ BF_GLOBALS._events.setCursor(CURSOR_USE);
+ BF_GLOBALS._sceneItems.addAfter(&scene->_compartmentDoor, &scene->_mirandaCard);
+ break;
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene60::MirandaCard::startAction(CursorType action, Event &event) {
+ Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(60, 5);
+ return true;
+ case CURSOR_USE:
+ if (BF_INVENTORY.getObjectScene(INV_MIRANDA_CARD) == 60) {
+ SceneItem::display2(60, 6);
+ BF_INVENTORY.setObjectScene(INV_MIRANDA_CARD, 1);
+ if (!BF_GLOBALS.getFlag(fGotPointsForTktBook)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ BF_GLOBALS.setFlag(fGotPointsForTktBook);
+ }
+
+ scene->_mirandaCard.hide();
+ BF_GLOBALS._sceneItems.remove(&scene->_mirandaCard);
+ }
+ return true;
+ case CURSOR_TALK:
+ SceneItem::display2(60, 7);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ break;
+ }
+}
+
+bool Scene60::TicketBook::startAction(CursorType action, Event &event) {
+ Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(60, 2);
+ return true;
+ case CURSOR_USE:
+ if (BF_INVENTORY.getObjectScene(INV_TICKET_BOOK) == 60) {
+ scene->_ticketBook.hide();
+ BF_GLOBALS._sceneItems.remove(&scene->_ticketBook);
+ SceneItem::display2(60, 3);
+ BF_INVENTORY.setObjectScene(INV_TICKET_BOOK, 1);
+ if (!BF_GLOBALS.getFlag(fShotNicoIn910)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ BF_GLOBALS.setFlag(fShotNicoIn910);
+ }
+ }
+ return true;
+ case CURSOR_TALK:
+ SceneItem::display2(60, 4);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ break;
+ }
+}
+
+bool Scene60::CompartmentDoor::startAction(CursorType action, Event &event) {
+ Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(60, 13);
+ return true;
+ case CURSOR_USE:
+ if (_flag) {
+ _flag = false;
+ BF_GLOBALS._player.disableControl();
+ Common::Point pt(308, 165);
+ NpcMover *mover = new NpcMover();
+ addMover(mover, &pt, scene);
+ } else {
+ _flag = true;
+ BF_GLOBALS._player.disableControl();
+ Common::Point pt(288, 165);
+ NpcMover *mover = new NpcMover();
+ addMover(mover, &pt, scene);
+ }
+ return true;
+ case CURSOR_TALK:
+ SceneItem::display2(60, 14);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene60::Action1::signal() {
+ Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(2);
+ break;
+ case 1:
+ scene->_stripManager.start(634, this);
+ break;
+ case 2:
+ _state = useRadio();
+ setDelay(4);
+ break;
+ case 3:
+ switch (_state) {
+ case 1:
+ if (BF_GLOBALS.removeFlag(fCan1004Marina)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _state = 606;
+ } else if (BF_GLOBALS.removeFlag(fCan1004Drunk)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _state = 606;
+ } else {
+ _state = 611;
+ }
+ break;
+ case 2:
+ _state = 612;
+ break;
+ case 3:
+ if (BF_GLOBALS.removeFlag(f1015Marina)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _state = 613;
+ } else if (BF_GLOBALS.removeFlag(f1015Frankie)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _state = 614;
+ } else if (BF_GLOBALS.removeFlag(f1015Drunk)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _state = 615;
+ } else {
+ _state = 616;
+ }
+ break;
+ case 4:
+ if (BF_GLOBALS.removeFlag(f1027Marina)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _actionIndex = 5;
+ _state = 617;
+ } else if (BF_GLOBALS.removeFlag(f1027Frankie)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _actionIndex = 5;
+ _state = 618;
+ } else if (BF_GLOBALS.removeFlag(f1015Drunk)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _actionIndex = 5;
+ _state = 619;
+ } else {
+ _state = 620;
+ }
+ break;
+ case 5:
+ if (BF_GLOBALS.removeFlag(f1035Marina)) {
+ BF_GLOBALS.setFlag(fCalledBackup);
+ BF_GLOBALS._uiElements.addScore(50);
+ _state = 621;
+ } else if (BF_GLOBALS.removeFlag(f1035Frankie)) {
+ BF_GLOBALS.setFlag(fCalledBackup);
+ BF_GLOBALS._uiElements.addScore(50);
+ _actionIndex = 5;
+ _state = 622;
+ } else if (BF_GLOBALS.removeFlag(f1035Drunk)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _state = 623;
+ } else {
+ _state = 624;
+ }
+ break;
+ case 6:
+ if (BF_GLOBALS.removeFlag(f1097Marina)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _state = 625;
+ } else if (BF_GLOBALS.removeFlag(f1097Frankie)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _actionIndex = 5;
+ _state = 626;
+ } else if (BF_GLOBALS.removeFlag(f1097Drunk)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _state = 627;
+ } else {
+ _state = 628;
+ }
+ break;
+ case 7:
+ if (BF_GLOBALS.removeFlag(f1098Marina)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _state = 629;
+ } else if (BF_GLOBALS.removeFlag(f1098Frankie)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _state = 630;
+ } else if (BF_GLOBALS.removeFlag(f1098Drunk)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ _state = 631;
+ } else {
+ _state = 632;
+ }
+ break;
+ case 0:
+ default:
+ _state = 610;
+ break;
+ }
+
+ scene->_stripManager.start(_state, this);
+ break;
+ case 4:
+ remove();
+ case 5:
+ setDelay(120);
+ break;
+ case 6:
+ _actionIndex = 4;
+ scene->_stripManager.start(633, this);
+ break;
+ }
+}
+
+int Scene60::Action1::useRadio() {
+ return RadioConvDialog::show();
+}
+
+void Scene60::Action2::signal() {
+ Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ scene->_sound.play(32);
+ setDelay(2);
+ break;
+ case 1:
+ BF_GLOBALS._bookmark = bStartOfGame;
+ BF_GLOBALS.set2Flags(f1035Marina);
+ scene->_stripManager.start(60, this);
+ break;
+ case 2:
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ }
+}
+
+void Scene60::Action3::signal() {
+ Scene60 *scene = (Scene60 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ scene->_sound.play(32);
+ setDelay(2);
+ break;
+ case 1:
+ BF_GLOBALS._bookmark = bInspectionDone;
+ BF_GLOBALS.set2Flags(f1035Drunk);
+ BF_GLOBALS.setFlag(fCan1004Drunk);
+ scene->_stripManager.start(71, this);
+ break;
+ case 2:
+ scene->_field1222 = true;
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene60::Scene60(): SceneExt() {
+ _newScene = 0;
+ _sceneNumber = 0;
+ _visage = 0;
+ _cursorId = CURSOR_NONE;
+ _field1222 = false;
+}
+
+void Scene60::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_newScene);
+ s.syncAsSint16LE(_sceneNumber);
+ s.syncAsSint16LE(_visage);
+ s.syncAsSint16LE(_cursorId);
+ s.syncAsSint16LE(_field1222);
+}
+
+void Scene60::postInit(SceneObjectList *OwnerList) {
+ _newScene = BF_GLOBALS._driveFromScene = BF_GLOBALS._sceneManager._previousScene;
+
+ // Set up which scene background to use
+ switch (_newScene) {
+ case 300:
+ _sceneNumber = 1301;
+ break;
+ case 380:
+ _sceneNumber = 1380;
+ break;
+ case 410:
+ _sceneNumber = 1410;
+ break;
+ case 551:
+ _sceneNumber = 1550;
+ break;
+ case 550:
+ _sceneNumber = 1555;
+ break;
+ case 580:
+ _sceneNumber = 1580;
+ break;
+ case 800:
+ _sceneNumber = 1810;
+ break;
+ default:
+ _sceneNumber = 60;
+ break;
+ }
+
+ if (_sceneNumber == 1550) {
+ if (BF_GLOBALS.getFlag(fHasDrivenFromDrunk))
+ _sceneNumber = 1555;
+ else {
+ _object1.postInit();
+ _object1.setVisage(1550);
+ _object1.animate(ANIM_MODE_2);
+ _object1.setPosition(Common::Point(158, 18));
+ }
+ }
+
+ loadScene(_sceneNumber);
+
+ if ((_sceneNumber == 1810) && (BF_GLOBALS._dayNumber > 1) &&
+ (BF_GLOBALS._dayNumber < 5) && !BF_GLOBALS.getFlag(fWithLyle) &&
+ ((BF_GLOBALS._dayNumber != 4) && (BF_GLOBALS._bookmark >= bEndDayThree))) {
+ _car.setup(1810, 1, 1, 164, 131, 1);
+ }
+
+ if ((_sceneNumber == 1410) && (BF_GLOBALS._bookmark == bBookedGreen) &&
+ !BF_GLOBALS.getFlag(fDriverOutOfTruck)) {
+ _object1.postInit();
+ _object1.setVisage(410);
+ _object1.setStrip(6);
+ _object1.setPosition(Common::Point(135, 47));
+ }
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _visage = 62;
+ _ignition._sceneRegionId = 22;
+ } else if (BF_GLOBALS.getFlag(onDuty)) {
+ _visage = 63;
+ _ignition._sceneRegionId = 20;
+ } else {
+ _visage = 61;
+ _ignition._sceneRegionId = 28;
+ }
+ _dashboard.setup(_visage, 1, 1, 160, 168, 100);
+ _cursorId = CURSOR_USE;
+
+ if (_visage == 63) {
+ _compartmentDoor.postInit();
+ _compartmentDoor.setVisage(60);
+ _compartmentDoor.setStrip(1);
+ _compartmentDoor.setFrame(1);
+ _compartmentDoor.setPosition(Common::Point(288, 165));
+ _compartmentDoor.setPriority(250);
+ _compartmentDoor._flag = true;
+ BF_GLOBALS._sceneItems.push_back(&_compartmentDoor);
+
+ _mirandaCard.postInit();
+ _mirandaCard.setVisage(60);
+ _mirandaCard.setStrip(2);
+ _mirandaCard.setFrame(2);
+ _mirandaCard.setPosition(Common::Point(280, 160));
+
+ if (BF_INVENTORY.getObjectScene(INV_MIRANDA_CARD) == 60) {
+ _mirandaCard.show();
+ BF_GLOBALS._sceneItems.push_back(&_mirandaCard);
+ } else {
+ _mirandaCard.hide();
+ }
+
+ _ticketBook.postInit();
+ _ticketBook.setVisage(60);
+ _ticketBook.setStrip(2);
+ _ticketBook.setFrame(1);
+ _ticketBook.setPosition(Common::Point(289, 161));
+
+ if (BF_INVENTORY.getObjectScene(INV_TICKET_BOOK) == 60) {
+ _ticketBook.show();
+ BF_GLOBALS._sceneItems.push_back(&_ticketBook);
+ } else {
+ _ticketBook.hide();
+ }
+ }
+
+ _item3._sceneRegionId = 7;
+ _radio._sceneRegionId = 12;
+ _compartment._sceneRegionId = 14;
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeRadioSpeaker);
+
+ if (BF_GLOBALS.getFlag(onDuty) && !BF_GLOBALS.getFlag(fWithLyle)) {
+ BF_GLOBALS._sceneItems.push_back(&_radio);
+ BF_GLOBALS._sceneItems.push_back(&_compartment);
+ }
+
+ BF_GLOBALS._sceneItems.push_back(&_ignition);
+ BF_GLOBALS._sceneItems.push_back(&_item3);
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._events.setCursor(CURSOR_USE);
+
+ switch (BF_GLOBALS._dayNumber) {
+ case 1:
+ if (BF_GLOBALS.getFlag(onDuty) && (BF_GLOBALS._v5098C & 1) &&
+ (BF_GLOBALS._bookmark < bStartOfGame) && (BF_GLOBALS._sceneManager._previousScene != 342)) {
+ setAction(&_action2);
+ if (BF_GLOBALS._sceneManager._previousScene == 342)
+ _newScene = 340;
+ }
+ break;
+ case 2:
+ if (BF_GLOBALS.getFlag(onDuty) && ((BF_GLOBALS._v5098C >> 7) & 1) &&
+ (BF_GLOBALS._sceneManager._previousScene != 550) &&
+ (BF_GLOBALS._bookmark < bInspectionDone)) {
+ setAction(&_action3);
+ }
+ }
+}
+
+void Scene60::remove() {
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._events.setCursor(_cursorId);
+
+ if (_cursorId == CURSOR_EXIT)
+ BF_GLOBALS._events.setCursor(CURSOR_USE);
+}
+
+void Scene60::signal() {
+ ++_sceneMode;
+ BF_GLOBALS._player.enableControl();
+}
+
+void Scene60::dispatch() {
+ SceneExt::dispatch();
+
+ int idx = BF_GLOBALS._sceneRegions.indexOf(Common::Point(
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.left + BF_GLOBALS._events._mousePos.x,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + BF_GLOBALS._events._mousePos.y));
+
+ if (idx == _item3._sceneRegionId) {
+ if (BF_GLOBALS._events.getCursor() != CURSOR_EXIT) {
+ _cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(CURSOR_EXIT);
+ }
+ } else {
+ if (BF_GLOBALS._events.getCursor() == CURSOR_EXIT) {
+ BF_GLOBALS._events.setCursor(_cursorId);
+ }
+ }
+}
+
} // End of namespace BlueForce
} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_scenes0.h b/engines/tsage/blue_force/blueforce_scenes0.h
index 5c98184ed8..103e5f0a4c 100644
--- a/engines/tsage/blue_force/blueforce_scenes0.h
+++ b/engines/tsage/blue_force/blueforce_scenes0.h
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
#include "tsage/blue_force/blueforce_logic.h"
+#include "tsage/blue_force/blueforce_speakers.h"
#include "tsage/converse.h"
#include "tsage/events.h"
#include "tsage/core.h"
@@ -90,12 +91,98 @@ public:
public:
Scene50();
virtual Common::String getClassName() { return "Scene50"; }
- virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void remove();
virtual void signal();
virtual void process(Event &event);
};
+class Scene60 : public SceneExt {
+ /* Items */
+ class Ignition: public NamedHotspot {
+ private:
+ bool check1();
+ bool check2();
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item3: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Radio: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Compartment: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Objects */
+ class MirandaCard: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class TicketBook: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class CompartmentDoor: public NamedObject {
+ public:
+ bool _flag;
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Actions */
+ class Action1: public ActionExt {
+ private:
+ int useRadio();
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action3: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ Action1 _action1;
+ Action2 _action2;
+ Action3 _action3;
+ NamedObject _object1;
+ MirandaCard _mirandaCard;
+ TicketBook _ticketBook;
+ CompartmentDoor _compartmentDoor;
+ SceneObject _dashboard;
+ BackgroundSceneObject _car;
+ NamedHotspot _item1;
+ Ignition _ignition;
+ Item3 _item3;
+ Radio _radio;
+ Compartment _compartment;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeRadio _jakeRadioSpeaker;
+ ASound _sound;
+ int _newScene;
+ int _sceneNumber;
+ int _visage;
+ CursorType _cursorId;
+ bool _field1222;
+
+ Scene60();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void dispatch();
+};
+
+
} // End of namespace BlueForce
} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_scenes1.cpp b/engines/tsage/blue_force/blueforce_scenes1.cpp
index 650b63c24b..c953584665 100644
--- a/engines/tsage/blue_force/blueforce_scenes1.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes1.cpp
@@ -42,7 +42,7 @@ void Scene100::Text::dispatch() {
// Keep the second text string below the first one
Scene100 *scene = (Scene100 *)BF_GLOBALS._sceneManager._scene;
Common::Point &pt = scene->_action1._sceneText1._position;
- scene->_action1._sceneText2.setPosition(Common::Point(pt.x,
+ scene->_action1._sceneText2.setPosition(Common::Point(pt.x,
pt.y + scene->_action1._textHeight));
}
@@ -56,14 +56,14 @@ void Scene100::Action1::signal() {
setDelay(6);
break;
case 1: {
- Common::String msg1 = _resourceManager->getMessage(100, _state++);
+ Common::String msg1 = g_resourceManager->getMessage(100, _state++);
if (msg1.compareTo("LASTCREDIT")) {
- Common::String msg2 = _resourceManager->getMessage(100, _state++);
+ Common::String msg2 = g_resourceManager->getMessage(100, _state++);
setTextStrings(msg1, msg2, this);
--_actionIndex;
} else {
setTextStrings(BF_NAME, BF_ALL_RIGHTS_RESERVED, this);
-
+
Common::Point pt(_sceneText1._position.x, 80);
NpcMover *mover = new NpcMover();
_sceneText1.addMover(mover, &pt, this);
@@ -111,17 +111,17 @@ void Scene100::Action1::setTextStrings(const Common::String &msg1, const Common:
_sceneText2.setPosition(Common::Point((SCREEN_WIDTH - textSurface.getBounds().width()) / 2, 202));
_sceneText2._moveRate = 30;
_sceneText2._moveDiff.y = 1;
-
+
_textHeight = textSurface.getBounds().height();
int yp = -(_textHeight * 2);
- Common::Point pt(_sceneText1._position.x, yp);
+ Common::Point pt(_sceneText1._position.x, yp);
NpcMover *mover = new NpcMover();
- _sceneText1.addMover(mover, &pt, action);
+ _sceneText1.addMover(mover, &pt, action);
}
void Scene100::Action2::signal() {
- Scene100 *scene = (Scene100 *)_globals->_sceneManager._scene;
+ Scene100 *scene = (Scene100 *)g_globals->_sceneManager._scene;
static byte black[3] = {0, 0, 0};
switch (_actionIndex++) {
@@ -139,7 +139,7 @@ void Scene100::Action2::signal() {
ConfMan.flushToDisk();
} else {
// Prompt user for whether to start play or watch introduction
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
if (MessageDialog::show2(WATCH_INTRO_MSG, START_PLAY_BTN_STRING, INTRODUCTION_BTN_STRING) == 0) {
// Signal to start the game
@@ -150,7 +150,7 @@ void Scene100::Action2::signal() {
}
// At this point the introduction needs to start
- _globals->_scenePalette.addFader(black, 1, 2, this);
+ g_globals->_scenePalette.addFader(black, 1, 2, this);
break;
}
case 3:
@@ -166,24 +166,29 @@ Scene100::Scene100(): SceneExt() {
}
void Scene100::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ if (BF_GLOBALS._dayNumber < 6) {
+ // Title
+ loadScene(100);
+ } else {
+ // Credits
+ loadScene(101);
+ }
BF_GLOBALS._scenePalette.loadPalette(2);
BF_GLOBALS._v51C44 = 1;
- Scene::postInit();
BF_GLOBALS._interfaceY = SCREEN_HEIGHT;
- _globals->_player.enableControl();
- _globals->_player.hide();
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.hide();
+ g_globals->_player.disableControl();
_index = 109;
- if (BF_GLOBALS._v4CEA2 < 6) {
+ if (BF_GLOBALS._dayNumber < 6) {
// Title
- loadScene(100);
BF_GLOBALS._sound1.play(2);
setAction(&_action2, this);
} else {
// Credits
- loadScene(101);
BF_GLOBALS._sound1.play(118);
setAction(&_action1, this);
}
@@ -191,7 +196,7 @@ void Scene100::postInit(SceneObjectList *OwnerList) {
void Scene100::signal() {
++_sceneMode;
- if (BF_GLOBALS._v4CEA2 < 6) {
+ if (BF_GLOBALS._dayNumber < 6) {
BF_GLOBALS._scenePalette.clearListeners();
BF_GLOBALS._scenePalette.loadPalette(100);
BF_GLOBALS._sceneManager.changeScene(_index);
@@ -346,11 +351,11 @@ void Scene109::Text::dispatch() {
/*--------------------------------------------------------------------------*/
-Scene109::Scene109(): GameScene() {
+Scene109::Scene109(): PalettedScene() {
}
void Scene109::postInit(SceneObjectList *OwnerList) {
- GameScene::postInit(OwnerList);
+ PalettedScene::postInit(OwnerList);
loadScene(999);
_protaginist2.postInit();
@@ -427,6 +432,281 @@ void Scene109::signal() {
}
}
+/*--------------------------------------------------------------------------
+ * Scene 190 - Front of Police Station
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene190::Object4::startAction(CursorType action, Event &event) {
+ Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE: {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 13;
+ Common::Point pt(62, 96);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, scene);
+ return true;
+ }
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene190::Item1::startAction(CursorType action, Event &event) {
+ Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ scene->setAction(&scene->_action1);
+ return true;
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene190::Item2::startAction(CursorType action, Event &event) {
+ Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ scene->_stripManager.start(1900, scene);
+ return true;
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene190::Exit::startAction(CursorType action, Event &event) {
+ Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene;
+
+ Common::Point pt(316, 91);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, scene);
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene190::Action1::signal() {
+ Scene190 *scene = (Scene190 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ setDelay(2);
+ break;
+ case 1: {
+ ADD_MOVER(BF_GLOBALS._player, 165, 91);
+ break;
+ }
+ case 2:
+ scene->_sound.play(82);
+ scene->_object2.animate(ANIM_MODE_5, this);
+ break;
+ case 3:
+ ADD_MOVER(BF_GLOBALS._player, 180, 86);
+ break;
+ case 4:
+ scene->_sound.play(82);
+ scene->_object2.animate(ANIM_MODE_6, this);
+ break;
+ case 5:
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(315);
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene190::Scene190(): SceneExt() {
+ _fieldB52 = true;
+ _cursorVisage.setVisage(1, 8);
+}
+
+void Scene190::postInit(SceneObjectList *OwnerList) {
+ BF_GLOBALS._dialogCenter.y = 100;
+ if ((BF_GLOBALS._sceneManager._previousScene == 100) ||
+ (BF_GLOBALS._sceneManager._previousScene == 20)) {
+// clearScreen();
+ }
+ if (BF_GLOBALS._dayNumber == 0)
+ // If at start of game, change to first day
+ BF_GLOBALS._dayNumber = 1;
+
+ // Load the scene data
+ loadScene(190);
+ BF_GLOBALS._scenePalette.loadPalette(2);
+
+ _stripManager.addSpeaker(&_speaker);
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.disableControl();
+
+ // Initialise objects
+ _object2.postInit();
+ _object2.setVisage(190);
+ _object2.setStrip(1);
+ _object2.setPosition(Common::Point(179, 88));
+
+ _object3.postInit();
+ _object3.setVisage(190);
+ _object3.setStrip(2);
+ _object3.fixPriority(200);
+ _object3.setPosition(Common::Point(170, 31));
+ _object3.animate(ANIM_MODE_7, 0, NULL);
+ _object3.setDetails(190, 8, 26, 19, 1, NULL);
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ BF_GLOBALS._player.setVisage(303);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player._moveDiff = Common::Point(3, 1);
+
+ _object4.postInit();
+ _object4.setVisage(444);
+ _object4.setFrame(2);
+ _object4.setPosition(Common::Point(54, 114));
+ _object4.setDetails(190, -1, -1, -1, 1, NULL);
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 300: {
+ _sceneMode = 12;
+ BF_GLOBALS._player.setPosition(Common::Point(316, 91));
+ ADD_MOVER(BF_GLOBALS._player, 305, 91);
+ break;
+ }
+ case 315:
+ _sceneMode = 1901;
+ setAction(&_sequenceManager, this, 1901, &BF_GLOBALS._player, &_object2, NULL);
+ break;
+ case 50:
+ case 60:
+ default:
+ _fieldB52 = false;
+ BF_GLOBALS._player.setPosition(Common::Point(62, 96));
+ BF_GLOBALS._player._strip = 3;
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+ } else {
+ BF_GLOBALS._player.setVisage(BF_GLOBALS._player._visage);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 300: {
+ if (!BF_GLOBALS.getFlag(onBike)) {
+ BF_GLOBALS._player._moveDiff = Common::Point(3, 1);
+ _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 11 : 12;
+ BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 1304 : 303);
+ BF_GLOBALS._player.setPosition(Common::Point(316, 91));
+ ADD_MOVER(BF_GLOBALS._player, 305, 91);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 193 : 191;
+ setAction(&_sequenceManager, this, 193, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ }
+ case 315:
+ BF_GLOBALS._player._moveDiff = Common::Point(3, 1);
+ _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 1900 : 1901;
+ setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, &_object2, NULL);
+ break;
+ case 50:
+ case 60:
+ default:
+ BF_GLOBALS.setFlag(onBike);
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 192 : 190;
+ setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, NULL);
+ break;
+ }
+ }
+
+ if (BF_GLOBALS.getFlag(onBike)) {
+ BF_GLOBALS._sound1.play(BF_GLOBALS.getFlag(onDuty) ? 37 : 29);
+ } else if (BF_GLOBALS._sceneManager._previousScene != 300) {
+ BF_GLOBALS._sound1.play(33);
+ }
+
+ _exit.setDetails(Rect(310, 50, 320, 125), 190, -1, -1, -1, 1, NULL);
+ _item2.setDetails(Rect(108, 1, 111, 94), 190, 7, 11, 18, 1, NULL);
+ _item4.setDetails(2, 190, 5, 10, 16, 1);
+ _item3.setDetails(1, 190, 4, 10, 15, 1);
+ _item8.setDetails(6, 190, 20, 21, 22, 1);
+ _item1.setDetails(7, 190, 1, 10, -1, 1);
+ _item7.setDetails(5, 190, 0, 10, 12, 1);
+ _item6.setDetails(4, 190, 2, 10, 13, 1);
+ _item5.setDetails(3, 190, 3, 10, 14, 1);
+ _item9.setDetails(Rect(0, 0, 89, 68), 190, 6, 10, 17, 1, NULL);
+ _item10.setDetails(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y), 190, 23, -1, -1, 1, NULL);
+}
+
+void Scene190::signal() {
+ switch (_sceneMode) {
+ case 10:
+ if ((BF_GLOBALS._dayNumber == 2) && (BF_GLOBALS._bookmark < bEndDayOne))
+ BF_GLOBALS._sound1.changeSound(49);
+ BF_GLOBALS._sceneManager.changeScene(300);
+ break;
+ case 11:
+ case 12:
+ case 1900:
+ case 1901:
+ BF_GLOBALS._player.enableControl();
+ _fieldB52 = false;
+ break;
+ case 13:
+ case 191:
+ case 193:
+ BF_GLOBALS._sceneManager.changeScene(60);
+ break;
+ case 190:
+ case 192:
+ BF_GLOBALS._sceneManager.changeScene(300);
+ break;
+ case 0:
+ default:
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene190::process(Event &event) {
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ // Check if the cursor is on an exit
+ if (_exit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(3);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+}
+
+void Scene190::dispatch() {
+ SceneExt::dispatch();
+
+ if (!_action && !_fieldB52 && (BF_GLOBALS._player._position.x >= 310)
+ && !BF_GLOBALS.getFlag(onBike)) {
+ // Handle walking off to the right side of the screen
+ BF_GLOBALS._player.disableControl();
+ _fieldB52 = true;
+ _sceneMode = 10;
+
+ ADD_MOVER(BF_GLOBALS._player, 330, BF_GLOBALS._player._position.y);
+ }
+}
+
} // End of namespace BlueForce
} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_scenes1.h b/engines/tsage/blue_force/blueforce_scenes1.h
index 2b07e2b48f..3fd38e35ca 100644
--- a/engines/tsage/blue_force/blueforce_scenes1.h
+++ b/engines/tsage/blue_force/blueforce_scenes1.h
@@ -79,7 +79,7 @@ public:
virtual void signal();
};
-class Scene109: public GameScene {
+class Scene109: public PalettedScene {
/* Actions */
class Action1: public Action {
public:
@@ -124,6 +124,58 @@ public:
virtual void signal();
};
+class Scene190: public SceneExt {
+ /* Objects */
+ class Object4: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Item1: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item2: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Exit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Actions */
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ FollowerObject _object1;
+ NamedObject _object2, _object3;
+ Object4 _object4;
+ Item1 _item1;
+ Item2 _item2;
+ NamedHotspot _item3, _item4, _item5, _item6;
+ NamedHotspot _item7, _item8, _item9, _item10;
+ Exit _exit;
+ Action1 _action1;
+ ASoundExt _sound;
+ SpeakerGameText _speaker;
+ bool _fieldB52;
+
+ Scene190();
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+ virtual void synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_fieldB52);
+ }
+};
+
} // End of namespace BlueForce
} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_scenes2.cpp b/engines/tsage/blue_force/blueforce_scenes2.cpp
new file mode 100644
index 0000000000..7d66c7a52b
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_scenes2.cpp
@@ -0,0 +1,1720 @@
+/* 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 "tsage/blue_force/blueforce_scenes2.h"
+#include "tsage/scenes.h"
+#include "tsage/tsage.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+/*--------------------------------------------------------------------------
+ * Scene 200 - Credits - Motorcycle Training
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene200::Action1::signal() {
+ Scene200 *scene = (Scene200 *)BF_GLOBALS._sceneManager._scene;
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ assert(owner);
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(1);
+ break;
+ case 1:
+ BF_GLOBALS._scenePalette.loadPalette(235);
+ BF_GLOBALS._scenePalette.refresh();
+ _state = 0;
+ setDelay(30);
+ break;
+ case 2:
+ assert(_owner);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 3:
+ if (++_state < 2) {
+ scene->_action2.signal();
+ owner->setFrame(1);
+ _actionIndex = 2;
+ }
+ setDelay(2);
+ break;
+ case 4: {
+ PaletteRotation *rot;
+ rot = BF_GLOBALS._scenePalette.addRotation(64, 79, 1);
+ rot->setDelay(10);
+ rot = BF_GLOBALS._scenePalette.addRotation(96, 111, 1);
+ rot->setDelay(10);
+
+ scene->setAction(&scene->_sequenceManager, this, 201, &scene->_object1, &scene->_object2,
+ &scene->_object3, &scene->_object4, &scene->_object5, &scene->_object6, NULL);
+ break;
+ }
+ case 5:
+ BF_GLOBALS._sceneManager.changeScene(210);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene200::Action2::signal() {
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+ assert(owner);
+
+ switch (_actionIndex++) {
+ case 1:
+ owner->setPosition(owner->_position);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 2:
+ owner->setPosition(owner->_position);
+ owner->setFrame(1);
+ break;
+ default:
+ break;
+ }
+}
+
+
+/*--------------------------------------------------------------------------*/
+
+void Scene200::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(200);
+ setZoomPercents(0, 100, 200, 100);
+ BF_GLOBALS._sound1.play(3);
+
+ _object10.postInit();
+ _object10.setVisage(200);
+ _object10.setPosition(Common::Point(114, 102));
+ _object10.setStrip(2);
+ _object10.setFrame(1);
+ _object10.changeZoom(100);
+
+ _object1.postInit();
+ _object1.hide();
+ _object2.postInit();
+ _object2.hide();
+ _object3.postInit();
+ _object3.hide();
+ _object4.postInit();
+ _object4.hide();
+ _object5.postInit();
+ _object5.hide();
+ _object6.postInit();
+ _object6.hide();
+
+ _object11.postInit();
+ _object11.setVisage(200);
+ _object11.setPosition(Common::Point(96, 112), 1000);
+ _object11.setStrip(3);
+ _object11.setFrame(1);
+ _object11.changeZoom(100);
+
+ _object10.setAction(&_action1);
+ _object11.setAction(&_action2);
+}
+
+void Scene200::remove() {
+ BF_GLOBALS._scenePalette.clearListeners();
+ SceneExt::remove();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 210 - Credits - Car Training
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene210::Action1::signal() {
+ Scene210 *scene = (Scene210 *)BF_GLOBALS._sceneManager._scene;
+ SceneObject *owner = static_cast<SceneObject *>(_owner);
+ assert(owner);
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(1);
+ break;
+ case 1:
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 2: {
+ PaletteRotation *rot;
+ rot = BF_GLOBALS._scenePalette.addRotation(64, 79, 1);
+ rot->setDelay(10);
+ rot = BF_GLOBALS._scenePalette.addRotation(96, 111, 1);
+ rot->setDelay(10);
+
+ scene->setAction(&scene->_sequenceManager, this, 210, &scene->_object10, &scene->_object11,
+ &scene->_object12, &scene->_object13, &scene->_object14, &scene->_object15, NULL);
+ break;
+ }
+ case 3:
+ BF_GLOBALS._sceneManager.changeScene(220);
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene210::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(210);
+ BF_GLOBALS._scenePalette.loadPalette(235);
+ BF_GLOBALS._scenePalette.refresh();
+
+ _object9.postInit();
+ _object9.setVisage(210);
+ _object9.setPosition(Common::Point(146, 151));
+ _object9.setStrip(1);
+ _object9.setFrame(1);
+ _object9.changeZoom(100);
+ _object9.setAction(&_action1);
+
+ _object10.postInit();
+ _object10.hide();
+ _object11.postInit();
+ _object11.hide();
+ _object12.postInit();
+ _object12.hide();
+ _object13.postInit();
+ _object13.hide();
+ _object14.postInit();
+ _object14.hide();
+ _object15.postInit();
+ _object15.hide();
+}
+
+void Scene210::remove() {
+ BF_GLOBALS._scenePalette.clearListeners();
+ SceneExt::remove();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 220 - Credits - Martial Arts
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene220::Action1::signal() {
+ Scene220 *scene = (Scene220 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(1);
+ break;
+ case 1:
+ BF_GLOBALS._scenePalette.loadPalette(235);
+ BF_GLOBALS._scenePalette.refresh();
+ setDelay(30);
+ break;
+ case 2:
+ BF_GLOBALS._scenePalette.clearListeners();
+ scene->_object2.animate(ANIM_MODE_5, this);
+ break;
+ case 3:
+ scene->_object2.setVisage(221);
+ scene->_object2.setFrame(1);
+ scene->_object2.setPosition(Common::Point(178, 122));
+ scene->_object2.animate(ANIM_MODE_5, this);
+ break;
+ case 4:
+ BF_GLOBALS._scenePalette.loadPalette(2);
+ BF_GLOBALS._scenePalette.refresh();
+ BF_GLOBALS._scenePalette.loadPalette(235);
+ BF_GLOBALS._scenePalette.refresh();
+ setDelay(5);
+ break;
+ case 5:
+ scene->_object1.remove();
+
+ scene->_object2.setVisage(222);
+ scene->_object2.setFrame(1);
+ scene->_object2.setPosition(Common::Point(164, 138));
+ scene->_object2.animate(ANIM_MODE_5, this);
+ break;
+ case 6:
+ scene->_object2.setVisage(223);
+ scene->_object2.setFrame(1);
+ scene->_object2.setPosition(Common::Point(164, 139));
+ scene->_object2.animate(ANIM_MODE_5, this);
+ break;
+ case 7:
+ scene->_object2.setVisage(230);
+ scene->_object2.setFrame(1);
+ scene->_object2.setPosition(Common::Point(168, 136));
+ scene->_object2.animate(ANIM_MODE_4, 13, 1, this);
+ break;
+ case 8:
+ scene->_object2.animate(ANIM_MODE_5, this);
+
+ scene->_object3.postInit();
+ scene->_object3.setVisage(231);
+ scene->_object3.setPosition(Common::Point(65, 179));
+ scene->_object3.setStrip(1);
+ scene->_object3.setFrame(1);
+ scene->_object3.changeZoom(100);
+ scene->_object3.setAction(&scene->_action2, this);
+ break;
+ case 9:
+ break;
+ case 10:
+ scene->_object2.setVisage(224);
+ scene->_object2.setFrame(1);
+ scene->_object2.setPosition(Common::Point(148, 143));
+ scene->_object2.animate(ANIM_MODE_5, this);
+ break;
+ case 11: {
+ PaletteRotation *rot;
+ rot = BF_GLOBALS._scenePalette.addRotation(64, 79, 1);
+ rot->setDelay(10);
+ rot = BF_GLOBALS._scenePalette.addRotation(96, 111, 1);
+ rot->setDelay(10);
+
+ scene->setAction(&scene->_sequenceManager, this, 220, &scene->_object4, &scene->_object5,
+ &scene->_object6, &scene->_object7, &scene->_object8, &scene->_object9, NULL);
+ break;
+ }
+ case 12:
+ scene->_object2.setVisage(232);
+ scene->_object2.setFrame(1);
+ scene->_object2.setPosition(Common::Point(146, 143));
+ scene->_object2._numFrames = 5;
+ scene->_object2.animate(ANIM_MODE_5, this);
+ break;
+ case 13:
+ scene->_object2.setVisage(228);
+ scene->_object2.setFrame(1);
+ scene->_object2.animate(ANIM_MODE_5, this);
+ break;
+ case 14:
+ scene->_object2.setVisage(229);
+ scene->_object2.setFrame(1);
+ scene->_object2.animate(ANIM_MODE_5, this);
+ break;
+ case 15:
+ BF_GLOBALS._sceneManager.changeScene(225);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene220::Action2::signal() {
+ Scene220 *scene = (Scene220 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->_object3.setPosition(scene->_object3._position);
+ scene->_object3.animate(ANIM_MODE_5, this);
+ break;
+ case 1:
+ setDelay(50);
+ break;
+ case 2:
+ scene->_object3.remove();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene220::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(220);
+
+ _object2.postInit();
+ _object2.setVisage(220);
+ _object2.setPosition(Common::Point(182, 122));
+ _object2.setStrip(1);
+ _object2.setFrame(1);
+ _object2.changeZoom(100);
+
+ _object1.postInit();
+ _object1.setVisage(220);
+ _object1.setPosition(Common::Point(164, 138));
+ _object1.setStrip(2);
+ _object1.setFrame(1);
+ _object1.changeZoom(100);
+
+ _object4.postInit();
+ _object4.hide();
+ _object5.postInit();
+ _object5.hide();
+ _object6.postInit();
+ _object6.hide();
+ _object7.postInit();
+ _object7.hide();
+ _object8.postInit();
+ _object8.hide();
+ _object9.postInit();
+ _object9.hide();
+
+ _object2.setAction(&_action1);
+}
+
+void Scene220::remove() {
+ BF_GLOBALS._scenePalette.clearListeners();
+ SceneExt::remove();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 225 - Credits - Gun Training
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene225::Action1::signal() {
+ Scene225 *scene = (Scene225 *)BF_GLOBALS._sceneManager._scene;
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(30);
+ break;
+ case 1:
+ BF_GLOBALS._scenePalette.loadPalette(235);
+ BF_GLOBALS._scenePalette.refresh();
+ setDelay(5);
+ break;
+ case 2:
+ owner->animate(ANIM_MODE_4, 7, 1, this);
+ break;
+ case 3:
+ scene->_object8.animate(ANIM_MODE_5, this);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 4:
+ scene->_object8.remove();
+ break;
+ case 5:
+ scene->_action3.signal();
+ break;
+ case 6:
+ owner->setPosition(Common::Point(owner->_position.x, owner->_position.y - 4));
+ owner->setStrip(2);
+ owner->setFrame(1);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 7:
+ scene->_action2.signal();
+ break;
+ case 8:
+ owner->animate(ANIM_MODE_6, this);
+ break;
+ case 9:
+ owner->setPosition(Common::Point(owner->_position.x - 2, owner->_position.y - 1));
+ owner->setStrip(3);
+ owner->setFrame(1);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 10: {
+ owner->setPosition(Common::Point(owner->_position.x + 10, owner->_position.y + 4));
+ owner->setStrip(4);
+ owner->setFrame(1);
+ owner->fixPriority(116);
+ owner->animate(ANIM_MODE_1, NULL);
+
+ Common::Point destPos(138, 117);
+ NpcMover *mover = new NpcMover();
+ owner->addMover(mover, &destPos, this);
+ break;
+ }
+ case 11: {
+ owner->setPosition(Common::Point(owner->_position.x - 12, owner->_position.y - 1));
+ owner->setStrip(5);
+ owner->setFrame(1);
+ owner->_moveDiff.x = 8;
+
+ Common::Point destPos(402, 116);
+ NpcMover *mover2 = new NpcMover();
+ owner->addMover(mover2, &destPos, this);
+
+ BF_GLOBALS._player.setPosition(Common::Point(owner->_position.x, 0));
+ ADD_MOVER_NULL(BF_GLOBALS._player, 500, 0);
+ break;
+ }
+ case 12:
+ owner->setVisage(1227);
+ owner->setStrip(1);
+ owner->setFrame(1);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 13:
+ owner->setStrip(2);
+ owner->setFrame(4);
+ scene->_action4.signal();
+ break;
+ case 14:
+ owner->animate(ANIM_MODE_6, this);
+ break;
+ case 15:
+ scene->_action6.signal();
+ break;
+ case 16:
+ owner->animate(ANIM_MODE_4, 4, 1, this);
+ break;
+ case 17:
+ owner->setFrame(6);
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 18:
+ scene->_action5.signal();
+ break;
+ case 19:
+ owner->animate(ANIM_MODE_4, 4, -1, this);
+ break;
+ case 20:
+ PaletteRotation *rot;
+ rot = BF_GLOBALS._scenePalette.addRotation(64, 79, 1);
+ rot->setDelay(10);
+ rot = BF_GLOBALS._scenePalette.addRotation(96, 111, 1);
+ rot->setDelay(10);
+
+ scene->setAction(&scene->_sequenceManager, this, 225, &scene->_object15, &scene->_object16,
+ &scene->_object17, &scene->_object18, &scene->_object19, &scene->_object20, NULL);
+ break;
+ case 21:
+ scene->_object21.hide();
+ BF_GLOBALS._player._moveDiff.x = 5;
+ BF_GLOBALS._sceneManager.changeScene(265);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene225::Action2::signal() {
+ Scene225 *scene = (Scene225 *)BF_GLOBALS._sceneManager._scene;
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ switch (_actionIndex++) {
+ case 0:
+ break;
+ case 1:
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 2:
+ owner->setStrip(3);
+ owner->setFrame(2);
+ scene->_action1.signal();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene225::Action3::signal() {
+ Scene225 *scene = (Scene225 *)BF_GLOBALS._sceneManager._scene;
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ switch (_actionIndex++) {
+ case 0:
+ break;
+ case 1:
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 2:
+ owner->setStrip(3);
+ owner->setFrame(1);
+ scene->_action1.signal();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene225::Action4::signal() {
+ Scene225 *scene = (Scene225 *)BF_GLOBALS._sceneManager._scene;
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ switch (_actionIndex++) {
+ case 0:
+ break;
+ case 1:
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 2:
+ owner->setStrip(5);
+ owner->setFrame(4);
+ scene->_action1.signal();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene225::Action5::signal() {
+ Scene225 *scene = (Scene225 *)BF_GLOBALS._sceneManager._scene;
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ switch (_actionIndex++) {
+ case 0:
+ break;
+ case 1:
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 2:
+ owner->setStrip(3);
+ owner->setFrame(6);
+ scene->_action1.signal();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene225::Action6::signal() {
+ Scene225 *scene = (Scene225 *)BF_GLOBALS._sceneManager._scene;
+ SceneObject *owner = static_cast<SceneObject *>(this->_owner);
+
+ switch (_actionIndex++) {
+ case 0:
+ break;
+ case 1:
+ owner->animate(ANIM_MODE_5, this);
+ break;
+ case 2:
+ owner->setStrip(3);
+ owner->setFrame(3);
+ scene->_action1.signal();
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene225::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(1225);
+ loadBackground(-320, 0);
+
+ _object8.postInit();
+ _object8.setVisage(1225);
+ _object8.setPosition(Common::Point(114, 119));
+ _object8._frame = 1;
+ _object8.setStrip(2);
+ _object8.changeZoom(100);
+
+ _object9.postInit();
+ _object9.setVisage(1226);
+ _object9.setPosition(Common::Point(83, 128));
+ _object9.setStrip(1);
+ _object9.changeZoom(100);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setPosition(Common::Point(83, 0));
+ BF_GLOBALS._player.hide();
+
+ _object10.postInit();
+ _object10.setVisage(1225);
+ _object10.setPosition(Common::Point(237, 29));
+ _object10.setStrip(1);
+ _object10._frame = 1;
+ _object10.changeZoom(100);
+ _object10._numFrames = 2;
+
+ _object11.postInit();
+ _object11.setVisage(1225);
+ _object11.setPosition(Common::Point(290, 47));
+ _object11.setStrip(1);
+ _object11._frame = 1;
+ _object11.changeZoom(100);
+ _object11._numFrames = 2;
+
+ _object12.postInit();
+ _object12.setVisage(1225);
+ _object12.setPosition(Common::Point(368, 35));
+ _object12.setStrip(4);
+ _object12._frame = 1;
+ _object12.changeZoom(100);
+ _object12._numFrames = 2;
+
+ _object13.postInit();
+ _object13.setVisage(1225);
+ _object13.setPosition(Common::Point(416, 33));
+ _object13.setStrip(1);
+ _object13._frame = 1;
+ _object13.changeZoom(100);
+ _object13._numFrames = 2;
+
+ _object14.postInit();
+ _object14.setVisage(1225);
+ _object14.setPosition(Common::Point(476, 30));
+ _object14.setStrip(1);
+ _object14._frame = 1;
+ _object14.changeZoom(100);
+ _object14._numFrames = 2;
+
+ _object21.postInit();
+ _object21.setVisage(235);
+ _object21.setStrip(1);
+ _object21._frame = 1;
+ _object21.setPosition(Common::Point(498, 41));
+ _object21.changeZoom(100);
+ _object21.hide();
+
+ _object15.postInit();
+ _object15.hide();
+ _object16.postInit();
+ _object16.hide();
+ _object17.postInit();
+ _object17.hide();
+ _object18.postInit();
+ _object18.hide();
+ _object19.postInit();
+ _object19.hide();
+ _object20.postInit();
+ _object20.hide();
+
+ _object9.setAction(&_action1);
+ _object10.setAction(&_action2);
+ _object11.setAction(&_action3);
+ _object12.setAction(&_action4);
+ _object13.setAction(&_action5);
+ _object14.setAction(&_action6);
+}
+
+void Scene225::remove() {
+ BF_GLOBALS._scenePalette.clearListeners();
+ SceneExt::remove();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 265 - Graduation Article
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene265::Action1::signal() {
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._scenePalette.loadPalette(2);
+ setDelay(30);
+ break;
+ case 1:
+ BF_GLOBALS._scenePalette.refresh();
+ setDelay(240);
+ break;
+ case 2:
+ ADD_MOVER(BF_GLOBALS._player, 160, 280);
+ break;
+ case 3:
+ // Wait until sound finishes playing
+ if (BF_GLOBALS._sound1.isPlaying())
+ _actionIndex = 3;
+ setDelay(1);
+ break;
+ case 4:
+ BF_GLOBALS._dayNumber = 1;
+ BF_GLOBALS._sceneManager.changeScene(190);
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene265::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(265);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setPosition(Common::Point(160, 100));
+ BF_GLOBALS._player.hide();
+ setAction(&_action1);
+}
+
+void Scene265::remove() {
+ clearScreen();
+ remove();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 270 - Living Room & Kitchen
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene270::Action1::signal() {
+ Scene270 *scene = (Scene270 *)BF_GLOBALS._sceneManager._scene;
+
+ scene->setAction(&scene->_sequenceManager2, this, 2703, &scene->_tv, NULL);
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene270::Lyle::startAction(CursorType action, Event &event) {
+ Scene270 *scene = (Scene270 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ scene->_field21A0 = 1;
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2706;
+
+ if (scene->_field380 == 1) {
+ scene->setAction(&scene->_sequenceManager1, scene, 2706, &BF_GLOBALS._player, &scene->_object2, NULL);
+ } else {
+ scene->signal();
+ }
+ return true;
+ case INV_CRATE1:
+ scene->_field21A0 = 2;
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2706;
+
+ if (scene->_field380 == 1) {
+ scene->setAction(&scene->_sequenceManager1, scene, 2706, &BF_GLOBALS._player, NULL);
+ } else {
+ scene->signal();
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene270::Grandma::startAction(CursorType action, Event &event) {
+ Scene270 *scene = (Scene270 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ switch (BF_GLOBALS._dayNumber) {
+ case 1:
+ // Day 1
+ if (scene->_field380 == 1) {
+ scene->_stripManager.start((scene->_grandma._position.x == 157) ? 2712 : 2723, &BF_GLOBALS._stripProxy);
+ } else if (BF_GLOBALS._bookmark == bBookedFrankieEvidence) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2710;
+ scene->setAction(&scene->_sequenceManager1, scene, 2710, &BF_GLOBALS._player, &scene->_grandma, NULL);
+ } else if (BF_GLOBALS.getFlag(onDuty) || (BF_INVENTORY.getObjectScene(INV_BASEBALL_CARD) == 2) ||
+ (scene->_field386 != 0)) {
+ scene->_stripManager.start(2723, &BF_GLOBALS._stripProxy);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2715;
+ scene->setAction(&scene->_sequenceManager1, scene, 2715, &BF_GLOBALS._player, &scene->_grandma, NULL);
+ }
+ return true;
+ case 3:
+ // Day 3
+ if (scene->_field380 == 1) {
+ scene->_stripManager.start(2712, &BF_GLOBALS._stripProxy);
+ } else if (BF_GLOBALS.getFlag(fGotGreen355fTalkedToGrannyDay3)) {
+ scene->_stripManager.start(2714, &BF_GLOBALS._stripProxy);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2713;
+ scene->setAction(&scene->_sequenceManager1, scene, 2713, &BF_GLOBALS._player, &scene->_grandma, NULL);
+ }
+ return true;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene270::Item::startAction(CursorType action, Event &event) {
+ Scene270 *scene = (Scene270 *)BF_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_USE) && (scene->_field380 == 0)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_object2.postInit();
+ scene->_object2.hide();
+ scene->_sceneMode = 2705;
+ scene->setAction(&scene->_sequenceManager1, this, 2705, &BF_GLOBALS._player, &scene->_object2, NULL);
+ return true;
+ } else {
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene270::Exit::startAction(CursorType action, Event &event) {
+ Scene270 *scene = (Scene270 *)BF_GLOBALS._sceneManager._scene;
+
+ if (!_action && !scene->_field384 && !scene->_field386) {
+ if (scene->_field380 == 1) {
+ scene->_tempPos = Common::Point(320, 140);
+ BF_GLOBALS._player.disableControl();
+
+ scene->_sceneMode = 2706;
+ scene->setAction(&scene->_sequenceManager1, scene, 2706, &BF_GLOBALS._player, &scene->_object2, NULL);
+ } else {
+ ADD_PLAYER_MOVER(320, 140);
+ }
+ return true;
+ } else {
+ return false;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene270::Scene270(): SceneExt() {
+ _field380 = _field382 =_field384 = _field386 = 0;
+ _field219A = _tempPos.x = _tempPos.y = _field21A0 = 0;
+ _sceneMode = 0;
+}
+
+void Scene270::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_field380);
+ s.syncAsSint16LE(_field382);
+ s.syncAsSint16LE(_field384);
+ s.syncAsSint16LE(_field386);
+ s.syncAsSint16LE(_field219A);
+ s.syncAsSint16LE(_tempPos.x);
+ s.syncAsSint16LE(_tempPos.y);
+ s.syncAsSint16LE(_field21A0);
+}
+
+void Scene270::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(270);
+ setZoomPercents(120, 90, 130, 100);
+
+ if (BF_GLOBALS._sceneManager._previousScene != 560)
+ BF_GLOBALS._sound1.fadeSound(26);
+
+ _exit.setDetails(Rect(310, 115, 320, 167), 270, -1, -1, -1, 1, NULL);
+
+ if (BF_GLOBALS._dayNumber == 0) {
+ BF_GLOBALS._dayNumber = 1;
+ BF_INVENTORY.setObjectScene(INV_BASEBALL_CARD, 2);
+ BF_INVENTORY.setObjectScene(INV_CRATE1, 1);
+ BF_GLOBALS._sceneManager._previousScene = 710;
+ }
+
+ if (((BF_GLOBALS._bookmark >= bLauraToParamedics) && (BF_GLOBALS._dayNumber == 1) &&
+ (BF_INVENTORY.getObjectScene(INV_BASEBALL_CARD) != 2) &&
+ (BF_INVENTORY.getObjectScene(INV_BASEBALL_CARD) != 1)) ||
+ ((BF_GLOBALS._dayNumber == 3) && BF_GLOBALS.getFlag(fGotGreen355fTalkedToGrannyDay3))) {
+ BF_GLOBALS._walkRegions.proc1(6);
+ BF_GLOBALS._walkRegions.proc1(14);
+ BF_GLOBALS._walkRegions.proc1(19);
+
+ _grandma.postInit();
+ _grandma.setVisage(274);
+ _grandma.setPosition(Common::Point(157, 132));
+ _grandma._numFrames = 5;
+ _grandma.animate(ANIM_MODE_2, NULL);
+ _grandma.fixPriority(129);
+ }
+
+ if (BF_GLOBALS._bookmark == bTalkedToGrannyAboutSkipsCard) {
+ _grandma.postInit();
+ }
+
+ if (BF_GLOBALS._sceneManager._previousScene == 710) {
+ _skip.postInit();
+ _laura.postInit();
+ _lyle.postInit();
+ _grandma.postInit();
+ }
+
+ _stripManager.addSpeaker(&_grandmaSpeaker);
+ _stripManager.addSpeaker(&_lyleSpeaker);
+ _stripManager.addSpeaker(&_jakeSpeaker);
+ _stripManager.addSpeaker(&_skipSpeaker);
+ _stripManager.addSpeaker(&_lauraSpeaker);
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+
+ _tv.postInit();
+ _tv.setVisage(270);
+ _tv.setPosition(Common::Point(264, 74));
+ _tv.setStrip(5);
+ _tv.fixPriority(132);
+ _tv._numFrames = 3;
+ _tv.setAction(&_action1);
+
+ _fireplace.postInit();
+ _fireplace.setVisage(270);
+ _fireplace.setStrip(2);
+ _fireplace.setPosition(Common::Point(302, 121));
+ _fireplace.fixPriority(132);
+ _fireplace.animate(ANIM_MODE_2, NULL);
+
+ _fridge.setDetails(Rect(0, 56, 56, 130), 270, 9, 10, 11, 1, NULL);
+ _object3.setDetails(270, 12, 13, 14, 1, NULL);
+ _laura.setDetails(270, 15, -1, -1, 1, NULL);
+ _skip.setDetails(270, 14, -1, -1, 1, NULL);
+ _lyle.setDetails(270, 34, 35, 36, 1, NULL);
+ _tv.setDetails(270, 3, 4, 5, 1, NULL);
+ _fireplace.setDetails(270, 6, 7, 8, 1, NULL);
+
+ if ((BF_GLOBALS._sceneManager._previousScene == 710) && (BF_GLOBALS._bookmark == bTalkedToGrannyAboutSkipsCard)) {
+ _grandma.setDetails(270, 15, 16, 17, 1, NULL);
+ } else {
+ _grandma.setDetails(270, 40, 16, 17, 1, NULL);
+ }
+
+ _afgan.setDetails(4, 270, 27, 28, 29, 1);
+ _couch.setDetails(1, 270, 18, 19, 20, 1);
+ _photos.setDetails(Rect(278, 50, 318, 72), 270, 21, 22, 23, 1, NULL);
+ _appliances.setDetails(3, 270, 24, 25, 26, 1);
+ _ivy.setDetails(2, 270, 30, 31, 32, 1);
+ _background.setDetails(Rect(0, 0, 320, 168), 270, 0, 1, 2, 1, NULL);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player._moveDiff.x = 8;
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.disableControl();
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 560:
+ if (BF_GLOBALS._bookmark == bTalkedToGrannyAboutSkipsCard) {
+ _field219A = 1;
+ BF_GLOBALS._player._moveDiff.x = 5;
+ _field386 = 0;
+
+ _grandma.animate(ANIM_MODE_1, NULL);
+ setAction(&_sequenceManager1, NULL, 2720, &BF_GLOBALS._player, &_grandma, NULL);
+ BF_GLOBALS._bookmark = bLyleStoppedBy;
+ } else {
+ _sceneMode = 2700;
+ setAction(&_sequenceManager1, this, 2700, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ case 690:
+ BF_GLOBALS._player.setPosition(Common::Point(-13, 162));
+ _sceneMode = 2702;
+ setAction(&_sequenceManager1, this, 2702, &BF_GLOBALS._player, NULL);
+ break;
+ case 710:
+ BF_GLOBALS._player._moveDiff.x = 6;
+ _sceneMode = 2717;
+ setAction(&_sequenceManager1, this, 2717, &BF_GLOBALS._player, &_laura, &_skip, &_lyle, &_grandma, NULL);
+ break;
+ default:
+ _sceneMode = 2701;
+ setAction(&_sequenceManager1, this, 2701, &BF_GLOBALS._player, NULL);
+ break;
+ }
+}
+
+void Scene270::signal() {
+ switch (_sceneMode) {
+ case 10:
+ _sceneMode = 2702;
+ setAction(&_sequenceManager1, this, 2702, &BF_GLOBALS._player, NULL);
+ break;
+ case 11:
+ BF_GLOBALS._player._strip = 8;
+ BF_GLOBALS._player._frame = 1;
+
+ if (_field382) {
+ _sceneMode = 2719;
+ _stripManager.start(2720, this);
+ } else {
+ _field382 = 1;
+ _sceneMode = 13;
+ _stripManager.start(2718, this);
+ }
+ break;
+ case 12:
+ BF_GLOBALS._player._strip = 8;
+ BF_GLOBALS._player._frame = 1;
+ _sceneMode = 13;
+ _stripManager.start(2719, this);
+ break;
+ case 13:
+ case 2713:
+ case 2715:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 2700:
+ _field219A = 1;
+ BF_GLOBALS._player._strip = 6;
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 2701:
+ BF_GLOBALS._player._strip = 2;
+ BF_GLOBALS._player.enableControl();
+ _field219A = 1;
+ break;
+ case 2702:
+ BF_GLOBALS._player._strip = 1;
+ BF_GLOBALS._player.enableControl();
+ _field219A = 1;
+ break;
+ case 2705:
+ _field380 = 1;
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 2706:
+ BF_GLOBALS._player.changeZoom(-1);
+ _object2.remove();
+ _field380 = 0;
+
+ switch (_field21A0) {
+ case 1:
+ _sceneMode = 11;
+ ADD_PLAYER_MOVER(192, 135);
+ break;
+ case 2:
+ if (BF_GLOBALS.getFlag(shownLyleCrate1Day1)) {
+ SceneItem::display2(270, 37);
+ BF_GLOBALS._player.enableControl();
+ } else {
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(shownLyleCrate1Day1);
+ _sceneMode = 12;
+ ADD_PLAYER_MOVER(192, 135);
+ }
+ break;
+ default:
+ BF_GLOBALS._player.enableControl();
+ ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, _tempPos.x, _tempPos.y);
+ break;
+ }
+
+ _field21A0 = 0;
+ break;
+ case 2710:
+ BF_GLOBALS._bookmark = bEndOfWorkDayOne;
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 2711:
+ BF_GLOBALS._player.setPosition(Common::Point(150, 300));
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(180);
+ BF_GLOBALS._bookmark = bLyleStoppedBy;
+ break;
+ case 2712:
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(180);
+ break;
+ case 2714:
+ BF_GLOBALS._sceneManager.changeScene(560);
+ break;
+ case 2717:
+ _sceneMode = 2718;
+ _lyle.setFrame2(-1);
+ setAction(&_sequenceManager1, this, 2718, &BF_GLOBALS._player, &_laura, &_skip,
+ &_lyle, &_grandma, NULL);
+ break;
+ case 2718:
+ BF_GLOBALS._walkRegions.proc1(6);
+ BF_GLOBALS._walkRegions.proc1(14);
+ BF_GLOBALS._walkRegions.proc1(19);
+
+ _field219A = 1;
+ BF_GLOBALS._bookmark = bTalkedToGrannyAboutSkipsCard;
+
+ _grandma.setStrip(8);
+ _grandma._frame = 5;
+ _field384 = 1;
+ _field384 = 1;
+
+ BF_GLOBALS._player._moveDiff.x = 8;
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 2719:
+ _sceneMode = 13;
+ _field384 = 0;
+ BF_GLOBALS._player._moveDiff.x = 6;
+
+ _lyle.setFrame2(-1);
+ setAction(&_sequenceManager1, this, 2719, &BF_GLOBALS._player, &_lyle, &_grandma, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene270::process(Event &event) {
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == CURSOR_WALK) &&
+ (_field380 == 1) && !_action) {
+ _tempPos = event.mousePos;
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 2706;
+ setAction(&_sequenceManager1, this, 2706, &BF_GLOBALS._player, &_object2, NULL);
+ event.handled = true;
+ }
+
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1)) &&
+ !_field384 && !_field386) {
+ // Check if the cursor is on an exit
+ if (_exit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_E);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+}
+
+void Scene270::dispatch() {
+ if (_field384) {
+ _lyle.updateAngle(BF_GLOBALS._player._position);
+
+ if (_lyle._angle < 110)
+ _lyle.setFrame2(4);
+ else if (_lyle._angle < 180)
+ _lyle.setFrame2(3);
+ else if (_lyle._angle < 250)
+ _lyle.setFrame2(2);
+ else
+ _lyle.setFrame2(1);
+ }
+
+ if (_field386) {
+ if (BF_GLOBALS._player._position.x > 290) {
+ _grandma.setFrame(6);
+ } else if (BF_GLOBALS._player._position.x > 274) {
+ _grandma.setFrame(5);
+ } else if (BF_GLOBALS._player._position.x > 258) {
+ _grandma.setFrame(4);
+ } else if (BF_GLOBALS._player._position.x > 242) {
+ _grandma.setFrame(3);
+ } else if (BF_GLOBALS._player._position.x > 226) {
+ _grandma.setFrame(2);
+ } else if (BF_GLOBALS._player._position.x > 210) {
+ if ((_grandma._animateMode == ANIM_MODE_NONE) && (_grandma._frame > 1))
+ _grandma.animate(ANIM_MODE_6, NULL);
+ } else {
+ if ((_grandma._animateMode == ANIM_MODE_NONE) && (_grandma._frame < 3))
+ _grandma.animate(ANIM_MODE_4, 3, 1, NULL);
+ }
+ }
+
+ if (!_action && _field219A) {
+ if ((BF_GLOBALS._player._position.x > 236) && (BF_GLOBALS._player._position.y < 125)) {
+ _field219A = 0;
+ BF_GLOBALS._player.disableControl();
+ if (!_field384) {
+ BF_GLOBALS._sceneManager.changeScene(560);
+ } else {
+ BF_GLOBALS._player.addMover(NULL);
+ SceneItem::display2(270, 38);
+ _sceneMode = 2700;
+ ADD_PLAYER_MOVER(BF_GLOBALS._player._position.x - 10, BF_GLOBALS._player._position.y + 15);
+ }
+ }
+
+ if (BF_GLOBALS._player._position.x <= 20) {
+ _field219A = 0;
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.addMover(NULL);
+ BF_GLOBALS._player._strip = 3;
+ BF_GLOBALS._player._frame = 1;
+
+ if (BF_GLOBALS._sceneObjects->contains(&_grandma)) {
+ _sceneMode = 10;
+ _stripManager.start(2711, this);
+ } else {
+ SceneItem::display2(270, 33);
+ _sceneMode = 2702;
+ setAction(&_sequenceManager1, this, 2702, &BF_GLOBALS._player, NULL);
+ }
+ }
+
+ if (BF_GLOBALS._player._position.x > 310) {
+ _field219A = 0;
+ BF_GLOBALS._player.disableControl();
+ if (!_field384 && !_field386) {
+ _sceneMode = 2712;
+ setAction(&_sequenceManager1, this, 2712, &BF_GLOBALS._player, NULL);
+ } else {
+ BF_GLOBALS._player.addMover(NULL);
+ BF_GLOBALS._player._strip = 2;
+ BF_GLOBALS._player._frame = 1;
+ SceneItem::display2(270, !_field384 ? 39 : 38);
+ _sceneMode = 2701;
+
+ ADD_PLAYER_MOVER(BF_GLOBALS._player._position.x - 10, BF_GLOBALS._player._position.y);
+ }
+ }
+ }
+
+ SceneExt::dispatch();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 271 - Living Room & Kitchen #2
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene271::Action1::signal() {
+ Scene271 *scene = (Scene271 *)BF_GLOBALS._sceneManager._scene;
+
+ scene->setAction(&scene->_sequenceManager2, this, 2703, &scene->_tv, NULL);
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene271::Object12::startAction(CursorType action, Event &event) {
+ Scene271 *scene = (Scene271 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ if (BF_GLOBALS._dayNumber == 1) {
+ if (!BF_GLOBALS.getFlag(onDuty) && (BF_INVENTORY.getObjectScene(INV_BASEBALL_CARD) != 2)) {
+ scene->_sceneMode = 2715;
+ scene->setAction(&scene->_sequenceManager1, scene, 2715, &BF_GLOBALS._player, NULL);
+ return true;
+ }
+ } else if (BF_GLOBALS._dayNumber == 3) {
+ if (scene->_field796 == 1) {
+ scene->_stripManager.start(2712, &BF_GLOBALS._stripProxy);
+ return true;
+ } else if (BF_GLOBALS.getFlag(fGotGreen355fTalkedToGrannyDay3)) {
+ scene->_stripManager.start(2714, &BF_GLOBALS._stripProxy);
+ return true;
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2713;
+ scene->setAction(&scene->_sequenceManager1, scene, 2713, &BF_GLOBALS._player, &scene->_object12, NULL);
+ BF_GLOBALS.setFlag(fGotGreen355fTalkedToGrannyDay3);
+ return true;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene271::Item::startAction(CursorType action, Event &event) {
+ Scene271 *scene = (Scene271 *)BF_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_USE) && !scene->_field796) {
+ BF_GLOBALS._player.disableControl();
+ scene->_object1.postInit();
+ scene->_object1.hide();
+
+ scene->_sceneMode = 2705;
+ scene->setAction(&scene->_sequenceManager1, scene, 2705, &BF_GLOBALS._player, &scene->_object1, NULL);
+ return true;
+ } else {
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene271::Exit::startAction(CursorType action, Event &event) {
+ Scene271 *scene = (Scene271 *)BF_GLOBALS._sceneManager._scene;
+
+ if (!scene->_action) {
+ if (scene->_field796 == 1) {
+ scene->_tempPos = Common::Point(320, 140);
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2706;
+ scene->setAction(&scene->_sequenceManager1, scene, 2706, &BF_GLOBALS._player, &scene->_object1, NULL);
+ } else {
+ ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 320, 140);
+ }
+ }
+
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene271::Scene271() {
+ _field796 = _field2E16 = 0;
+ _tempPos.x = _tempPos.y = 0;
+ _rect1 = Rect(236, 120, 266, 130);
+}
+
+void Scene271::synchronize(Serializer &s) {
+ PalettedScene::synchronize(s);
+
+ s.syncAsSint16LE(_field796);
+ s.syncAsSint16LE(_field2E16);
+ s.syncAsSint16LE(_tempPos.x);
+ s.syncAsSint16LE(_tempPos.y);
+ _rect1.synchronize(s);
+}
+
+void Scene271::postInit(SceneObjectList *OwnerList) {
+ PalettedScene::postInit();
+ loadScene(270);
+ setZoomPercents(120, 80, 140, 100);
+ BF_GLOBALS._sound1.fadeSound(26);
+
+ _stripManager.addSpeaker(&_grandmaSpeaker);
+ _stripManager.addSpeaker(&_lyleSpeaker);
+ _stripManager.addSpeaker(&_jakeSpeaker);
+ _stripManager.addSpeaker(&_skipSpeaker);
+ _stripManager.addSpeaker(&_lauraSpeaker);
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_granTextSpeaker);
+ _stripManager.addSpeaker(&_lyleTextSpeaker);
+
+ _exit.setDetails(Rect(310, 115, 320, 167), 270, -1, -1, -1, 1, NULL);
+
+ _tv.postInit();
+ _tv.setVisage(270);
+ _tv.setPosition(Common::Point(264, 74));
+ _tv.setStrip(5);
+ _tv.fixPriority(132);
+ _tv._numFrames = 3;
+ _tv.setAction(&_action1);
+
+ if ((BF_GLOBALS._sceneManager._previousScene != 280) && (BF_GLOBALS._sceneManager._previousScene != 620)) {
+ _object10.postInit();
+ _object10.setVisage(270);
+ _object10.setStrip(2);
+ _object10.setPosition(Common::Point(302, 121));
+ _object10.fixPriority(132);
+ _object10.animate(ANIM_MODE_2, NULL);
+ }
+
+ _object5.postInit();
+ _object5.hide();
+
+ _item5.setDetails(Rect(0, 56, 56, 130), 270, 9, 10, 11, 1, NULL);
+ _object6.setDetails(270, 12, 13, 14, 1, NULL);
+ _object7.setDetails(270, 15, -1, -1, 1, NULL);
+ _object8.setDetails(270, 14, -1, -1, 1, NULL);
+ _object11.setDetails(270, -1, -1, -1, 1, NULL);
+ _tv.setDetails(270, 3, 4, 5, 1, NULL);
+ _object10.setDetails(270, 6, 7, 8, 1, NULL);
+ _object12.setDetails(270, 15, 16, 17, 1, NULL);
+ _item3.setDetails(4, 270, 27, 28, 29, 1);
+ _item1.setDetails(1, 270, 18, 19, 20, 1);
+ _item6.setDetails(Rect(278, 50, 318, 72), 270, 21, 22, 23, 1, NULL);
+ _item2.setDetails(3, 270, 24, 25, 26, 1);
+ _item4.setDetails(2, 270, 30, 31, 32, 1);
+ _item11.setDetails(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y), 270, 0, 1, 2, 1, NULL);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player._moveDiff.x = 8;
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.disableControl();
+
+ _field796 = 0;
+ _sceneMode = 0;
+ _field2E16 = 0;
+
+ if (BF_GLOBALS._dayNumber == 0) {
+ BF_GLOBALS._dayNumber = 1;
+ BF_GLOBALS._sceneManager.changeScene(180);
+ }
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 180:
+ BF_GLOBALS._walkRegions.proc1(6);
+ BF_GLOBALS._walkRegions.proc1(14);
+ BF_GLOBALS._walkRegions.proc1(19);
+
+ BF_GLOBALS._player.setVisage(151);
+ BF_GLOBALS._player.setPosition(Common::Point(348, 151));
+
+ _object12.postInit();
+ _object12.setVisage(274);
+ _object12.setPosition(Common::Point(157, 132));
+ _object12._numFrames = 5;
+ _object12.animate(ANIM_MODE_2, NULL);
+ break;
+ case 280:
+ BF_GLOBALS._player.setVisage(271);
+ BF_GLOBALS._player.setStrip(5);
+ BF_GLOBALS._player._frame = 6;
+ BF_GLOBALS._player.setPosition(Common::Point(228, 138));
+
+ _object1.postInit();
+ _object1.setPosition(Common::Point(340, 100));
+
+ _object11.postInit();
+ _object11.setVisage(272);
+ _object11.setStrip(1);
+ _object11._frame = 2;
+ _object11.setPosition(Common::Point(35, 136));
+
+ _object6.postInit();
+ _object6.hide();
+
+ BF_GLOBALS._walkRegions.proc1(6);
+ BF_GLOBALS._walkRegions.proc1(14);
+ BF_GLOBALS._walkRegions.proc1(19);
+
+ _object12.postInit();
+ _object12.setVisage(274);
+ _object12.setPosition(Common::Point(157, 132));
+ _object12.animate(ANIM_MODE_2, NULL);
+ _object12._numFrames = 5;
+ _object12.fixPriority(120);
+ _field796 = 1;
+ break;
+ case 590:
+ BF_GLOBALS._player.setVisage(275);
+ BF_GLOBALS._player.setStrip(5);
+ BF_GLOBALS._player.setPosition(Common::Point(58, 133));
+ BF_GLOBALS._player.changeZoom(-1);
+
+ _object8.postInit();
+ _object8.setVisage(279);
+ _object8.setPosition(Common::Point(87, 127));
+ _object8.fixPriority(146);
+
+ _object7.postInit();
+ _object7.setVisage(277);
+ _object7.setStrip(7);
+ _object7.setPosition(Common::Point(48, 149));
+
+ BF_GLOBALS._walkRegions.proc1(6);
+ BF_GLOBALS._walkRegions.proc1(14);
+ BF_GLOBALS._walkRegions.proc1(19);
+
+ _object12.postInit();
+ _object12.setVisage(276);
+ _object12.setPosition(Common::Point(129, 130));
+
+ _object2.postInit();
+ _object2.setVisage(270);
+ _object2.setStrip(3);
+ _object2.setFrame(2);
+ _object2.setPosition(Common::Point(62, 101));
+ _object2.fixPriority(145);
+
+ _object3.postInit();
+ _object3.setVisage(270);
+ _object3.setStrip(3);
+ _object3.setFrame(3);
+ _object3.setPosition(Common::Point(90, 104));
+ _object3.fixPriority(132);
+
+ _object4.postInit();
+ _object4.setVisage(270);
+ _object4.setStrip(3);
+ _object4.setFrame(4);
+ _object4.setPosition(Common::Point(132, 87));
+ _object4.fixPriority(1);
+ break;
+ default:
+ BF_GLOBALS._player.setVisage(271);
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player.setPosition(Common::Point(239, 145));
+
+ BF_GLOBALS._walkRegions.proc1(6);
+ BF_GLOBALS._walkRegions.proc1(14);
+ BF_GLOBALS._walkRegions.proc1(19);
+
+ _object12.postInit();
+ _object12.setVisage(274);
+ _object12.setPosition(Common::Point(157, 132));
+ _object12.animate(ANIM_MODE_2, NULL);
+ _object12._numFrames = 5;
+
+ _object1.postInit();
+ _object1.setVisage(271);
+ _object1.setStrip(4);
+ _object1.setPosition(Common::Point(220, 117));
+ _object1.fixPriority(145);
+ break;
+ }
+
+ _sceneMode = 11;
+
+ static uint32 black = 0;
+ add2Faders((const byte *)&black, 2, 270, this);
+}
+
+void Scene271::signal() {
+ static uint32 black = 0;
+
+ switch (_sceneMode) {
+ case 10:
+ _sceneMode = 2702;
+ setAction(&_sequenceManager1, this, 2702, &BF_GLOBALS._player, NULL);
+ break;
+ case 11:
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 180:
+ _sceneMode = 2716;
+ setAction(&_sequenceManager1, this, 2716, &BF_GLOBALS._player, &_object12, NULL);
+ break;
+ case 280:
+ BF_GLOBALS._dayNumber = 3;
+ BF_INVENTORY.alterInventory(3);
+
+ _sceneMode = 2707;
+ setAction(&_sequenceManager1, this, 2707, &BF_GLOBALS._player, &_object1, &_object11, &_object5, &_object6, NULL);
+ break;
+ case 590:
+ _sceneMode = 2704;
+ setAction(&_sequenceManager1, this, 2707, &BF_GLOBALS._player, &_object12, &_object7, &_object8, NULL);
+ default:
+ _object11.postInit();
+ _object11.setPosition(Common::Point(340, 100));
+ BF_GLOBALS._sound1.play(36);
+
+ _sceneMode = 2709;
+ setAction(&_sequenceManager1, this, 2709, &BF_GLOBALS._player, &_object1, &_object12, &_object11, NULL);
+ break;
+ }
+ break;
+ case 12:
+ BF_GLOBALS._v51C44 = 0;
+ BF_GLOBALS._sound1.changeSound(67);
+ BF_GLOBALS._sceneManager.changeScene(280);
+ break;
+ case 13:
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 2702:
+ BF_GLOBALS._player._strip = 1;
+ BF_GLOBALS._player.enableControl();
+ _field2E16 = 1;
+ break;
+ case 2704:
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(690);
+ break;
+ case 2705:
+ _field796 = 1;
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 2706:
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.enableControl();
+
+ _object1.remove();
+ _field796 = 0;
+ ADD_PLAYER_MOVER(_tempPos.x, _tempPos.y);
+ break;
+ case 2707:
+ BF_GLOBALS._player.enableControl();
+ _field796 = 1;
+ _field2E16 = 1;
+
+ _object1.remove();
+ _object11.remove();
+
+ BF_INVENTORY.setObjectScene(INV_LYLE_CARD, 1);
+ break;
+ case 2709:
+ BF_GLOBALS._sound1.play(68);
+ _sceneMode = 12;
+ addFader((const byte *)&black, 2, this);
+ break;
+ case 2712:
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(180);
+ break;
+ case 2713:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 2714:
+ BF_GLOBALS._v51C44 = 1;
+ BF_GLOBALS._sceneManager.changeScene(560);
+ break;
+ case 2715:
+ break;
+ case 2716:
+ BF_GLOBALS._deathReason = 24;
+ _sceneMode = 13;
+ addFader((const byte *)&black, 2, this);
+ break;
+ }
+}
+
+void Scene271::process(Event &event) {
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == CURSOR_WALK) &&
+ (_field796 == 1) && (!_action)) {
+ _tempPos = event.mousePos;
+ BF_GLOBALS._player.disableControl();
+
+ _sceneMode = 2706;
+ setAction(&_sequenceManager1, this, 2706, &BF_GLOBALS._player, &_object1, NULL);
+ event.handled = true;
+ }
+
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < BF_INTERFACE_Y)) {
+ if (_exit.contains(event.mousePos)) {
+ GfxSurface cursor = _cursorVisage.getFrame(EXITFRAME_E);
+ BF_GLOBALS._events.setCursor(cursor);
+ } else {
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+}
+
+void Scene271::dispatch() {
+ if (!_action && (_field2E16 == 1)) {
+ if ((BF_GLOBALS._player._position.x > 236) && (BF_GLOBALS._player._position.y < 120)) {
+ _field2E16 = 0;
+ BF_GLOBALS._sceneManager.changeScene(560);
+ }
+
+ if (BF_GLOBALS._player._position.x <= 20) {
+ _field2E16 = 0;
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player._mover->remove();
+ BF_GLOBALS._player._strip = 3;
+ BF_GLOBALS._player._frame = 1;
+
+ if (BF_GLOBALS._sceneObjects->contains(&_object12)) {
+ _sceneMode = 10;
+ _stripManager.start(2711, this);
+ } else {
+ SceneItem::display2(270, 33);
+ _sceneMode = 2702;
+ setAction(&_sequenceManager1, this, 2702, &BF_GLOBALS._player, NULL);
+ }
+ }
+
+ if (BF_GLOBALS._player._position.x >= 300) {
+ _field2E16 = 0;
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 2712;
+ setAction(&_sequenceManager1, this, 2712, &BF_GLOBALS._player, NULL);
+ }
+ }
+
+ SceneExt::dispatch();
+}
+
+} // End of namespace BlueForce
+
+} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_scenes2.h b/engines/tsage/blue_force/blueforce_scenes2.h
new file mode 100644
index 0000000000..2ec939be19
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_scenes2.h
@@ -0,0 +1,284 @@
+/* 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.
+ *
+ */
+
+#ifndef TSAGE_BLUEFORCE_SCENES2_H
+#define TSAGE_BLUEFORCE_SCENES2_H
+
+#include "common/scummsys.h"
+#include "tsage/blue_force/blueforce_logic.h"
+#include "tsage/blue_force/blueforce_speakers.h"
+#include "tsage/events.h"
+#include "tsage/core.h"
+#include "tsage/scenes.h"
+#include "tsage/globals.h"
+#include "tsage/sound.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+using namespace TsAGE;
+
+class IntroObject: public NamedObject {
+};
+
+class Scene200: public SceneExt {
+ /* Actions */
+ class Action1: public ActionExt {
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ Action1 _action1;
+ Action2 _action2;
+ NamedObject _object1, _object2, _object3, _object4, _object5, _object6;
+ IntroObject _object7, _object8, _object9;
+ NamedObject _object10, _object11;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+};
+
+class Scene210: public SceneExt {
+ /* Actions */
+ class Action1: public ActionExt {
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ Action1 _action1;
+ IntroObject _object1, _object2, _object3, _object4;
+ IntroObject _object5, _object6, _object7, _object8;
+ NamedObject _object9, _object10, _object11, _object12;
+ NamedObject _object13, _object14, _object15;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+};
+
+class Scene220: public SceneExt {
+ /* Actions */
+ class Action1: public ActionExt {
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ Action1 _action1;
+ Action2 _action2;
+ NamedObject _object1, _object2, _object3, _object4, _object5;
+ NamedObject _object6, _object7, _object8, _object9;
+ IntroObject _object10, _object11, _object12, _object13;
+ IntroObject _object14, _object15, _object16;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+};
+
+class Scene225: public SceneExt {
+ /* Actions */
+ class Action1: public ActionExt {
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action3: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action4: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action5: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action6: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ Action1 _action1;
+ Action2 _action2;
+ Action3 _action3;
+ Action4 _action4;
+ Action5 _action5;
+ Action6 _action6;
+ IntroObject _object1, _object2, _object3, _object4;
+ IntroObject _object5, _object6, _object7;
+ NamedObject _object8, _object9, _object10, _object11, _object12;
+ NamedObject _object13, _object14, _object15, _object16;
+ NamedObject _object17, _object18, _object19;
+ NamedObject _object20, _object21;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+};
+
+class Scene265: public SceneExt {
+ /* Actions */
+ class Action1: public ActionExt {
+ public:
+ virtual void signal();
+ };
+public:
+ Action1 _action1;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+};
+
+class Scene270: public SceneExt {
+ /* Actions */
+ class Action1: public ActionExt {
+ public:
+ virtual void signal();
+ };
+
+ /* Objects */
+ class Lyle: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Grandma: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Item: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Exit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager1, _sequenceManager2, _sequenceManager3;
+ SpeakerGrandma _grandmaSpeaker;
+ SpeakerLyle _lyleSpeaker;
+ SpeakerJake _jakeSpeaker;
+ SpeakerLaura _lauraSpeaker;
+ SpeakerSkip _skipSpeaker;
+ SpeakerGameText _gameTextSpeaker;
+ Action1 _action1;
+ NamedObject _object1, _object2, _object3, _laura;
+ NamedObject _skip, _tv, _fireplace;
+ Lyle _lyle;
+ Grandma _grandma;
+ Item _couch, _afgan;
+ NamedHotspot _appliances;
+ NamedHotspot _ivy, _fridge, _photos, _item8, _item9;
+ NamedHotspot _item10, _item11, _background;
+ Exit _exit;
+ int _field380, _field382, _field384, _field386;
+ int _field219A, _field21A0;
+ Common::Point _tempPos;
+
+ Scene270();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene271: public PalettedScene {
+ /* Actions */
+ class Action1: public ActionExt {
+ public:
+ virtual void signal();
+ };
+
+ /* Objects */
+ class Object12: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Item: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Exit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager1, _sequenceManager2, _sequenceManager3;
+ SpeakerGrandma _grandmaSpeaker;
+ SpeakerLyle _lyleSpeaker;
+ SpeakerJake _jakeSpeaker;
+ SpeakerLaura _lauraSpeaker;
+ SpeakerSkip _skipSpeaker;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerGranText _granTextSpeaker;
+ SpeakerLyleText _lyleTextSpeaker;
+
+ NamedObject _object1, _object2, _object3, _object4, _object5;
+ NamedObject _object6, _object7, _object8, _tv, _object10;
+ NamedObject _object11;
+ Object12 _object12;
+ Item _item1, _item3;
+ NamedHotspot _item2, _item4, _item5, _item6, _item7;
+ NamedHotspot _item8, _item9, _item10, _item11;
+ Exit _exit;
+ Action1 _action1;
+ Rect _rect1;
+ int _field796, _field2E16;
+ Common::Point _tempPos;
+
+ Scene271();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+
+} // End of namespace BlueForce
+
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/blue_force/blueforce_scenes3.cpp b/engines/tsage/blue_force/blueforce_scenes3.cpp
index e49037abf9..6edd6d1aaa 100644
--- a/engines/tsage/blue_force/blueforce_scenes3.cpp
+++ b/engines/tsage/blue_force/blueforce_scenes3.cpp
@@ -36,53 +36,60 @@ namespace BlueForce {
*
*--------------------------------------------------------------------------*/
-void Scene300::Object::startMover(CursorType action) {
+bool Scene300::Object::startAction(CursorType action, Event &event) {
if (action == CURSOR_TALK) {
Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene;
scene->_stripManager.start(_stripNumber, scene);
+ return true;
} else {
- NamedObject::startMover(action);
+ return NamedObject::startAction(action, event);
}
}
-void Scene300::Object17::startMover(CursorType action) {
- if ((action != CURSOR_USE) || !BF_GLOBALS.getFlag(3)) {
- NamedObject::startMover(action);
- } else if ((BF_GLOBALS._v4CEA2 != 2) || (BF_GLOBALS._bikiniHutState >= 12)) {
+bool Scene300::Object19::startAction(CursorType action, Event &event) {
+ if ((action != CURSOR_USE) || !BF_GLOBALS.getFlag(onDuty)) {
+ return NamedObject::startAction(action, event);
+ } else if ((BF_GLOBALS._dayNumber != 2) || (BF_GLOBALS._bookmark >= bEndDayOne)) {
Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene;
setAction(&scene->_action4);
} else {
SceneItem::display2(300, 33);
}
+
+ return true;
}
-void Scene300::Item1::startMover(CursorType action) {
- if (action == CURSOR_TALK) {
+bool Scene300::Item1::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_USE) {
Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene;
BF_GLOBALS._player.disableControl();
scene->_sceneMode = 305;
scene->setAction(&scene->_sequenceManager1, scene, 305, &BF_GLOBALS._player,
&scene->_object8, NULL);
+ return true;
} else {
- NamedHotspot::startMover(action);
+ return NamedHotspot::startAction(action, event);
}
}
-void Scene300::Item2::startMover(CursorType action) {
+bool Scene300::Item2::startAction(CursorType action, Event &event) {
if ((action == CURSOR_LOOK) || (action == CURSOR_USE)) {
Scene300 *scene = (Scene300 *)BF_GLOBALS._sceneManager._scene;
scene->setAction(&scene->_sequenceManager1, scene, 304, &scene->_object11, NULL);
+ return true;
} else {
- NamedHotspot::startMover(action);
+ return NamedHotspot::startAction(action, event);
}
}
-void Scene300::Item14::startMover(CursorType action) {
+bool Scene300::Item14::startAction(CursorType action, Event &event) {
ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 151, 54);
+ return true;
}
-void Scene300::Item15::startMover(CursorType action) {
+bool Scene300::Item15::startAction(CursorType action, Event &event) {
ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 316, 90);
+ return true;
}
/*--------------------------------------------------------------------------*/
@@ -94,14 +101,14 @@ void Scene300::Action1::signal() {
setDelay(1);
break;
case 1:
- if (BF_GLOBALS.getFlag(7))
- SceneItem::display2(300, 0);
- else
+ if (BF_GLOBALS.getFlag(fWithLyle))
SceneItem::display2(666, 27);
+ else
+ SceneItem::display2(300, 0);
setDelay(1);
break;
case 2: {
- ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, BF_GLOBALS._player._position.x - 8,
+ ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, BF_GLOBALS._player._position.x - 8,
BF_GLOBALS._player._position.y);
break;
}
@@ -132,7 +139,7 @@ void Scene300::Action2::signal() {
case 3:
BF_GLOBALS._player.enableControl();
remove();
- break;
+ break;
default:
break;
}
@@ -157,7 +164,7 @@ void Scene300::Action3::signal() {
case 3:
BF_GLOBALS._player.enableControl();
remove();
- break;
+ break;
default:
break;
}
@@ -175,7 +182,7 @@ void Scene300::Action4::signal() {
setAction(&scene->_sequenceManager1, this, 316, &BF_GLOBALS._player, &scene->_object19, NULL);
break;
case 2:
- BF_GLOBALS._sceneManager.changeScene(15);
+ BF_GLOBALS._sceneManager.changeScene(60);
break;
case 3:
setAction(&scene->_sequenceManager1, this, 319, &scene->_object19, NULL);
@@ -183,7 +190,7 @@ void Scene300::Action4::signal() {
case 4:
BF_GLOBALS.setFlag(2);
BF_GLOBALS._sceneManager.changeScene(190);
- break;
+ break;
default:
break;
}
@@ -203,7 +210,6 @@ void Scene300::Action5::signal() {
break;
case 2:
scene->_stripManager.start(3004, this);
- BF_GLOBALS._sceneManager.changeScene(15);
break;
case 3: {
ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 186, 140);
@@ -211,7 +217,7 @@ void Scene300::Action5::signal() {
}
case 4:
remove();
- break;
+ break;
default:
break;
}
@@ -235,8 +241,8 @@ void Scene300::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_jakeSpeaker);
_field2762 = 0;
- _item14.setup(Rect(144, 27, 160, 60), 300, -1, -1, -1, 1, NULL);
- _item15.setup(Rect(310, 76, SCREEN_WIDTH, 105), 300, -1, -1, -1, 1, NULL);
+ _item14.setDetails(Rect(144, 27, 160, 60), 300, -1, -1, -1, 1, NULL);
+ _item15.setDetails(Rect(310, 76, SCREEN_WIDTH, 105), 300, -1, -1, -1, 1, NULL);
// Setup the player
int playerVisage = BF_GLOBALS._player._visage;
@@ -249,28 +255,30 @@ void Scene300::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._player._moveDiff = Common::Point(3, 1);
BF_GLOBALS._player.disableControl();
+ _object8.postInit();
+ _object8.setVisage(301);
_object8.setStrip(2);
_object8.setPosition(Common::Point(300, 77));
- if ((BF_GLOBALS._v4CEA2 != 2) || (BF_GLOBALS._bikiniHutState < 12)) {
+ if ((BF_GLOBALS._dayNumber != 2) || (BF_GLOBALS._bookmark < bEndDayOne)) {
_object17.postInit();
_object17.setVisage(301);
_object17.setStrip(1);
_object17.setPosition(Common::Point(87, 88));
- _object17.setup(300, 11, 13, 2, 1, NULL);
-
+ _object17.setDetails(300, 11, 13, 2, 1, NULL);
+
_object18.postInit();
_object18.setVisage(301);
_object18.setStrip(1);
_object18.setPosition(Common::Point(137, 92));
- _object18.setup(300, 11, 13, 3, 1, NULL);
+ _object18.setDetails(300, 11, 13, 3, 1, NULL);
}
_object19.postInit();
_object19.setVisage(301);
_object19.setStrip(1);
_object19.setPosition(Common::Point(175, 99));
- _object19.setup(300, 11, 13, 34, 1, NULL);
+ _object19.setDetails(300, 11, 13, 34, 1, NULL);
_object11.postInit();
_object11.setVisage(301);
@@ -278,16 +286,11 @@ void Scene300::postInit(SceneObjectList *OwnerList) {
_object11.setPosition(Common::Point(265, 91));
_object11.hide();
- //***DEBUG***
-BF_GLOBALS.setFlag(2);
-BF_GLOBALS._sceneManager._previousScene = 190;
-BF_GLOBALS._player.setVisage(190);
-
switch (BF_GLOBALS._sceneManager._previousScene) {
case 50:
case 60:
- BF_GLOBALS.clearFlag(2);
- if (BF_GLOBALS.getFlag(3)) {
+ BF_GLOBALS.clearFlag(onBike);
+ if (BF_GLOBALS.getFlag(onDuty)) {
BF_GLOBALS._player.disableControl();
_sceneMode = 318;
setAction(&_sequenceManager1, this, 318, &BF_GLOBALS._player, &_object19, NULL);
@@ -304,7 +307,7 @@ BF_GLOBALS._player.setVisage(190);
BF_GLOBALS._player.setPosition(Common::Point(175, 50));
ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, 123, 71);
- if ((BF_GLOBALS._v4CEA2 == 2) && (BF_GLOBALS._bikiniHutState < 12))
+ if ((BF_GLOBALS._dayNumber == 2) && (BF_GLOBALS._bookmark < bEndDayOne))
setup();
} else if (!BF_GLOBALS.getFlag(3)) {
BF_GLOBALS._player.disableControl();
@@ -318,8 +321,8 @@ BF_GLOBALS._player.setVisage(190);
break;
case 315:
BF_GLOBALS._player.setPosition(Common::Point(305, 66));
- if ((BF_GLOBALS._v4CEA2 != 2) || (BF_GLOBALS._bikiniHutState >= 12)) {
- BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(3) ? 1304 : 303);
+ if ((BF_GLOBALS._dayNumber != 2) || (BF_GLOBALS._bookmark >= bEndDayOne)) {
+ BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 1304 : 303);
BF_GLOBALS._player.disableControl();
_sceneMode = 0;
setAction(&_sequenceManager1, this, 306, &BF_GLOBALS._player, &_object8, NULL);
@@ -338,16 +341,30 @@ BF_GLOBALS._player.setVisage(190);
setAction(&_sequenceManager1, this, 306, &BF_GLOBALS._player, &_object8, NULL);
break;
}
+
+ _item10.setDetails(4, 300, 7, 13, 16, 1);
+ _item11.setDetails(2, 300, 9, 13, 18, 1);
+ _item12.setDetails(5, 300, 10, 13, 19, 1);
+ _item13.setDetails(3, 300, 25, 26, 27, 1);
+ _item2.setDetails(Rect(266, 54, 272, 59), 300, -1, -1, -1, 1, NULL);
+ _item1.setDetails(Rect(262, 47, 299, 76), 300, 1, 13, -1, 1, NULL);
+ _item4.setDetails(Rect(0, 85, SCREEN_WIDTH - 1, BF_INTERFACE_Y - 1), 300, 6, 13, 15, 1, NULL);
+ _item7.setDetails(Rect(219, 46, 251, 74), 300, 22, 23, 24, 1, NULL);
+ _item8.setDetails(Rect(301, 53, 319, 78), 300, 22, 23, 24, 1, NULL);
+ _item5.setDetails(Rect(179, 44, 200, 55), 300, 8, 13, 17, 1, NULL);
+ _item6.setDetails(Rect(210, 46, 231, 55), 300, 8, 13, 17, 1, NULL);
+ _item3.setDetails(Rect(160, 0, SCREEN_WIDTH - 1, 75), 300, 4, 13, 14, 1, NULL);
+ _item9.setDetails(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y), 300, 29, 30, 31, 1, NULL);
}
void Scene300::signal() {
switch (_sceneMode) {
case 300:
BF_GLOBALS._sound1.fadeSound(33);
- BF_GLOBALS.clearFlag(2);
+ BF_GLOBALS.clearFlag(onBike);
_sceneMode = 0;
- if ((BF_GLOBALS._v4CEA2 != 1) || (BF_GLOBALS._bikiniHutState != 0)) {
+ if ((BF_GLOBALS._dayNumber != 1) || (BF_GLOBALS._bookmark != bNone)) {
signal();
} else {
_stripManager.start(3005, this);
@@ -373,7 +390,7 @@ void Scene300::signal() {
setAction(&_sequenceManager1, this, 303, &_object13, &_object1, NULL);
break;
case 305:
- if ((BF_GLOBALS._v4CEA2 == 4) || (BF_GLOBALS._v4CEA2 == 5)) {
+ if ((BF_GLOBALS._dayNumber == 4) || (BF_GLOBALS._dayNumber == 5)) {
_sceneMode = 0;
setAction(&_action3);
} else {
@@ -407,7 +424,7 @@ void Scene300::signal() {
BF_GLOBALS._sceneManager.changeScene(60);
break;
case 318:
- BF_GLOBALS.clearFlag(2);
+ BF_GLOBALS.clearFlag(onBike);
_sceneMode = 0;
signal();
break;
@@ -442,7 +459,7 @@ void Scene300::signal() {
_object13.setAction(&_sequenceManager2, NULL, 313, &_object13, &_object17, NULL);
_object14.setAction(&_sequenceManager3, this, 314, &_object14, &_object18, NULL);
- BF_GLOBALS._bikiniHutState = 12;
+ BF_GLOBALS._bookmark = bEndDayOne;
BF_GLOBALS._sound1.changeSound(33);
break;
case 2307:
@@ -456,7 +473,7 @@ void Scene300::signal() {
_object9.hide();
_object10.postInit();
_object10.hide();
-
+
if (BF_GLOBALS.getFlag(1)) {
BF_GLOBALS._player.disableControl();
_sceneMode = 4308;
@@ -504,19 +521,19 @@ void Scene300::signal() {
}
void Scene300::process(Event &event) {
- if ((BF_GLOBALS._player._field8E != 0) && !_eventHandler && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
- Visage visage;
+ SceneExt::process(event);
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ // Check if the cursor is on an exit
if (_item14.contains(event.mousePos)) {
- visage.setVisage(1, 8);
- GfxSurface surface = visage.getFrame(2);
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_NE);
BF_GLOBALS._events.setCursor(surface);
} else if (_item15.contains(event.mousePos)) {
- visage.setVisage(1, 8);
- GfxSurface surface = visage.getFrame(3);
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_E);
BF_GLOBALS._events.setCursor(surface);
} else {
- CursorType cursorId = BF_GLOBALS._events.hideCursor();
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
BF_GLOBALS._events.setCursor(cursorId);
}
}
@@ -525,7 +542,7 @@ void Scene300::process(Event &event) {
void Scene300::dispatch() {
SceneExt::dispatch();
- if (_action) {
+ if (!_action) {
int regionIndex = BF_GLOBALS._player.getRegionIndex();
if ((regionIndex == 1) && (_field2762 == 1)) {
BF_GLOBALS._player.disableControl();
@@ -538,9 +555,22 @@ void Scene300::dispatch() {
BF_GLOBALS._v4CEA4 = 3;
_sceneMode = 6308;
BF_GLOBALS._player.disableControl();
- ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x + 20,
+ ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x + 20,
BF_GLOBALS._player._position.y - 5);
}
+
+ if (BF_GLOBALS._player._position.x <= 5)
+ setAction(&_action2);
+
+ if (BF_GLOBALS._player._position.x >= 315) {
+ if (BF_GLOBALS.getFlag(onDuty) || (BF_GLOBALS._bookmark == bNone) || !BF_GLOBALS.getFlag(fWithLyle)) {
+ setAction(&_action1);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 317;
+ setAction(&_sequenceManager1, this, 1301, &BF_GLOBALS._player, NULL);
+ }
+ }
}
}
@@ -597,6 +627,5291 @@ void Scene300::setup() {
_field2762 = 1;
}
+/*--------------------------------------------------------------------------
+ * Scene 315 - Inside Police Station
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene315::Barry::startAction(CursorType action, Event &event) {
+ Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene;
+ scene->_currentCursor = action;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (scene->_field1B60 || scene->_field1B64)
+ SceneItem::display2(320, 51);
+ else
+ NamedHotspot::startAction(action, event);
+ break;
+ case CURSOR_TALK:
+ if ((BF_GLOBALS._dayNumber == 2) && (BF_GLOBALS._sceneManager._previousScene == 325))
+ NamedHotspot::startAction(action, event);
+ else {
+ if (!BF_GLOBALS.getFlag(onDuty))
+ scene->_stripNumber = 3172;
+ else if (BF_GLOBALS.getFlag(fTalkedToBarry))
+ scene->_stripNumber = 3166;
+ else if (BF_GLOBALS.getFlag(fTalkedToLarry))
+ scene->_stripNumber = 3164;
+ else
+ scene->_stripNumber = 3165;
+
+ scene->setAction(&scene->_action1);
+ BF_GLOBALS.setFlag(fTalkedToBarry);
+ }
+ break;
+ case INV_GREENS_GUN:
+ case INV_GREENS_KNIFE:
+ BF_GLOBALS._player.disableControl();
+ if (BF_INVENTORY._bookingGreen._sceneNumber == 390) {
+ scene->_stripNumber = 3174;
+ scene->setAction(&scene->_action1);
+ } else {
+ ++scene->_field1B62;
+ scene->_stripNumber = (action == INV_GREENS_GUN) ? 3168 : 0;
+ scene->_sceneMode = 3153;
+ scene->setAction(&scene->_sequenceManager, scene, 3153, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ case INV_FOREST_RAP:
+ BF_GLOBALS._player.disableControl();
+ scene->_stripNumber = BF_GLOBALS.getFlag(onDuty) ? 3178 : 3173;
+ scene->setAction(&scene->_action1);
+ break;
+ case INV_GREEN_ID:
+ case INV_FRANKIE_ID:
+ case INV_TYRONE_ID:
+ BF_GLOBALS._player.disableControl();
+ scene->_stripNumber = 3175;
+ scene->setAction(&scene->_action1);
+ break;
+ case INV_BOOKING_GREEN:
+ case INV_BOOKING_FRANKIE:
+ case INV_BOOKING_GANG:
+ BF_GLOBALS._player.disableControl();
+ scene->_stripNumber = 3167;
+ scene->setAction(&scene->_action1);
+ break;
+ case INV_COBB_RAP:
+ if (BF_INVENTORY._mugshot._sceneNumber == 1)
+ NamedHotspot::startAction(action, event);
+ else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3169;
+ if (BF_GLOBALS._dayNumber > 2)
+ scene->_stripNumber = 3176;
+ else if (BF_GLOBALS.getFlag(onDuty))
+ scene->_stripNumber = 3177;
+ else
+ scene->_stripNumber = 3170;
+ scene->setAction(&scene->_action1);
+ }
+ break;
+ case INV_22_BULLET:
+ case INV_AUTO_RIFLE:
+ case INV_WIG:
+ case INV_22_SNUB:
+ BF_GLOBALS._player.disableControl();
+ if ((BF_GLOBALS.getFlag(fCuffedFrankie) && (BF_INVENTORY._bookingFrankie._sceneNumber == 0)) ||
+ (!BF_GLOBALS.getFlag(fCuffedFrankie) && (BF_INVENTORY._bookingGang._sceneNumber == 0))) {
+ scene->_stripNumber = 3174;
+ scene->setAction(&scene->_action1);
+ } else {
+ if (!scene->_field1B6C & (scene->_field1B66 == 1)) {
+ scene->_field1B6C = 1;
+ scene->_stripNumber = 3169;
+ } else {
+ scene->_stripNumber = 0;
+ }
+
+ scene->_sceneMode = 3153;
+ scene->setAction(&scene->_sequenceManager, scene, 3153, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+
+ return true;
+}
+
+bool Scene315::SutterSlot::startAction(CursorType action, Event &event) {
+ Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case INV_GREENS_GUN:
+ case INV_22_BULLET:
+ case INV_AUTO_RIFLE:
+ case INV_WIG:
+ case INV_22_SNUB:
+ SceneItem::display2(315, 30);
+ break;
+ case INV_GREEN_ID:
+ case INV_FRANKIE_ID:
+ case INV_TYRONE_ID:
+ BF_GLOBALS._player.disableControl();
+ scene->_stripNumber = 3175;
+ scene->setAction(&scene->_action1);
+ break;
+ case INV_BOOKING_GREEN:
+ case INV_BOOKING_FRANKIE:
+ case INV_BOOKING_GANG:
+ if (action == INV_BOOKING_GREEN)
+ ++scene->_field1B62;
+ else
+ ++scene->_field1B66;
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 12;
+ scene->setAction(&scene->_sequenceManager, scene, 3154, &BF_GLOBALS._player, NULL);
+ break;
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+
+ return true;
+}
+
+bool Scene315::Sign::startAction(CursorType action, Event &event) {
+ Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_LOOK) {
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.addMover(NULL);
+ scene->_object9.postInit();
+ scene->_object9.hide();
+ scene->_sceneMode = 3167;
+ scene->setAction(&scene->_sequenceManager, scene, 3167, &scene->_object9, this, NULL);
+ return true;
+ } else {
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene315::BulletinBoard::startAction(CursorType action, Event &event) {
+ Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_LOOK) {
+ BF_GLOBALS._player.addMover(NULL);
+ scene->_stripManager.start(3154, &BF_GLOBALS._stripProxy);
+ return true;
+ } else {
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene315::CleaningKit::startAction(CursorType action, Event &event) {
+ Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene;
+
+ if ((action == INV_COLT45) && BF_GLOBALS.getFlag(onDuty)) {
+ if (!BF_GLOBALS.getFlag(onDuty))
+ SceneItem::display2(315, 27);
+ else if (BF_GLOBALS.getHasBullets()) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3162;
+ scene->setAction(&scene->_sequenceManager, scene, 3162, &BF_GLOBALS._player, NULL);
+ } else if (BF_GLOBALS.getFlag(fGunLoaded))
+ SceneItem::display2(315, 46);
+ else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3159;
+ scene->setAction(&scene->_sequenceManager, scene, 3159, &BF_GLOBALS._player, NULL);
+ }
+ return true;
+ } else {
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene315::BriefingMaterial::startAction(CursorType action, Event &event) {
+ Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action != CURSOR_USE)
+ return NamedHotspot::startAction(action, event);
+ else if (BF_INVENTORY._forestRap._sceneNumber == 1) {
+ SceneItem::display2(315, 37);
+ return true;
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3158;
+ scene->setAction(&scene->_sequenceManager, scene, 3158, &BF_GLOBALS._player, NULL);
+ return true;
+ }
+}
+
+bool Scene315::WestExit::startAction(CursorType action, Event &event) {
+ ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 190, 75);
+ return true;
+}
+
+bool Scene315::SouthWestExit::startAction(CursorType action, Event &event) {
+ ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, event.mousePos.x, event.mousePos.y);
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene315::BulletinMemo::startAction(CursorType action, Event &event) {
+ Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ scene->_stripManager.start(3157, &BF_GLOBALS._stripProxy);
+ return true;
+ case CURSOR_USE:
+ if (!BF_GLOBALS.getFlag(fGotPointsForCleaningGun)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ BF_GLOBALS.setFlag(fGotPointsForCleaningGun);
+ }
+ BF_GLOBALS._player.addMover(NULL);
+ scene->_stripManager.start(3159, &BF_GLOBALS._stripProxy);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ break;
+ }
+}
+
+bool Scene315::Object2::startAction(CursorType action, Event &event) {
+ Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ BF_GLOBALS._player.disableControl();
+ scene->_object9.postInit();
+ scene->_object9.hide();
+ scene->_sceneMode = 3157;
+ scene->setAction(&scene->_sequenceManager, scene, 3157, &BF_GLOBALS._player, &scene->_object9, NULL);
+ return true;
+ case CURSOR_USE:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3156;
+ scene->setAction(&scene->_sequenceManager, scene, BF_GLOBALS.getFlag(onDuty) ? 3156 : 3168,
+ &BF_GLOBALS._player, this, NULL);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene315::ATFMemo::startAction(CursorType action, Event &event) {
+ Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ BF_GLOBALS._player.addMover(NULL);
+ scene->_stripManager.start(3156, &BF_GLOBALS._stripProxy);
+ return true;
+ case CURSOR_USE:
+ if (!BF_GLOBALS.getFlag(fGotPointsForMemo)) {
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForMemo);
+ }
+
+ BF_GLOBALS._player.addMover(NULL);
+ scene->_stripManager.start(3158, &BF_GLOBALS._stripProxy);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene315::Action1::signal() {
+ Scene315 *scene = (Scene315 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, 128, 128);
+ break;
+ case 1:
+ BF_GLOBALS._player.changeAngle(315);
+ setDelay(2);
+ break;
+ case 2:
+ scene->_stripManager.start(scene->_stripNumber, this);
+ break;
+ case 3:
+ if (scene->_sceneMode == 3169) {
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_INVENTORY.setObjectScene(INV_MUG_SHOT, 1);
+ }
+
+ remove();
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene315::Scene315() {
+ BF_GLOBALS._v51C44 = 1;
+ _field1B6C = _field139C = 0;
+ if (BF_GLOBALS._dayNumber == 0)
+ BF_GLOBALS._dayNumber = 1;
+
+ BF_GLOBALS.clearFlag(fCanDrawGun);
+ _field1B68 = true;
+ _field1B6A = false;
+ _field1B60 = _field1B62 = 0;
+ _field1B64 = _field1B66 = 0;
+}
+
+void Scene315::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+
+ s.syncAsSint16LE(_field1390);
+ s.syncAsSint16LE(_stripNumber);
+ s.syncAsSint16LE(_field1398);
+ s.syncAsSint16LE(_field1B60);
+ s.syncAsSint16LE(_field1B62);
+ s.syncAsSint16LE(_field1B64);
+ s.syncAsSint16LE(_field1B66);
+ s.syncAsSint16LE(_field1B6C);
+ s.syncAsSint16LE(_field139C);
+ s.syncAsByte(_field1B68);
+ s.syncAsByte(_field1B6A);
+ s.syncAsSint16LE(_currentCursor);
+}
+
+void Scene315::postInit(SceneObjectList *OwnerList) {
+ loadScene(315);
+
+ if (BF_GLOBALS._sceneManager._previousScene != 325)
+ BF_GLOBALS._sound1.fadeSound(11);
+
+ setZoomPercents(67, 72, 124, 100);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_sutterSpeaker);
+ _stripManager.addSpeaker(&_harrisonSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ _stripManager.addSpeaker(&_jakeUniformSpeaker);
+ _stripManager.addSpeaker(&_jailerSpeaker);
+
+ _object8.postInit();
+ _object8.setVisage(315);
+ _object8.setPosition(Common::Point(272, 69));
+
+ if (BF_GLOBALS._bookmark >= bLauraToParamedics) {
+ _atfMemo.postInit();
+ _atfMemo.setVisage(315);
+ _atfMemo.setPosition(Common::Point(167, 53));
+ _atfMemo.setStrip(4);
+ _atfMemo.setFrame(4);
+ _atfMemo.fixPriority(82);
+ _atfMemo.setDetails(315, -1, -1, -1, 1, NULL);
+ }
+
+ if (BF_GLOBALS._dayNumber == 1) {
+ if (BF_GLOBALS._bookmark >= bLauraToParamedics) {
+ _bulletinMemo.postInit();
+ _bulletinMemo.setVisage(315);
+ _bulletinMemo.setPosition(Common::Point(156, 51));
+ _bulletinMemo.setStrip(4);
+ _bulletinMemo.setFrame(2);
+ _bulletinMemo.fixPriority(82);
+ _bulletinMemo.setDetails(315, -1, -1, -1, 1, NULL);
+ }
+ } else if ((BF_INVENTORY._daNote._sceneNumber != 1) && (BF_GLOBALS._dayNumber < 3)) {
+ _object2.postInit();
+ _object2.setVisage(315);
+ _object2.setStrip(3);
+ _object2.setFrame(2);
+ _object2.setPosition(Common::Point(304, 31));
+ _object2.fixPriority(70);
+ _object2.setDetails(315, 3, 4, -1, 1, NULL);
+ }
+
+ _sutterSlot.setDetails(12, 315, 35, -1, 36, 1);
+ _bulletinBoard.setDetails(3, 315, -1, -1, -1, 1);
+ _barry.setDetails(4, 315, 10, 11, 12, 1);
+ _item3.setDetails(2, 315, 0, 1, 2, 1);
+ _sign.setDetails(Rect(190, 17, 208, 30), 315, -1, -1, -1, 1, NULL);
+ _westExit.setDetails(Rect(184, 31, 211, 80), 315, -1, -1, -1, 1, NULL);
+ _swExit.setDetails(Rect(0, 157, 190, 167), 315, -1, -1, -1, 1, NULL);
+
+ if (!BF_GLOBALS.getFlag(onDuty) && ((BF_GLOBALS._bookmark == bNone) || (BF_GLOBALS._bookmark == bLyleStoppedBy))) {
+ _field1398 = 1;
+ BF_GLOBALS.setFlag(onDuty);
+ } else {
+ _field1398 = 0;
+ }
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.disableControl();
+
+ if ((BF_GLOBALS._dayNumber != 2) || (BF_GLOBALS._sceneManager._previousScene != 325)) {
+ _object4.postInit();
+ _object4.setVisage(316);
+ _object4.setPosition(Common::Point(99, 82));
+ _object4.fixPriority(95);
+
+ _object5.postInit();
+ _object5.setVisage(395);
+ _object5.setStrip(2);
+ _object5.setPosition(Common::Point(96, 86));
+ }
+
+ // Set up evidence objects in inventory
+ if (BF_INVENTORY._bookingGreen.inInventory())
+ ++_field1B60;
+ if (BF_INVENTORY._greensGun.inInventory())
+ ++_field1B60;
+ if (BF_INVENTORY._greensKnife.inInventory())
+ ++_field1B60;
+
+ if (BF_INVENTORY._bullet22.inInventory())
+ ++_field1B64;
+ if (BF_INVENTORY._autoRifle.inInventory())
+ ++_field1B64;
+ if (BF_INVENTORY._wig.inInventory())
+ ++_field1B64;
+ if (BF_INVENTORY._bookingFrankie.inInventory())
+ ++_field1B64;
+ if (BF_INVENTORY._bookingGang.inInventory())
+ ++_field1B64;
+ if (BF_INVENTORY._snub22.inInventory())
+ ++_field1B64;
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 190:
+ if (_field1398)
+ _field1B6A = true;
+ _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 3150 : 3165;
+ setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, NULL);
+ break;
+ case 325:
+ BF_GLOBALS._uiElements._active = false;
+ _object6.postInit();
+ _object7.postInit();
+ _object8.setFrame(8);
+ _sceneMode = (BF_GLOBALS._dayNumber == 1) ? 3152 : 3155;
+ setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, &_object6,
+ &_object7, &_object8, NULL);
+ break;
+ case 300:
+ default:
+ if (_field1398)
+ _field1B6A = true;
+ if (!BF_GLOBALS.getFlag(onDuty))
+ _sceneMode = 3166;
+ else if (!_field1398)
+ _sceneMode = 3164;
+ else
+ _sceneMode = 3163;
+
+ setAction(&_sequenceManager, this, _sceneMode, &BF_GLOBALS._player, NULL);
+ break;
+ }
+
+ if (_field1B6A) {
+ _object8.setFrame(8);
+ } else {
+ BF_GLOBALS._walkRegions.proc1(4);
+ }
+
+ _briefingMaterial.setDetails(24, 315, 38, 39, 40, 1);
+ _cleaningKit.setDetails(14, 315, 24, 25, 26, 1);
+ _item7.setDetails(5, 315, 8, 9, -1, 1);
+ _item6.setDetails(6, 315, 5, 6, 7, 1);
+ _item10.setDetails(8, 315, 13, -1, -1, 1);
+ _item11.setDetails(9, 315, 14, -1, -1, 1);
+ _item8.setDetails(7, 315, 15, 16, 17, 1);
+ _item9.setDetails(10, 315, 18, 19, 20, 1);
+}
+
+void Scene315::signal() {
+ int ctr = 0;
+
+ switch (_sceneMode) {
+ case 0:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 10:
+ if (_field1B62) {
+ if (_field1B62 >= _field1B60)
+ BF_GLOBALS.setFlag(fLeftTraceIn910);
+ else
+ ++ctr;
+ }
+
+ if (_field1B66) {
+ if (_field1B66 < _field1B64)
+ ++ctr;
+ else if (BF_GLOBALS._bookmark < bBookedFrankieEvidence)
+ BF_GLOBALS._bookmark = bBookedFrankieEvidence;
+ }
+
+ if (ctr) {
+ BF_GLOBALS._deathReason = 20;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ } else {
+ BF_GLOBALS._sceneManager.changeScene(300);
+ }
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ break;
+ case 11:
+ if (_field1B62) {
+ if (_field1B62 >= _field1B60)
+ BF_GLOBALS.setFlag(fLeftTraceIn910);
+ else
+ ++ctr;
+ }
+
+ if (_field1B66) {
+ if (_field1B66 < _field1B64)
+ ++ctr;
+ else if (BF_GLOBALS._bookmark < bBookedFrankie)
+ BF_GLOBALS._bookmark = bBookedFrankie;
+ else if (BF_GLOBALS._bookmark < bBookedFrankieEvidence)
+ BF_GLOBALS._bookmark = bBookedFrankie;
+ }
+
+ if (ctr == 1) {
+ BF_GLOBALS._deathReason = 20;
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ } else if ((BF_GLOBALS._bookmark != bBookedFrankie) || !BF_GLOBALS.getFlag(onDuty)) {
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(190);
+ } else {
+ BF_GLOBALS._bookmark = bBookedFrankieEvidence;
+ _field139C = 0;
+ BF_GLOBALS.clearFlag(onDuty);
+ BF_INVENTORY.setObjectScene(INV_TICKET_BOOK, 60);
+ BF_INVENTORY.setObjectScene(INV_MIRANDA_CARD, 60);
+ _sceneMode = 3165;
+ setAction(&_sequenceManager, this, 3165, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ case 12:
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_INVENTORY.setObjectScene((int)_currentCursor, 315);
+
+ if (!_field1B64 || (_field1B66 != _field1B64))
+ BF_GLOBALS._player.enableControl();
+ else {
+ _field139C = 1;
+ _stripNumber = 3171;
+ setAction(&_action1);
+ }
+ break;
+ case 3150:
+ case 3164:
+ case 3165:
+ case 3166:
+ BF_GLOBALS._player.enableControl();
+ _field1B68 = false;
+ break;
+ case 3151:
+ BF_GLOBALS._sceneManager.changeScene(325);
+ break;
+ case 3152:
+ BF_GLOBALS._walkRegions.proc1(4);
+ _object7.remove();
+ _object6.remove();
+
+ BF_GLOBALS._player.enableControl();
+ _field1B68 = false;
+ BF_GLOBALS._walkRegions.proc1(4);
+ BF_GLOBALS._uiElements._active = true;
+ BF_GLOBALS._uiElements.show();
+ break;
+ case 3153:
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_INVENTORY.setObjectScene((int)_currentCursor, 315);
+
+ if (_stripNumber != 0)
+ setAction(&_action1);
+ else if (!_field1B64 || (_field1B66 != _field1B64))
+ BF_GLOBALS._player.enableControl();
+ else {
+ _stripNumber = 3171;
+ setAction(&_action1);
+ _field139C = 1;
+ }
+ break;
+ case 3155:
+ BF_GLOBALS._player.enableControl();
+ _field1B68 = false;
+ BF_GLOBALS._walkRegions.proc1(4);
+ BF_GLOBALS._uiElements._active = true;
+ BF_GLOBALS._uiElements.show();
+ break;
+ case 3156:
+ BF_GLOBALS._uiElements.addScore(10);
+ BF_INVENTORY.setObjectScene(INV_DA_NOTE, 1);
+ _object2.remove();
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 3157:
+ BF_GLOBALS._player.enableControl();
+ _object9.remove();
+ break;
+ case 3158:
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._uiElements.addScore(10);
+ BF_INVENTORY.setObjectScene(INV_FOREST_RAP, 1);
+ break;
+ case 3159:
+ if (!BF_GLOBALS.getFlag(fBookedGreenEvidence)) {
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fBookedGreenEvidence);
+ }
+ BF_GLOBALS.setFlag(gunClean);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 3161:
+ BF_GLOBALS._deathReason = 21;
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 3162:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 3161;
+ setAction(&_sequenceManager, this, 3161, &BF_GLOBALS._player, NULL);
+ BF_GLOBALS.setFlag(fShotSuttersDesk);
+ break;
+ case 3163:
+ _sceneMode = 3150;
+ setAction(&_sequenceManager, this, 3150, &BF_GLOBALS._player, NULL);
+ break;
+ case 3167:
+ BF_GLOBALS._player.enableControl();
+ _object9.remove();
+ break;
+ case 3154:
+ default:
+ break;
+ }
+}
+
+void Scene315::process(Event &event) {
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ // Check if the cursor is on an exit
+ if (_swExit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
+ BF_GLOBALS._events.setCursor(surface);
+ } else if ((BF_GLOBALS._bookmark != bBookedFrankie) && _westExit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_W);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+}
+
+void Scene315::dispatch() {
+ SceneExt::dispatch();
+
+ if (_field1B68)
+ return;
+
+ if (_field1B6A) {
+ if (BF_GLOBALS._player._position.y < 69) {
+ BF_GLOBALS._player.disableControl();
+ _field1B68 = true;
+ _sceneMode = 3151;
+ setAction(&_sequenceManager, this, 3151, &BF_GLOBALS._player, NULL);
+ } else if (BF_GLOBALS._player.getRegionIndex() == 1) {
+ BF_GLOBALS._player.disableControl();
+ _field1B68 = true;
+ SceneItem::display2(315, 28);
+ _sceneMode = 3150;
+ ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x + 30,
+ BF_GLOBALS._player._position.y + 15);
+ } else if (BF_GLOBALS._player._position.y > 156) {
+ BF_GLOBALS._player.disableControl();
+ _field1B68 = true;
+ SceneItem::display2(315, 28);
+ _sceneMode = 3150;
+ ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x + 30,
+ BF_GLOBALS._player._position.y - 24);
+ }
+ } else if (BF_GLOBALS._player.getRegionIndex() == 1) {
+ BF_GLOBALS._player.disableControl();
+ _field1B68 = true;
+ _sceneMode = 11;
+ ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x - 30,
+ BF_GLOBALS._player._position.y - 5);
+ } else if (BF_GLOBALS._player._position.y > 156) {
+ BF_GLOBALS._player.disableControl();
+ _field1B68 = true;
+
+ if (_field139C) {
+ SceneItem::display2(315, 45);
+ _sceneMode = 3150;
+ ADD_MOVER(BF_GLOBALS._player, 112, 152);
+ } else {
+ _sceneMode = 10;
+ ADD_MOVER(BF_GLOBALS._player, BF_GLOBALS._player._position.x - 150,
+ BF_GLOBALS._player._position.y + 120);
+ }
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 325 - Police Station Conference Room
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene325::Item1::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_EXIT) {
+ BF_GLOBALS._events.setCursor(CURSOR_WALK);
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._sceneManager.changeScene(315);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene325::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(325);
+ BF_GLOBALS._interfaceY = 200;
+ BF_GLOBALS.clearFlag(fCanDrawGun);
+
+ if (BF_GLOBALS._dayNumber == 0)
+ BF_GLOBALS._dayNumber = 1;
+
+ // Add the speakers
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_PSutterSpeaker);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.hide();
+
+ if (BF_GLOBALS._dayNumber == 1) {
+ _object1.postInit();
+ _object1.setVisage(325);
+ _object1.setStrip(8);
+ _object1.setPosition(Common::Point(128, 44));
+ } else {
+ _object1.postInit();
+ _object1.setVisage(325);
+ _object1.setStrip(8);
+ _object1.setFrame(2);
+ _object1.setPosition(Common::Point(132, 28));
+
+ _object2.postInit();
+ _object2.setVisage(325);
+ _object2.setStrip(8);
+ _object2.setFrame(3);
+ _object2.setPosition(Common::Point(270, 24));
+ }
+
+ _object3.postInit();
+ _object3.setVisage(335);
+ _object3.setStrip(4);
+ _object3.setPosition(Common::Point(202, 122));
+
+ _object4.postInit();
+ _object4.setVisage(335);
+ _object4.setStrip(2);
+ _object4.setPosition(Common::Point(283, 102));
+
+ _object5.postInit();
+ _object5.setVisage(335);
+ _object5.setStrip(1);
+ _object5.setPosition(Common::Point(135, 167));
+
+ _item1.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 560, -1, -1, -1, 1, NULL);
+ BF_GLOBALS._player.disableControl();
+
+ _sceneMode = (BF_GLOBALS._dayNumber == 1) ? 3250 : 3251;
+ setAction(&_sequenceManager, this, _sceneMode, &_object3, &_object4, &_object5, NULL);
+}
+
+void Scene325::signal() {
+ BF_GLOBALS._player._uiEnabled = 0;
+ BF_GLOBALS._player._canWalk = true;
+ BF_GLOBALS._player._enabled = true;
+ BF_GLOBALS._events.setCursor(CURSOR_EXIT);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 330 - Approaching Marina
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene330::Timer1::signal() {
+ PaletteRotation *rotation = BF_GLOBALS._scenePalette.addRotation(240, 254, 1);
+ rotation->setDelay(25);
+ remove();
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene330::Scene330() {
+ _seqNumber = 0;
+}
+
+void Scene330::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_seqNumber);
+}
+
+void Scene330::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ BF_GLOBALS._sound1.changeSound(35);
+ _sound1.fadeSound(35);
+
+ loadScene(850);
+ _timer.set(2, NULL);
+
+ if (BF_GLOBALS._dayNumber >= 4) {
+ _object2.postInit();
+ _object2.setVisage(851);
+ _object2.setPosition(Common::Point(120, 112));
+ }
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 850 : 852);
+ BF_GLOBALS._player.setStrip(2);
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player.hide();
+ if (BF_GLOBALS.getFlag(fWithLyle))
+ BF_GLOBALS._player.setStrip(5);
+
+ if ((BF_GLOBALS._dayNumber == 1) && BF_GLOBALS.getFlag(fBackupArrived340)) {
+ _object1.postInit();
+ _object1.setVisage(850);
+ _object1.setStrip(6);
+ _object1.setFrame(1);
+ _object1.setPosition(Common::Point(47, 169));
+ _object1.animate(ANIM_MODE_2);
+ }
+
+ if (BF_GLOBALS._sceneManager._previousScene == 50) {
+ // Coming from map
+ if ((BF_GLOBALS._driveFromScene == 340) || (BF_GLOBALS._driveFromScene == 342) ||
+ (BF_GLOBALS._driveFromScene == 330)) {
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _seqNumber = 3304;
+ } else {
+ _seqNumber = 3302;
+ _sound2.play(123);
+ BF_GLOBALS.setFlag(onBike);
+ }
+ } else if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _seqNumber = 3303;
+ } else {
+ _sound2.play(123);
+ _seqNumber = 3301;
+
+ if ((BF_GLOBALS._dayNumber == 1) && (BF_GLOBALS._bookmark >= bStartOfGame) &&
+ (BF_GLOBALS._bookmark < bCalledToDomesticViolence)) {
+ BF_GLOBALS._player.animate(ANIM_MODE_2);
+ }
+ }
+ } else if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _seqNumber = 3303;
+ } else {
+ _seqNumber = 3301;
+ _sound2.play(123);
+
+ if ((BF_GLOBALS._dayNumber == 1) && (BF_GLOBALS._bookmark >= bStartOfGame) &&
+ (BF_GLOBALS._bookmark < bCalledToDomesticViolence)) {
+ BF_GLOBALS._player.animate(ANIM_MODE_2);
+ }
+ }
+
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager, this, _seqNumber, &BF_GLOBALS._player, NULL);
+}
+
+void Scene330::remove() {
+ BF_GLOBALS._scenePalette.clearListeners();
+ SceneExt::remove();
+}
+
+void Scene330::signal() {
+ if ((BF_GLOBALS._driveFromScene == 330) || (BF_GLOBALS._driveFromScene == 340) ||
+ (BF_GLOBALS._driveFromScene == 342)) {
+ // Leaving marina
+ if ((BF_GLOBALS._dayNumber != 1) || (BF_GLOBALS._bookmark < bStartOfGame) ||
+ (BF_GLOBALS._bookmark >= bCalledToDomesticViolence))
+ // Leave scene normally
+ BF_GLOBALS._sceneManager.changeScene(BF_GLOBALS._driveToScene);
+ else {
+ // Player leaves with domestic violence unresolved
+ BF_GLOBALS._player.hide();
+ BF_GLOBALS._deathReason = 4;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ }
+ } else {
+ // Arriving at marina
+ BF_GLOBALS.clearFlag(onBike);
+
+ if ((BF_GLOBALS._dayNumber != 1) || (BF_GLOBALS._bookmark < bStartOfGame) ||
+ (BF_GLOBALS._bookmark >= bCalledToDomesticViolence))
+ BF_GLOBALS._sceneManager.changeScene(342);
+ else
+ BF_GLOBALS._sceneManager.changeScene(340);
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 340 - Marina, Domestic Disturbance
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene340::Child::startAction(CursorType action, Event &event) {
+ Scene340 *scene = (Scene340 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(340, 5);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(340, 14);
+ return true;
+ case CURSOR_TALK:
+ if (!BF_GLOBALS.getFlag(fBackupArrived340) || (BF_GLOBALS._marinaWomanCtr < 3) || !BF_GLOBALS.getFlag(fGotAllSkip340))
+ scene->setAction(&scene->_action3);
+ else
+ scene->setAction(&scene->_action2);
+ return true;
+ case INV_COLT45:
+ scene->gunDisplay();
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ break;
+ }
+}
+
+bool Scene340::Woman::startAction(CursorType action, Event &event) {
+ Scene340 *scene = (Scene340 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(340, 4);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(340, 13);
+ return true;
+ case CURSOR_TALK:
+ if (!BF_GLOBALS.getFlag(fBackupArrived340) || (BF_GLOBALS._marinaWomanCtr < 3) || !BF_GLOBALS.getFlag(fGotAllSkip340))
+ scene->setAction(&scene->_action1);
+ else
+ scene->setAction(&scene->_action2);
+ return true;
+ case INV_COLT45:
+ scene->gunDisplay();
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ break;
+ }
+}
+
+bool Scene340::Harrison::startAction(CursorType action, Event &event) {
+ Scene340 *scene = (Scene340 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(340, 6);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(340, 15);
+ return true;
+ case CURSOR_TALK:
+ scene->setAction(&scene->_action5);
+ return true;
+ case INV_COLT45:
+ scene->gunDisplay();
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ break;
+ }
+}
+
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene340::Item1::startAction(CursorType action, Event &event) {
+ Scene340 *scene = (Scene340 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == INV_COLT45) {
+ scene->gunDisplay();
+ return true;
+ } else {
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene340::WestExit::startAction(CursorType action, Event &event) {
+ Scene340 *scene = (Scene340 *)BF_GLOBALS._sceneManager._scene;
+
+ if (BF_GLOBALS.getFlag(fBackupArrived340)) {
+ scene->setAction(&scene->_action6);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 4;
+ setAction(&scene->_sequenceManager1, scene, 1348, &BF_GLOBALS._player, NULL);
+ }
+ return true;
+}
+
+bool Scene340::SouthWestExit::startAction(CursorType action, Event &event) {
+ Scene340 *scene = (Scene340 *)BF_GLOBALS._sceneManager._scene;
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3;
+ setAction(&scene->_sequenceManager1, scene, 1340, &BF_GLOBALS._player, NULL);
+ return true;
+}
+
+bool Scene340::NorthExit::startAction(CursorType action, Event &event) {
+ ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 254, 106);
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene340::Action1::signal() {
+ Scene340 *scene = (Scene340 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ BF_GLOBALS._player.disableControl();
+ ADD_PLAYER_MOVER(64, 155);
+ break;
+ }
+ case 1:
+ BF_GLOBALS._player.changeAngle(45);
+ setDelay(3);
+ break;
+ case 2:
+ if (!BF_GLOBALS._marinaWomanCtr) {
+ setAction(&scene->_action8, this);
+ } else if (!_action) {
+ BF_GLOBALS._player.setAction(&scene->_sequenceManager1, this,
+ MIN(BF_GLOBALS._marinaWomanCtr, 3) + 2340, &scene->_woman, &scene->_child,
+ &scene->_object4, NULL);
+ }
+ break;
+ case 3:
+ if ((BF_GLOBALS._marinaWomanCtr != 1) || BF_GLOBALS.getFlag(fCalledBackup)) {
+ setDelay(3);
+ } else {
+ scene->_sound1.play(8);
+ scene->_stripManager.start(3413, this);
+ }
+ break;
+ case 4:
+ if (BF_GLOBALS._marinaWomanCtr == 1)
+ ++BF_GLOBALS._marinaWomanCtr;
+
+ if (BF_GLOBALS.getFlag(fBackupArrived340)) {
+ scene->_field2654 = 1;
+ scene->_harrison.setPosition(Common::Point(46, 154));
+ BF_GLOBALS._walkRegions.proc1(19);
+ } else if (BF_GLOBALS.getFlag(fCalledBackup)) {
+ scene->_timer1.set(40, &scene->_harrison, &scene->_action4);
+ }
+
+ ++BF_GLOBALS._marinaWomanCtr;
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ }
+}
+
+void Scene340::Action2::signal() {
+ Scene340 *scene = (Scene340 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ ADD_PLAYER_MOVER(64, 155);
+ break;
+ }
+ case 1:
+ BF_GLOBALS._player.changeAngle(45);
+ setDelay(3);
+ break;
+ case 2:
+ BF_GLOBALS._player.setAction(&scene->_sequenceManager3, this, 1341, &scene->_woman, &scene->_child, NULL);
+ break;
+ case 3:
+ scene->_woman.remove();
+ scene->_child.remove();
+ BF_GLOBALS.setFlag(fToldToLeave340);
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ }
+}
+
+void Scene340::Action3::signal() {
+ Scene340 *scene = (Scene340 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ ADD_PLAYER_MOVER(64, 155);
+ break;
+ }
+ case 1:
+ BF_GLOBALS._player.changeAngle(45);
+ setDelay(3);
+ break;
+ case 2:
+ scene->_stripManager.start(scene->_field2652 + 3404, this);
+ break;
+ case 3:
+ if (++scene->_field2652 > 2) {
+ if (!BF_GLOBALS.getFlag(fGotAllSkip340))
+ BF_GLOBALS.setFlag(fGotAllSkip340);
+ scene->_field2652 = 0;
+ }
+
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ }
+}
+
+void Scene340::Action4::signal() {
+ Scene340 *scene = (Scene340 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ if (!_action) {
+ BF_GLOBALS._player.disableControl();
+ setDelay(3);
+ } else {
+ scene->_timer1.set(30, &scene->_harrison, &scene->_action4);
+ remove();
+ }
+ break;
+ case 1:
+ BF_GLOBALS.setFlag(fBackupArrived340);
+ scene->_field2654 = 1;
+ setDelay(3);
+ break;
+ case 2:
+ BF_GLOBALS._player.setAction(&scene->_sequenceManager3, this, 1347, &scene->_harrison, NULL);
+ break;
+ case 3:
+ BF_GLOBALS._walkRegions.proc1(19);
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ }
+}
+
+void Scene340::Action5::signal() {
+ Scene340 *scene = (Scene340 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ if (scene->_field2654) {
+ ADD_PLAYER_MOVER(64, 155);
+ } else {
+ BF_GLOBALS._player.changeAngle(45);
+ setDelay(3);
+ }
+ break;
+ case 1:
+ BF_GLOBALS._player.updateAngle(scene->_harrison._position);
+ setDelay(3);
+ break;
+ case 2:
+ setDelay(15);
+ break;
+ case 3:
+ if (BF_GLOBALS.getFlag(fBriefedBackup))
+ scene->_stripManager.start(3416, this);
+ else {
+ BF_GLOBALS.setFlag(fBriefedBackup);
+ scene->_stripManager.start(3407, this);
+ }
+ break;
+ case 4:
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ }
+}
+
+void Scene340::Action6::signal() {
+ Scene340 *scene = (Scene340 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ ADD_PLAYER_MOVER(10, 110);
+ break;
+ case 1:
+ BF_GLOBALS._player.updateAngle(scene->_harrison._position);
+ scene->_harrison.updateAngle(BF_GLOBALS._player._position);
+ scene->_stripManager.start(3415, this);
+ break;
+ case 2: {
+ ADD_MOVER(BF_GLOBALS._player, -8, 110);
+ break;
+ }
+ case 3:
+ scene->_sceneMode = 4;
+ scene->signal();
+ remove();
+ break;
+ }
+}
+
+void Scene340::Action7::signal() {
+ Scene340 *scene = (Scene340 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ ADD_PLAYER_MOVER(254, 121);
+ break;
+ case 1:
+ BF_GLOBALS._player.updateAngle(scene->_harrison._position);
+ scene->_stripManager.start(BF_GLOBALS.getFlag(fBriefedBackup) ? 3414 : 3417, this);
+ break;
+ case 2:
+ BF_GLOBALS.setFlag(fBackupIn350);
+ BF_GLOBALS._sceneManager.changeScene(350);
+ break;
+ }
+}
+
+void Scene340::Action8::signal() {
+ Scene340 *scene = (Scene340 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->_stripManager.start(3400, this);
+ break;
+ case 1:
+ setDelay(2);
+ break;
+ case 2:
+ scene->_object4.setPriority(250);
+ scene->_object4.setPosition(Common::Point(138, 130));
+ scene->_object4.setVisage(347);
+ scene->_object4.setStrip(6);
+ scene->_object4.setFrame(1);
+ scene->_object4._numFrames = 2;
+ scene->_object4.animate(ANIM_MODE_5, NULL);
+ scene->_object4.show();
+ break;
+ case 3:
+ scene->_object4.hide();
+
+ scene->_woman.setPriority(123);
+ scene->_woman.setPosition(Common::Point(88, 143));
+ scene->_woman.setVisage(344);
+ scene->_woman.setStrip(2);
+ scene->_woman.setFrame(1);
+ scene->_woman.changeZoom(100);
+ scene->_woman._numFrames = 10;
+ scene->_woman._moveRate = 10;
+ scene->_woman._moveDiff = Common::Point(3, 2);
+ scene->_woman.show();
+
+ scene->_child.setPriority(120);
+ scene->_child.setPosition(Common::Point(81, 143));
+ scene->_child.setVisage(347);
+ scene->_child.setStrip(3);
+ scene->_child.setFrame(1);
+ scene->_child.changeZoom(100);
+ scene->_child._numFrames = 10;
+ scene->_child._moveRate = 10;
+ scene->_child.show();
+
+ setDelay(6);
+ break;
+ case 4:
+ remove();
+ break;
+ }
+}
+
+void Scene340::Action8::process(Event &event) {
+ if ((_actionIndex != 3) || (event.eventType == EVENT_NONE))
+ Action::process(event);
+ else if (event.eventType == EVENT_BUTTON_DOWN) {
+ event.handled = true;
+ setDelay(2);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene340::Timer2::signal() {
+ PaletteRotation *item;
+
+ item = BF_GLOBALS._scenePalette.addRotation(235, 239, 1);
+ item->setDelay(30);
+ item = BF_GLOBALS._scenePalette.addRotation(247, 249, 1);
+ item->setDelay(30);
+ item = BF_GLOBALS._scenePalette.addRotation(240, 246, 1);
+ item->setDelay(30);
+ item = BF_GLOBALS._scenePalette.addRotation(252, 254, 1);
+ item->setDelay(30);
+
+ remove();
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene340::Scene340(): PalettedScene() {
+ _seqNumber1 = _field2652 = _field2654 = 0;
+}
+
+void Scene340::synchronize(Serializer &s) {
+ PalettedScene::synchronize(s);
+
+ s.syncAsSint16LE(_seqNumber1);
+ s.syncAsSint16LE(_field2652);
+ s.syncAsSint16LE(_field2654);
+}
+
+void Scene340::postInit(SceneObjectList *OwnerList) {
+ PalettedScene::postInit();
+ loadScene(340);
+ setZoomPercents(126, 70, 162, 100);
+
+ BF_GLOBALS._walkRegions.proc1(13);
+ BF_GLOBALS._walkRegions.proc1(15);
+ _timer2.set(2, NULL);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeUniformSpeaker);
+
+ _field2652 = 0;
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+
+ _westExit.setDetails(Rect(0, 76, 19, 115), 340, -1, -1, -1, 1, NULL);
+ _swExit.setDetails(15, 340, -1, -1, -1, 1);
+ _northExit.setDetails(16, 340, -1, -1, -1, 1);
+
+ BF_GLOBALS._player._regionBitList = 0x10000;
+ BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 1341 : 129);
+ BF_GLOBALS._player._moveDiff = Common::Point(5, 2);
+
+ if (BF_GLOBALS._dayNumber < 5) {
+ _object5.postInit();
+ _object5.setVisage(340);
+ _object5.setStrip(4);
+ _object5.setPosition(Common::Point(259, 61));
+ }
+
+ if (!BF_GLOBALS.getFlag(fToldToLeave340)) {
+ _woman.postInit();
+ _woman.setVisage(344);
+ _woman.setStrip(3);
+ _woman.setFrame(1);
+ _woman.fixPriority(123);
+ _woman.setPosition(Common::Point(88, 143));
+
+ _object4.postInit();
+ _object4.hide();
+
+ _child.postInit();
+ _child.setVisage(347);
+ _child.setStrip(3);
+ _child.setFrame(1);
+ _child.fixPriority(120);
+ _child.setPosition(Common::Point(81, 143));
+
+ _woman.setAction(&_sequenceManager2, NULL, 348, &_woman, &_child, &_object4, NULL);
+ BF_GLOBALS._sceneItems.addItems(&_child, &_woman, NULL);
+
+ _stripManager.addSpeaker(&_jordanSpeaker);
+ _stripManager.addSpeaker(&_skipBSpeaker);
+
+ BF_GLOBALS.set2Flags(f1097Marina);
+ }
+
+ if (BF_GLOBALS.getFlag(fCalledBackup)) {
+ _harrison.postInit();
+ _harrison.setVisage(326);
+ _harrison.setObjectWrapper(new SceneObjectWrapper());
+ _harrison.animate(ANIM_MODE_1, NULL);
+ _harrison.setPosition(Common::Point(-60, 219));
+ BF_GLOBALS._sceneItems.push_back(&_harrison);
+
+ _stripManager.addSpeaker(&_harrisonSpeaker);
+ if (BF_GLOBALS.getFlag(fBackupIn350)) {
+ _field2654 = 0;
+ _harrison.setVisage(1355);
+ _harrison.setPosition(Common::Point(289, 112));
+ _harrison.changeAngle(225);
+ _harrison.setFrame(1);
+ _harrison.fixPriority(75);
+
+ BF_GLOBALS._walkRegions.proc1(23);
+ } else if (BF_GLOBALS.getFlag(fBackupArrived340)) {
+ _field2654 = 1;
+ _harrison.setPosition(Common::Point(46, 154));
+ BF_GLOBALS._walkRegions.proc1(19);
+ } else if (BF_GLOBALS.getFlag(fCalledBackup) && (BF_GLOBALS._marinaWomanCtr > 0)) {
+ _timer1.set(900, &_harrison, &_action4);
+ }
+ }
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 350:
+ _seqNumber1 = 1342;
+ break;
+ case 830:
+ BF_GLOBALS._player._regionBitList |= 0x800;
+ _seqNumber1 = 1343;
+ break;
+ case 60:
+ _seqNumber1 = 342;
+ break;
+ default:
+ _sound1.fadeSound(35);
+ BF_GLOBALS._sound1.fadeSound((BF_GLOBALS._bookmark < bStartOfGame) ||
+ (BF_GLOBALS._bookmark > bCalledToDomesticViolence) ? 10 : 19);
+ _seqNumber1 = 342;
+ break;
+ }
+
+ _item3.setDetails(7, 340, 3, 9, 12, 1);
+ _item2.setDetails(Rect(0, 0, SCREEN_WIDTH - 1, 39), 340, 2, 8, 11, 1, NULL);
+ _item1.setDetails(Rect(0, 0, SCREEN_WIDTH - 1, BF_INTERFACE_Y), 340, 1, 7, 10, 1, NULL);
+
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, _seqNumber1, &BF_GLOBALS._player, NULL);
+}
+
+void Scene340::remove() {
+ BF_GLOBALS._scenePalette.clearListeners();
+ PalettedScene::remove();
+}
+
+void Scene340::signal() {
+ switch (_sceneMode) {
+ case 1:
+ case 2:
+ BF_GLOBALS._sceneManager.changeScene(350);
+ break;
+ case 3:
+ BF_GLOBALS._sceneManager.changeScene(60);
+ break;
+ case 4:
+ BF_GLOBALS._sceneManager.changeScene(830);
+ break;
+ default:
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene340::process(Event &event) {
+ // Check for gun being clicked on player
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == INV_COLT45) &&
+ BF_GLOBALS._player.contains(event.mousePos)) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ SceneItem::display2(350, 26);
+
+ signal();
+ event.handled = true;
+ }
+
+ if (!event.handled) {
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ // Check if the cursor is on an exit
+ if (_westExit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_W);
+ BF_GLOBALS._events.setCursor(surface);
+ } else if (_swExit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
+ BF_GLOBALS._events.setCursor(surface);
+ } else if (_northExit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_N);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+ }
+}
+
+void Scene340::dispatch() {
+ SceneExt::dispatch();
+ int idx = BF_GLOBALS._player.getRegionIndex();
+
+ if (idx == 20) {
+ BF_GLOBALS._player.updateZoom();
+ BF_GLOBALS._player.fixPriority(75);
+ }
+ if (idx == 26) {
+ BF_GLOBALS._player.updateZoom();
+ }
+ if (idx == 31) {
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.fixPriority(-1);
+ }
+
+ if (BF_GLOBALS._player._regionIndex == 16) {
+ BF_GLOBALS._player._regionBitList &= ~0x10000;
+
+ if (!BF_GLOBALS.getFlag(fBackupArrived340)) {
+ _sceneMode = 1;
+ ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, 254, 110);
+ } else if (!BF_GLOBALS.getFlag(fBackupIn350)) {
+ setAction(&_action7);
+ } else {
+ _sceneMode = 1;
+ ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, 254, 110);
+ }
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 342 - Marina, Normal
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene342::Lyle::startAction(CursorType action, Event &event) {
+ Scene342 *scene = (Scene342 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(340, 16);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(340, 15);
+ return true;
+ case CURSOR_TALK:
+ SceneItem::display2(340, 17);
+ return true;
+ case INV_COLT45:
+ scene->gunDisplay();
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene342::Item1::startAction(CursorType action, Event &event) {
+ Scene342 *scene = (Scene342 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case INV_COLT45:
+ scene->gunDisplay();
+ return true;
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene342::WestExit::startAction(CursorType action, Event &event) {
+ Scene342 *scene = (Scene342 *)BF_GLOBALS._sceneManager._scene;
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 4;
+ setAction(&scene->_sequenceManager1, scene, 1348, &BF_GLOBALS._player, NULL);
+ return true;
+}
+
+bool Scene342::SouthWestExit::startAction(CursorType action, Event &event) {
+ Scene342 *scene = (Scene342 *)BF_GLOBALS._sceneManager._scene;
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3;
+ setAction(&scene->_sequenceManager1, scene, 1340, &BF_GLOBALS._player, NULL);
+ return true;
+}
+
+bool Scene342::NorthExit::startAction(CursorType action, Event &event) {
+ Scene342 *scene = (Scene342 *)BF_GLOBALS._sceneManager._scene;
+
+ scene->_sceneMode = 1;
+ ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 254, 106);
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene342::Timer1::signal() {
+ PaletteRotation *item;
+
+ item = BF_GLOBALS._scenePalette.addRotation(235, 239, 1);
+ item->setDelay(30);
+ item = BF_GLOBALS._scenePalette.addRotation(247, 249, 1);
+ item->setDelay(30);
+ item = BF_GLOBALS._scenePalette.addRotation(240, 246, 1);
+ item->setDelay(30);
+ item = BF_GLOBALS._scenePalette.addRotation(252, 254, 1);
+ item->setDelay(30);
+
+ remove();
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene342::Scene342(): PalettedScene() {
+ _field1A1A = 0;
+}
+
+void Scene342::synchronize(Serializer &s) {
+ PalettedScene::synchronize(s);
+
+ s.syncAsSint16LE(_field1A1A);
+}
+
+void Scene342::postInit(SceneObjectList *OwnerList) {
+ PalettedScene::postInit();
+ loadScene(340);
+ setZoomPercents(126, 70, 162, 100);
+
+ BF_GLOBALS._walkRegions.proc1(13);
+ BF_GLOBALS._walkRegions.proc1(15);
+
+ _field1A1A = 0;
+ _timer1.set(2, NULL);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ _stripManager.addSpeaker(&_lyleHatSpeaker);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+
+ _westExit.setDetails(Rect(0, 76, 19, 115), 340, -1, -1, -1, 1, NULL);
+ _swExit.setDetails(15, 340, -1, -1, -1, 1);
+ _northExit.setDetails(16, 340, -1, -1, -1, 1);
+
+ if (BF_GLOBALS._dayNumber < 5) {
+ _object3.postInit();
+ _object3.setVisage(340);
+ _object3.setStrip(4);
+ _object3.setPosition(Common::Point(259, 61));
+ }
+
+ if (BF_GLOBALS.getFlag(onDuty)) {
+ BF_GLOBALS._player.setVisage(1341);
+ BF_GLOBALS._player._moveDiff = Common::Point(5, 2);
+ } else {
+ BF_GLOBALS._player.setVisage(129);
+ BF_GLOBALS._player._moveDiff = Common::Point(5, 2);
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _lyle.postInit();
+ _lyle.setVisage(469);
+ _lyle.setObjectWrapper(new SceneObjectWrapper());
+ _lyle.animate(ANIM_MODE_1, NULL);
+ _lyle.hide();
+ }
+ }
+
+ switch (BF_GLOBALS._randomSource.getRandomNumber(2)) {
+ case 0:
+ _object2.setPosition(Common::Point(46, 59));
+ ADD_MOVER_NULL(_object2, 300, -10);
+ break;
+ case 1:
+ _object2.setPosition(Common::Point(311, 57));
+ ADD_MOVER_NULL(_object2, 140, -10);
+ break;
+ case 2:
+ _object2.setPosition(Common::Point(-5, 53));
+ ADD_MOVER_NULL(_object2, 170, -10);
+ break;
+ default:
+ break;
+ }
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 50:
+ case 60:
+ case 330:
+ if (BF_GLOBALS._sceneManager._previousScene != 60) {
+ _sound1.fadeSound(35);
+ BF_GLOBALS._sound1.fadeSound((BF_GLOBALS._bookmark < bStartOfGame) ||
+ (BF_GLOBALS._bookmark > bCalledToDomesticViolence) ? 10 : 19);
+ }
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ BF_GLOBALS._walkRegions.proc1(19);
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+
+ setAction(&_sequenceManager1, this, 346, &_lyle, NULL);
+ BF_GLOBALS._player.setAction(&_sequenceManager2, NULL, 342, &BF_GLOBALS._player, NULL);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 342, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ case 350:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 1342, &BF_GLOBALS._player, NULL);
+ break;
+ default:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 1343, &BF_GLOBALS._player, NULL);
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _lyle.setPosition(Common::Point(-21, 118));
+ _lyle.setStrip(5);
+ _lyle.setFrame(1);
+ _lyle.setPriority(75);
+ _lyle.setZoom(75);
+ _lyle.setAction(&_sequenceManager2, NULL, 347, &_lyle, NULL);
+ BF_GLOBALS._sceneItems.push_back(&_lyle);
+ }
+ break;
+ }
+
+ _item3.setDetails(7, 340, 3, 9, 12, 1);
+ _item2.setDetails(Rect(0, 0, SCREEN_WIDTH - 1, 39), 340, 2, 8, 11, 1, NULL);
+ _item1.setDetails(Rect(0, 0, SCREEN_WIDTH - 1, BF_INTERFACE_Y), 340, 1, 7, 10, 1, NULL);
+}
+
+void Scene342::remove() {
+ BF_GLOBALS._scenePalette.clearListeners();
+ PalettedScene::remove();
+}
+
+void Scene342::signal() {
+ switch (_sceneMode) {
+ case 1:
+ ADD_PLAYER_MOVER(254, 106);
+ BF_GLOBALS._sceneManager.changeScene(350);
+ break;
+ case 3:
+ BF_GLOBALS._sceneManager.changeScene(60);
+ break;
+ case 4:
+ BF_GLOBALS._sceneManager.changeScene(830);
+ break;
+ default:
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene342::process(Event &event) {
+ // Check for gun being clicked on player
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == INV_COLT45) &&
+ BF_GLOBALS._player.contains(event.mousePos)) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ SceneItem::display2(350, 26);
+
+ signal();
+ event.handled = true;
+ }
+
+ if (!event.handled) {
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ // Check if the cursor is on an exit
+ if (_westExit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_W);
+ BF_GLOBALS._events.setCursor(surface);
+ } else if (_swExit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
+ BF_GLOBALS._events.setCursor(surface);
+ } else if (_northExit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_N);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+ }
+}
+
+void Scene342::dispatch() {
+ SceneExt::dispatch();
+ int idx = BF_GLOBALS._player.getRegionIndex();
+
+ if (idx == 20) {
+ BF_GLOBALS._player.updateZoom();
+ BF_GLOBALS._player.fixPriority(75);
+ }
+ if (idx == 26) {
+ BF_GLOBALS._player.updateZoom();
+ }
+ if (idx == 31) {
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.fixPriority(-1);
+ }
+
+ if (idx == 16) {
+ BF_GLOBALS._player.enableControl();
+ ADD_PLAYER_MOVER(254, 110);
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 350 - Marina, Outside Boat
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene350::Item5::startAction(CursorType action, Event &event) {
+ Scene350 *scene = (Scene350 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(350, 20);
+ return true;
+ case CURSOR_USE: {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3;
+
+ Common::Point pt(76, 154);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, scene);
+ return true;
+ }
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+void Scene350::Yacht::synchronize(Serializer &s) {
+ NamedHotspot::synchronize(s);
+ s.syncAsSint16LE(_flag);
+}
+
+bool Scene350::Yacht::startAction(CursorType action, Event &event) {
+ Scene350 *scene = (Scene350 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if ((BF_GLOBALS._dayNumber != 1) || !BF_GLOBALS.getFlag(onDuty) || (BF_GLOBALS._bookmark < bStartOfGame)) {
+ if ((BF_GLOBALS._dayNumber == 1) || (BF_GLOBALS._dayNumber == 4)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1;
+ scene->setAction(&scene->_sequenceManager1, scene, 3512, &BF_GLOBALS._player, &scene->_yachtDoor, NULL);
+ return true;
+ }
+ } else {
+ _flag = true;
+ scene->_sceneMode = 1;
+ BF_GLOBALS._player.disableControl();
+ scene->setAction(&scene->_sequenceManager1, scene, BF_GLOBALS.getFlag(gunDrawn) ? 3504 : 3505,
+ &BF_GLOBALS._player, &scene->_yachtDoor, NULL);
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return NamedHotspot::startAction(action, event);
+}
+
+bool Scene350::SouthWestExit::startAction(CursorType action, Event &event) {
+ BF_GLOBALS._player.disableControl();
+
+ Scene350 *scene = (Scene350 *)BF_GLOBALS._sceneManager._scene;
+ scene->_sceneMode = 2;
+
+ if (BF_GLOBALS.getFlag(fBackupIn350))
+ scene->setAction(&scene->_sequenceManager1, scene, 3507, &BF_GLOBALS._player, &scene->_harrison, NULL);
+ else
+ scene->setAction(&scene->_sequenceManager1, scene, 3510, &BF_GLOBALS._player, NULL);
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene350::Hook::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(350, 30);
+ return true;
+ case CURSOR_USE:
+ BF_INVENTORY.setObjectScene(INV_HOOK, 1);
+ if (!BF_GLOBALS.getFlag(hookPoints)) {
+ BF_GLOBALS.setFlag(hookPoints);
+ BF_GLOBALS._uiElements.addScore(30);
+ }
+ remove();
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene350::Object5::startAction(CursorType action, Event &event) {
+ Scene350 *scene = (Scene350 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(350, BF_INVENTORY.getObjectScene(INV_HOOK) ? 29 : 28);
+ return true;
+ case CURSOR_USE:
+ scene->_object5.remove();
+ return true;
+ case INV_HOOK:
+ BF_INVENTORY.setObjectScene(INV_HOOK, 350);
+
+ scene->_hook.postInit();
+ scene->_hook.setVisage(350);
+ scene->_hook.setStrip(5);
+ scene->_hook.fixPriority(201);
+ scene->_hook.setPosition(Common::Point(106, 146));
+ BF_GLOBALS._sceneItems.push_front(&scene->_hook);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene350::Timer1::signal() {
+ PaletteRotation *rot;
+ rot = BF_GLOBALS._scenePalette.addRotation(233, 235, 1);
+ rot->setDelay(40);
+ rot = BF_GLOBALS._scenePalette.addRotation(236, 238, 1);
+ rot->setDelay(20);
+ rot = BF_GLOBALS._scenePalette.addRotation(239, 241, 1);
+ rot->setDelay(20);
+ rot = BF_GLOBALS._scenePalette.addRotation(242, 244, 1);
+ rot->setDelay(12);
+
+ remove();
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene350::Scene350(): SceneExt() {
+ _field1D44 = _field1D46 = 0;
+}
+
+void Scene350::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(350);
+ setZoomPercents(90, 80, 143, 100);
+ _sound1.fadeSound(35);
+ _timer1.set(2, NULL);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeUniformSpeaker);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 352 : 1358);
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.setPosition(Common::Point(99, 152));
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player._moveDiff = Common::Point(3, 1);
+
+ _yacht._flag = false;
+ _swExit.setDetails(Rect(0, 160, SCREEN_WIDTH, BF_INTERFACE_Y - 1), 350, -1, -1, -1, 1, NULL);
+
+ if ((BF_GLOBALS._dayNumber != 1) && (BF_GLOBALS._dayNumber != 4)) {
+ _yacht.setDetails(28, 350, 15, 16, 17, 1);
+ } else {
+ _yachtDoor.postInit();
+ _yachtDoor.setVisage(350);
+ _yachtDoor.setStrip(3);
+ _yachtDoor.setFrame(1);
+ _yachtDoor.fixPriority(72);
+ _yachtDoor.setPosition(Common::Point(40, 74));
+
+ _yachtBody.setup(350, 1, 1, 129, 142, 255);
+
+ if (BF_GLOBALS.getFlag(fBackupIn350)) {
+ _harrison.postInit();
+ _harrison.setVisage(1355);
+ _harrison.setObjectWrapper(new SceneObjectWrapper());
+ _harrison.animate(ANIM_MODE_1, NULL);
+ _harrison.changeZoom(-1);
+ _harrison.setDetails(350, 12, 13, 14, 1, NULL);
+ _harrison._moveDiff = Common::Point(2, 1);
+
+ _stripManager.addSpeaker(&_harrisonSpeaker);
+ }
+
+ if (BF_GLOBALS._bookmark < bStartOfGame) {
+ // Setup scene in debug mode
+ _yacht.setDetails(28, 350, 6, 18, 19, 1);
+ } else {
+ _yacht.setDetails(28, 350, 6, BF_GLOBALS.getFlag(bStartOfGame) ? 7 : 18, 8, 1);
+ }
+ }
+
+ _item5._sceneRegionId = 5;
+ BF_GLOBALS._sceneItems.push_back(&_item5);
+ _item4.setDetails(15, 350, 0, 1, 2, 1);
+ BF_GLOBALS._sceneItems.push_back(&_yacht);
+
+ _item3.setDetails(7, 350, 23, 24, 25, 1);
+ _item2.setDetails(Rect(0, 0, SCREEN_WIDTH - 1, 31), 350, 3, 4, 5, 1, NULL);
+ _item1.setDetails(Rect(0, 0, SCREEN_WIDTH - 1, BF_INTERFACE_Y), 350, 0, 1, 2, 1, NULL);
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 370:
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._uiElements._active = true;
+ BF_GLOBALS._uiElements.show();
+ // Deliberate fall-through
+ case 355:
+ if (BF_GLOBALS.getFlag(onDuty) && BF_GLOBALS.getFlag(gunDrawn))
+ BF_GLOBALS._player.setVisage(351);
+
+ BF_GLOBALS._player.setPosition(Common::Point(22, 91));
+ BF_GLOBALS._player.changeAngle(225);
+ break;
+ default:
+ BF_GLOBALS.clearFlag(gunDrawn);
+
+ if ((BF_GLOBALS._dayNumber == 1) && (BF_GLOBALS._bookmark < bCalledToDomesticViolence) &&
+ BF_GLOBALS.getFlag(fBackupIn350)) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 3509, &_harrison, NULL);
+ BF_GLOBALS._player.setAction(&_sequenceManager2, NULL, 3508, &BF_GLOBALS._player, NULL);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 3508, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ }
+}
+
+void Scene350::remove() {
+ BF_GLOBALS._scenePalette.clearListeners();
+ SceneExt::remove();
+}
+
+void Scene350::signal() {
+ switch (_sceneMode) {
+ case 1:
+ BF_GLOBALS._sceneManager.changeScene(355);
+ break;
+ case 2:
+ BF_GLOBALS._sceneManager.changeScene((BF_GLOBALS._dayNumber != 1) ||
+ (BF_GLOBALS._bookmark < bStartOfGame) || (BF_GLOBALS._bookmark >= bCalledToDomesticViolence) ? 342 : 340);
+ break;
+ case 3:
+ BF_GLOBALS._player.setStrip(8);
+
+ _object5.postInit();
+ _object5.setVisage(350);
+ _object5.setStrip(4);
+ _object5.fixPriority(200);
+ _object5.setPosition(Common::Point(85, 166));
+ BF_GLOBALS._sceneItems.push_front(&_object5);
+
+ if (BF_INVENTORY.getObjectScene(INV_HOOK) == 350) {
+ _hook.postInit();
+ _hook.setVisage(350);
+ _hook.setStrip(5);
+ _hook.fixPriority(201);
+ _hook.setPosition(Common::Point(106, 146));
+ BF_GLOBALS._sceneItems.push_front(&_hook);
+ }
+
+ BF_GLOBALS._player.enableControl();
+ _sound2.play(97);
+ break;
+ default:
+ if (BF_GLOBALS.getFlag(fBackupIn350)) {
+ _harrison.updateAngle(BF_GLOBALS._player._position);
+ BF_GLOBALS._walkRegions.proc1(19);
+ }
+
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene350::process(Event &event) {
+ // Check for gun being clicked on player
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == INV_COLT45) &&
+ BF_GLOBALS._player.contains(event.mousePos)) {
+ BF_GLOBALS._player.disableControl();
+
+ if (!BF_GLOBALS.getFlag(onDuty)) {
+ // Player not on duty
+ SceneItem::display2(350, 26);
+ signal();
+ } else if (BF_GLOBALS.getFlag(gunDrawn)) {
+ // Holster the gun
+ BF_GLOBALS.clearFlag(gunDrawn);
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 3501, &BF_GLOBALS._player, NULL);
+
+ if (BF_GLOBALS.getFlag(fBackupIn350))
+ _harrison.setAction(&_sequenceManager3, NULL, 3503, &_harrison, NULL);
+ } else {
+ // Drawn the gun
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 3500, &BF_GLOBALS._player, NULL);
+
+ if (BF_GLOBALS.getFlag(fBackupIn350))
+ _harrison.setAction(&_sequenceManager3, NULL, 3502, &_harrison, NULL);
+
+ BF_GLOBALS.setFlag(gunDrawn);
+ }
+
+ event.handled = true;
+ }
+
+ if (!event.handled) {
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ // Check if the cursor is on an exit
+ if (_swExit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+ }
+}
+
+void Scene350::checkGun() {
+ if ((BF_GLOBALS._dayNumber != 1) || (BF_GLOBALS._bookmark < bStartOfGame) ||
+ (BF_GLOBALS._bookmark >= bCalledToDomesticViolence) || BF_GLOBALS.getFlag(fRandomShot350)) {
+ SceneItem::display2(350, 27);
+ } else {
+ BF_GLOBALS.setFlag(fRandomShot350);
+ if (BF_GLOBALS.getFlag(fBackupIn350)) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 3511, &BF_GLOBALS._player, NULL);
+ } else {
+ _stripManager.start(3502, this);
+ }
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 355 - Future Wave Exterior
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene355::Doorway::synchronize(Serializer &s) {
+ NamedObject::synchronize(s);
+ s.syncAsSint16LE(_v1);
+ s.syncAsSint16LE(_v2);
+ s.syncAsSint16LE(_v3);
+}
+
+bool Scene355::Doorway::startAction(CursorType action, Event &event) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(355, 9);
+ return true;
+ case CURSOR_USE:
+ if (!scene->_modeFlag) {
+ scene->_sceneMode = 9984;
+ scene->signal();
+ } else {
+ scene->setMode(true, 9984);
+ }
+ return true;
+ case CURSOR_TALK:
+ if (BF_GLOBALS._dayNumber >= 5) {
+ switch (_v2) {
+ case 0:
+ ++_v2;
+ BF_GLOBALS._sound1.play(109);
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+
+ BF_GLOBALS.setFlag(fTookTrailerAmmo);
+ scene->_stripManager.start(3575, scene);
+ scene->_object7._flag = 1;
+ return true;
+ case 1:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(3573, scene);
+ return true;
+ default:
+ break;
+ }
+ } else if (!BF_GLOBALS.getFlag(greenTaken) && (BF_GLOBALS._dayNumber == 1)) {
+ scene->_sceneMode = 1357;
+ BF_GLOBALS._player.disableControl();
+ scene->_stripManager.start(3550, scene);
+ return true;
+ }
+ break;
+ case INV_WAVE_KEYS:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3562;
+ scene->setAction(&scene->_sequenceManager, scene, 3562, &BF_GLOBALS._player, NULL);
+ _v3 = !_v3 ? 1 : 0;
+ return true;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+}
+
+bool Scene355::Locker::startAction(CursorType action, Event &event) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(355, 51);
+ return true;
+ case CURSOR_USE:
+ if (BF_GLOBALS._dayNumber < 5)
+ SceneItem::display2(355, 46);
+ else if (BF_INVENTORY.getObjectScene(INV_FLARE) != 355)
+ SceneItem::display2(355, 45);
+ else if (scene->_modeFlag)
+ scene->setMode(true, 9996);
+ else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9996;
+
+ if (scene->_nextSceneMode) {
+ scene->_nextSceneMode = 0;
+ scene->setAction(&scene->_sequenceManager, scene, 3555, &BF_GLOBALS._player, NULL);
+ } else {
+ scene->signal();
+ }
+ }
+ return true;
+ case INV_SCREWDRIVER:
+ if (scene->_modeFlag)
+ scene->setMode(true, 9996);
+ else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9996;
+ if (!scene->_nextSceneMode)
+ scene->signal();
+ else {
+ scene->_nextSceneMode = 0;
+ scene->setAction(&scene->_sequenceManager, scene, 3555, &BF_GLOBALS._player, NULL);
+ }
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene355::LockerDoor::startAction(CursorType action, Event &event) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ if (_frame == 1)
+ SceneItem::display2(355, 46);
+ else
+ SceneItem::display2(355, BF_GLOBALS._sceneObjects->contains(&scene->_object5) ? 26 : 47);
+ return true;
+ case CURSOR_USE:
+ if (_frame == 1) {
+ SceneItem::display2(355, 23);
+ return true;
+ }
+ return true;
+ case INV_SCREWDRIVER:
+ scene->_sound2.play(104);
+ BF_INVENTORY.setObjectScene(INV_SCREWDRIVER, 999);
+ setFrame(2);
+
+ scene->_object9.postInit();
+ scene->_object9.setVisage(378);
+ scene->_object9.setPosition(Common::Point(83, 100));
+ scene->_object9.fixPriority(100);
+
+ scene->_object5.postInit();
+ scene->_object5.setVisage(2356);
+ scene->_object5.setStrip(3);
+ scene->_object5.setPosition(Common::Point(67, 85));
+ scene->_object5.fixPriority(255);
+ BF_GLOBALS._sceneItems.push_front(&scene->_object5);
+
+ SceneItem::display2(355, 27);
+ scene->_locker.setFrame(2);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene355::Object5::startAction(CursorType action, Event &event) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(355, 30);
+ return true;
+ case CURSOR_USE:
+ BF_INVENTORY.setObjectScene(INV_FLARE, 1);
+ BF_GLOBALS._uiElements.addScore(30);
+
+ scene->_object9.remove();
+ remove();
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene355::Object6::startAction(CursorType action, Event &event) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(355, 34);
+ return true;
+ case CURSOR_USE:
+ if (scene->_modeFlag)
+ SceneItem::display2(355, 35);
+ else if (!_flag)
+ SceneItem::display2(355, 38);
+ else if (BF_INVENTORY.getObjectScene(INV_GRENADES) == 1)
+ SceneItem::display2(355, 49);
+ else {
+ BF_GLOBALS._player._regionBitList |= 0x10;
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9985;
+ scene->setAction(&scene->_sequenceManager, scene, 3357, &BF_GLOBALS._player, this, NULL);
+ }
+ return true;
+ case CURSOR_TALK:
+ scene->_sceneMode = 0;
+ if (BF_INVENTORY.getObjectScene(INV_GRENADES) != 355) {
+ scene->_stripManager.start(3584, scene);
+ } else if (BF_INVENTORY.getObjectScene(INV_HANDCUFFS) != 1) {
+ return false;
+ } else {
+ switch (BF_GLOBALS._v4CEC2) {
+ case 0:
+ scene->_stripManager.start(3565, scene);
+ break;
+ case 1:
+ scene->_stripManager.start(3567, scene);
+ break;
+ case 2:
+ scene->_stripManager.start(3571, scene);
+ break;
+ }
+ }
+ return true;
+
+ default:
+ if ((action < BF_LAST_INVENT) && scene->_modeFlag) {
+ SceneItem::display2(355, 35);
+ return true;
+ }
+
+ switch (action) {
+ case INV_COLT45:
+ if (BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 355)
+ SceneItem::display2(355, 39);
+ else if (!BF_GLOBALS.getFlag(fGunLoaded))
+ SceneItem::display2(1, 1);
+ else if (!BF_GLOBALS.getFlag(gunDrawn))
+ SceneItem::display2(1, 0);
+ else {
+ if (BF_GLOBALS._sceneObjects->contains(&scene->_object7))
+ scene->_object7.setAction(NULL);
+
+ BF_GLOBALS._player.disableControl();
+ scene->_object6.setStrip(1);
+ scene->_object6.setFrame(1);
+ scene->_sceneMode = 9981;
+ scene->signal();
+ }
+ return true;
+ case INV_HANDCUFFS:
+ if (BF_GLOBALS._v4CEC2 <= 1)
+ SceneItem::display2(355, 38);
+ else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9979;
+ scene->setAction(&scene->_sequenceManager, scene, 4551, &BF_GLOBALS._player, this, NULL);
+ BF_INVENTORY.setObjectScene(INV_HANDCUFFS, 355);
+ BF_GLOBALS._uiElements.addScore(50);
+ _flag = 1;
+ BF_GLOBALS._bookmark = bInvestigateBoat;
+ }
+ return true;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene355::Object7::startAction(CursorType action, Event &event) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+
+ if (BF_GLOBALS._sceneObjects->contains(&scene->_object6)) {
+ scene->_stripManager.start((BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 355) ? 3578 : 3577, scene);
+ } else {
+ switch (_flag) {
+ case 0:
+ scene->_stripManager.start(3574, scene);
+ break;
+ case 1:
+ scene->_stripManager.start(3576, scene);
+ break;
+ case 2:
+ scene->_stripManager.start(3563, scene);
+ break;
+ default:
+ break;
+ }
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene355::Object8::startAction(CursorType action, Event &event) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(355, 0);
+ return true;
+ case CURSOR_USE:
+ if (BF_GLOBALS.getFlag(fBackupIn350)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9999;
+ scene->_stripManager.start(3559, scene);
+ return true;
+ } else if (BF_GLOBALS._dayNumber < 5) {
+ SceneItem::display2(355, 52);
+ return true;
+ }
+ break;
+ case INV_COLT45:
+ if (BF_GLOBALS.getFlag(fBackupIn350)) {
+ scene->_sceneMode = 9997;
+ scene->_stripManager.start(3561, scene);
+ } else {
+ SceneItem::display(1, 4);
+ }
+ return true;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene355::Item1::startAction(CursorType action, Event &event) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(355, 28);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(355, 37);
+ return true;
+ case INV_RENTAL_KEYS:
+ if (scene->_modeFlag) {
+ scene->_sceneMode = 9980;
+ scene->signal();
+ } else if (!scene->_nextSceneMode)
+ SceneItem::display2(355, 36);
+ else
+ scene->setMode(false, 9980);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene355::Item2::startAction(CursorType action, Event &event) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ if (BF_GLOBALS.getFlag(fBackupIn350)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9999;
+ scene->_stripManager.start(3559, scene);
+ } else {
+ if (scene->_action) {
+ scene->_sceneMode = 0;
+ scene->_action->remove();
+ }
+
+ BF_GLOBALS._sceneManager.changeScene(350);
+ }
+ return true;
+}
+
+bool Scene355::Item3::startAction(CursorType action, Event &event) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(355, 33);
+ return true;
+ case CURSOR_USE:
+ if (BF_GLOBALS._dayNumber < 5)
+ SceneItem::display2(355, 21);
+ else if (scene->_modeFlag)
+ scene->setMode(true, 9987);
+ else {
+ scene->_sceneMode = 9987;
+ scene->signal();
+ }
+ return true;
+ case INV_FLARE:
+ scene->_sound2.play(105);
+ _state = 3554;
+ break;
+ case INV_RAGS:
+ _state = 3559;
+ break;
+ case INV_JAR:
+ _state = 3558;
+ break;
+ default:
+ return SceneHotspotExt::startAction(action, event);
+ }
+
+ // Handling for inventory objects
+ BF_INVENTORY.setObjectScene(action, 0);
+ if (scene->_modeFlag)
+ scene->setMode(true, 9986);
+ else {
+ scene->_sceneMode = 9986;
+ scene->signal();
+ }
+
+ scene->_nextSceneMode = 0;
+ return true;
+}
+
+bool Scene355::Item4::startAction(CursorType action, Event &event) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(355, 31);
+ return true;
+ case CURSOR_USE:
+ if ((BF_GLOBALS._dayNumber < 5) || (BF_INVENTORY.getObjectScene(INV_GRENADES) != 355))
+ SceneItem::display2(355, 21);
+ else if (scene->_modeFlag)
+ scene->setMode(true, 9987);
+ else {
+ scene->_sceneMode = 9987;
+ scene->signal();
+ }
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+
+bool Scene355::Item5::startAction(CursorType action, Event &event) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (BF_INVENTORY.getObjectScene(INV_SCREWDRIVER) == 355) {
+ if (scene->_modeFlag) {
+ scene->_sceneMode = 9992;
+ scene->signal();
+ } else if (!scene->_nextSceneMode) {
+ scene->setMode(false, 9992);
+ } else {
+ scene->_sceneMode = 9977;
+ scene->_nextSceneMode = 0;
+ scene->setAction(&scene->_sequenceManager, scene, 3555, &BF_GLOBALS._player, NULL);
+ }
+ } else {
+ SceneItem::display2(355, 45);
+ }
+ return true;
+ case INV_RENTAL_KEYS:
+ if (scene->_modeFlag) {
+ scene->_sceneMode = 9980;
+ scene->signal();
+ } else if (!scene->_nextSceneMode) {
+ scene->setMode(false, 9980);
+ } else {
+ SceneItem::display2(355, 36);
+ }
+ return true;
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene355::Item11::startAction(CursorType action, Event &event) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_WALK:
+ return (BF_GLOBALS._bookmark == bStartOfGame) || (BF_GLOBALS._bookmark == bCalledToDomesticViolence) ||
+ (BF_GLOBALS._bookmark == bArrestedGreen);
+ case CURSOR_LOOK:
+ SceneItem::display2(355, 7);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(355, 8);
+ return true;
+ case CURSOR_TALK:
+ if (BF_GLOBALS._dayNumber == 5) {
+ switch (scene->_doorway._v2) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+ BF_GLOBALS.setFlag(fTookTrailerAmmo);
+ scene->_stripManager.start(3575, scene);
+ scene->_object7._flag = 1;
+ scene->_doorway._v2 = 1;
+ break;
+ case 1:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(3573, scene);
+ break;
+ default:
+ return false;
+ }
+ } else {
+ if (!BF_GLOBALS.getFlag(onDuty))
+ return false;
+ scene->_sceneMode = 1357;
+ BF_GLOBALS._player.disableControl();
+ scene->_stripManager.start(3550, scene);
+ }
+ return true;
+ case INV_COLT45:
+ if (!BF_GLOBALS.getFlag(fBackupIn350) || !BF_GLOBALS.getFlag(gunDrawn) || !BF_GLOBALS.getFlag(fGunLoaded))
+ SceneItem::display2(1, 4);
+ else {
+ scene->_sceneMode = 9997;
+ BF_GLOBALS._player.disableControl();
+ scene->_stripManager.start(3561, scene);
+ }
+ return true;
+ default:
+ break;
+ }
+
+ return NamedHotspot::startAction(action, event);
+}
+
+bool Scene355::Item12::startAction(CursorType action, Event &event) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ if (!BF_GLOBALS.getFlag(gunDrawn)) {
+ if (scene->_modeFlag)
+ scene->setMode(true, 0);
+ else if (!scene->_nextSceneMode)
+ scene->setMode(false, 0);
+ else {
+ scene->_nextSceneMode = 0;
+ BF_GLOBALS._player.disableControl();
+ scene->setAction(&scene->_sequenceManager, scene, 3555, &BF_GLOBALS._player, NULL);
+ }
+ }
+
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene355::Action1::signal() {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(3600 * (BF_GLOBALS._randomSource.getRandomNumber(1) + 1));
+ break;
+ case 1:
+ _actionIndex = 0;
+ scene->_object7.animate(ANIM_MODE_8, 1, this);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene355::Action2::signal() {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(10);
+ break;
+ case 1:
+ scene->_stripManager.start((BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 1) ? 3566 : 3568, this);
+ break;
+ case 2:
+ scene->_sceneMode = 9979;
+ scene->signal();
+ remove();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene355::Scene355(): PalettedScene() {
+ _nextSceneMode = 0;
+ _modeFlag = false;
+}
+
+void Scene355::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_nextSceneMode);
+ s.syncAsSint16LE(_modeFlag);
+}
+
+void Scene355::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ if (BF_GLOBALS._dayNumber == 0)
+ BF_GLOBALS._dayNumber = 5;
+
+ if (BF_GLOBALS._dayNumber == 5) {
+ loadScene(356);
+ BF_GLOBALS._player._regionBitList &= ~0x10;
+ } else {
+ loadScene(355);
+ }
+
+ _sound1.fadeSound(35);
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeUniformSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ _stripManager.addSpeaker(&_lyleHatSpeaker);
+ _stripManager.addSpeaker(&_harrisonSpeaker);
+ _stripManager.addSpeaker(&_greenSpeaker);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ if (!BF_GLOBALS.getFlag(onDuty)) {
+ BF_GLOBALS._player.setVisage(368);
+ BF_GLOBALS._player.setStrip(3);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ } else if (BF_GLOBALS.getFlag(gunDrawn)) {
+ BF_GLOBALS._player.setVisage(356);
+ BF_GLOBALS._player.setFrame(BF_GLOBALS._player.getFrameCount());
+ } else {
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setVisage(356);
+ BF_GLOBALS._player.setStrip(7);
+ }
+
+ if (BF_GLOBALS.getFlag(greenTaken)) {
+ BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 361 : 368);
+ BF_GLOBALS._player.setStrip(3);
+ BF_GLOBALS._player.setPosition(Common::Point(244, 140));
+ } else {
+ BF_GLOBALS._player.setPosition(Common::Point(244, 132));
+ }
+
+ BF_GLOBALS._player._moveDiff = Common::Point(6, 4);
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player._canWalk = false;
+
+ _item4._sceneRegionId = 17;
+ BF_GLOBALS._sceneItems.push_back(&_item4);
+
+ _locker.postInit();
+ _locker.setVisage(2356);
+ _locker.setPosition(Common::Point(88, 99));
+
+ if (BF_INVENTORY.getObjectScene(INV_SCREWDRIVER) == 999) {
+ _locker.setFrame(2);
+
+ if (BF_INVENTORY.getObjectScene(INV_FLARE) == 355) {
+ _object9.postInit();
+ _object9.setVisage(378);
+ _object9.setPosition(Common::Point(83, 100));
+ _object9.fixPriority(100);
+ }
+ }
+ BF_GLOBALS._sceneItems.push_back(&_locker);
+
+ _doorway.postInit();
+ _doorway.setVisage(355);
+ _doorway.setPosition(Common::Point(193, 105));
+ _doorway.fixPriority(18);
+ _doorway._v1 = 0;
+ _doorway._v3 = 0;
+ BF_GLOBALS._sceneItems.push_back(&_doorway);
+
+ switch (BF_GLOBALS._dayNumber) {
+ case 1:
+ if (!BF_GLOBALS.getFlag(onDuty))
+ _doorway._v3 = 1;
+ else if (BF_INVENTORY.getObjectScene(INV_GREENS_GUN) == 320)
+ _doorway._v3 = 1;
+ break;
+ case 2:
+ case 3:
+ case 4:
+ _doorway._v3 = 1;
+ break;
+ default:
+ break;
+ }
+
+ if (BF_GLOBALS._dayNumber == 5)
+ _doorway._v2 = BF_GLOBALS.getFlag(fTookTrailerAmmo) ? 1 : 0;
+
+ _object8.postInit();
+ _object8.setVisage(355);
+ if (BF_GLOBALS._dayNumber == 5) {
+ _object8.setStrip(3);
+ _object8.setPosition(Common::Point(103, 148));
+ _object8.hide();
+ } else {
+ _object8.setStrip(2);
+ _object8.setPosition(Common::Point(142, 151));
+ _object8.fixPriority(247);
+ }
+
+ switch (BF_GLOBALS._dayNumber) {
+ case 2:
+ case 3:
+ case 4:
+ break;
+ case 5:
+ BF_GLOBALS._player.disableControl();
+ _modeFlag = true;
+ BF_GLOBALS._player.setPosition(Common::Point(133, 173));
+ BF_GLOBALS._player.fixPriority(249);
+ BF_GLOBALS._player.setStrip(7);
+
+ if (BF_GLOBALS._bookmark == bDoneAtLyles)
+ BF_GLOBALS._bookmark = bEndDayFour;
+
+ _item5.setDetails(Rect(22, 136, 46, 146), 355, 43, -1, -1, 1, NULL);
+ _nextSceneMode = 0;
+
+ if (!BF_GLOBALS.getFlag(fLyleOnIsland)) {
+ _object7.postInit();
+ _object7.setVisage(847);
+ _object7.setPosition(Common::Point(296, 97));
+ _object7.setStrip(1);
+ _object7.setAction(&_action1);
+ _object7._flag = BF_GLOBALS.getFlag(fTookTrailerAmmo) ? 1 : 0;
+ _object7.setDetails(355, 40, 42, 41, 1, NULL);
+ }
+
+ if ((BF_INVENTORY.getObjectScene(INV_RAGS) == 0) && (BF_INVENTORY.getObjectScene(INV_JAR) == 0) &&
+ (BF_INVENTORY.getObjectScene(INV_FLARE) == 0)) {
+ BF_GLOBALS._sound1.changeSound(103);
+
+ _object9.postInit();
+ _object9.setVisage(2357);
+ _object9.setStrip(2);
+ _object9.setPosition(Common::Point(231, 19));
+ _object9.animate(ANIM_MODE_2);
+
+ _object11.postInit();
+ _object11.setVisage(2357);
+ _object11.setStrip(6);
+ _object11.setPosition(Common::Point(183, 39));
+ _object11.animate(ANIM_MODE_2);
+
+ _doorway.setPosition(Common::Point(146, 107));
+ _doorway._v3 = 0;
+ _doorway._v2 = 2;
+ _object7._flag = 2;
+
+ _object6.postInit();
+ BF_GLOBALS._sceneItems.push_back(&_object6);
+
+ if (BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 1) {
+ _object6.setVisage(376);
+ _object6.setStrip(1);
+ _object6.setPosition(Common::Point(193, 88));
+ _object6._flag = 0;
+ } else {
+ _object6._flag = 1;
+
+ if (BF_INVENTORY.getObjectScene(INV_GRENADES) == 1) {
+ _object6.setVisage(373);
+ _object6.setStrip(5);
+ _object6.setPosition(Common::Point(238, 142));
+ } else {
+ _object6.setVisage(375);
+ _object6.setStrip(1);
+ _object6.setFrame(_object6.getFrameCount());
+ _object6.setPosition(Common::Point(193, 147));
+ }
+ }
+ }
+
+ if ((BF_GLOBALS._bookmark == bFinishedWGreen) && BF_GLOBALS._sceneObjects->contains(&_object7) &&
+ !BF_GLOBALS.getFlag(iWasAmbushed)) {
+ BF_GLOBALS.setFlag(iWasAmbushed);
+ BF_GLOBALS._player.disableControl();
+
+ _sceneMode = 0;
+ _stripManager.start(3582, this);
+ }
+ break;
+ default:
+ if (!BF_GLOBALS.getFlag(greenTaken)) {
+ _harrison.postInit();
+ _harrison.setPosition(Common::Point(152, 131));
+ _harrison.animate(ANIM_MODE_1, NULL);
+ _harrison.setObjectWrapper(new SceneObjectWrapper());
+
+ if (BF_GLOBALS.getFlag(gunDrawn)) {
+ _harrison.setVisage(357);
+ _harrison.setStrip(2);
+ } else {
+ _harrison.setVisage(1363);
+ _harrison.setStrip(3);
+ }
+
+ _harrison.hide();
+ if (BF_GLOBALS.getFlag(fBackupIn350)) {
+ _harrison.show();
+ BF_GLOBALS._sceneItems.push_back(&_harrison);
+ }
+
+ _sceneMode = 1355;
+ setAction(&_sequenceManager, this, 1355, NULL);
+ }
+ break;
+ }
+
+ _harrison.setDetails(355, 18, 20, 19, 1, NULL);
+ _item6.setDetails(10, 355, 2, -1, 14, 1);
+ _item7.setDetails(11, 355, 3, -1, 15, 1);
+ _item8.setDetails(12, 355, 4, -1, 8, 1);
+ _item9.setDetails(13, 355, 5, -1, -1, 1);
+ _item10.setDetails(15, 355, 10, -1, 11, 1);
+ _item1._sceneRegionId = 22;
+ BF_GLOBALS._sceneItems.addItems(&_item3, &_item6, &_item7, &_item8, &_item9, &_item10, &_item1, NULL);
+
+ if (BF_GLOBALS._dayNumber == 5) {
+ _item12.setBounds(Rect(115, 101, 186, 154));
+ BF_GLOBALS._sceneItems.push_front(&_item12);
+ } else {
+ _item2.setDetails(Rect(273, 53, 320, 101), 355, -1, -1, -1, 2, NULL);
+ }
+
+ _item11.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
+ BF_GLOBALS._sceneItems.push_back(&_item11);
+}
+
+void Scene355::signal() {
+ static uint32 black = 0;
+
+ switch (_sceneMode) {
+ case 12:
+ SceneItem::display2(355, 22);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 1355:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 9999;
+ _stripManager.start(BF_GLOBALS.getFlag(fBackupIn350) ? 3559 : 3554, this);
+ break;
+ case 1356:
+ switch (_doorway._v1) {
+ case 0:
+ ++_doorway._v1;
+ _sceneMode = 9999;
+ _stripManager.start(3550, this);
+ break;
+ case 1:
+ _sceneMode = 9999;
+ _stripManager.start(3551, this);
+ ++_doorway._v1;
+ break;
+ default:
+ break;
+ }
+ break;
+ case 2357:
+ _harrison.animate(ANIM_MODE_1, NULL);
+ // Deliberate fall-through
+ case 1357:
+ BF_GLOBALS._player.enableControl();
+ if (BF_GLOBALS.getFlag(gunDrawn))
+ BF_GLOBALS._player._canWalk = false;
+ break;
+ case 1359:
+ BF_GLOBALS._sceneManager.changeScene(360);
+ break;
+ case 2358:
+ if (!BF_GLOBALS.getFlag(fBackupIn350))
+ BF_GLOBALS._sceneManager.changeScene(360);
+ else {
+ _sceneMode = 1359;
+ setAction(&_sequenceManager, this, BF_GLOBALS.getFlag(gunDrawn) ? 1359 : 3550, &_harrison, NULL);
+ }
+ break;
+ case 3553:
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player._canWalk = false;
+ break;
+ case 3554:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 9988;
+ setAction(&_sequenceManager, this, 3554, &BF_GLOBALS._player, NULL);
+ break;
+ case 3556:
+ if (BF_GLOBALS._player._angle == 45) {
+ _sceneMode = 4554;
+ signal();
+ } else {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 4554;
+ setAction(&_sequenceManager, this, 3556, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ case 3558:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 9988;
+ setAction(&_sequenceManager, this, 3558, &BF_GLOBALS._player, NULL);
+ break;
+ case 3559:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 9988;
+ setAction(&_sequenceManager, this, 3559, &BF_GLOBALS._player, NULL);
+ break;
+ case 3561:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 1357;
+ setAction(&_sequenceManager, this, 3561, &BF_GLOBALS._player, NULL);
+ break;
+ case 3562:
+ if (!BF_GLOBALS.getFlag(unlockBoat)) {
+ BF_GLOBALS.setFlag(unlockBoat);
+ BF_GLOBALS._uiElements.addScore(10);
+ }
+
+ SceneItem::display(355, !_doorway._v3 ? 24 : 25);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 4550:
+ BF_GLOBALS._uiElements.addScore(50);
+ _object10.remove();
+ BF_GLOBALS._sound1.play(90);
+ BF_GLOBALS._player._regionBitList |= 0x10;
+
+ _doorway._v3 = 0;
+ _doorway._v2 = 2;
+ _object7._flag = 2;
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 4552:
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 4554:
+ BF_GLOBALS._player.disableControl();
+ switch (_nextSceneMode) {
+ case 9980:
+ _sceneMode = 9980;
+ break;
+ case 9992:
+ _sceneMode = 0;
+ break;
+ default:
+ _sceneMode = 9992;
+ break;
+ }
+ setAction(&_sequenceManager, this, 4554, &BF_GLOBALS._player, NULL);
+ _nextSceneMode = 0;
+ _modeFlag = true;
+ break;
+ case 9977:
+ setMode(false, 9992);
+ break;
+ case 9979:
+ _sceneMode = 0;
+ signal();
+ break;
+ case 9980:
+ _sceneMode = 9982;
+ ADD_MOVER(BF_GLOBALS._player, 64, 173);
+ break;
+ case 9981:
+ _sceneMode = 9994;
+ _object6.animate(ANIM_MODE_5, NULL);
+ addFader((const byte *)&black, 10, this);
+ break;
+ case 9982:
+ _sceneMode = 9983;
+ if (BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 355) {
+ if (BF_GLOBALS.getFlag(fLyleOnIsland)) {
+ BF_GLOBALS._player.updateAngle(_object6._position);
+ _stripManager.start(3581, this);
+ } else {
+ BF_GLOBALS._player.updateAngle(_object7._position);
+ _stripManager.start(3570, this);
+ }
+ } else {
+ if (BF_GLOBALS.getFlag(fLyleOnIsland)) {
+ if (BF_GLOBALS._sceneObjects->contains(&_object6)) {
+ BF_INVENTORY.setObjectScene(INV_GRENADES, 860);
+ _stripManager.start(3583, this);
+ } else {
+ signal();
+ }
+ } else {
+ BF_GLOBALS._player.updateAngle(_object7._position);
+ _stripManager.start(BF_GLOBALS.getFlag(fTookTrailerAmmo) ? 3579 : 3580, this);
+ }
+ }
+ break;
+ case 9983:
+ BF_GLOBALS._sceneManager.changeScene(860);
+ break;
+ case 9984:
+ if (BF_GLOBALS._dayNumber == 5) {
+ _sceneMode = 0;
+ switch (_doorway._v2) {
+ case 0:
+ BF_GLOBALS._sound1.play(109);
+ BF_GLOBALS.setFlag(fTookTrailerAmmo);
+ _stripManager.start(3575, this);
+ _object7._flag = 1;
+ ++_doorway._v2;
+ break;
+ case 1:
+ _stripManager.start(3573, this);
+ break;
+ default:
+ SceneItem::display2(355, 21);
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+ } else if (BF_GLOBALS.getFlag(greenTaken) || (BF_GLOBALS._dayNumber > 1)) {
+ if (_doorway._v3) {
+ SceneItem::display2(355, 23);
+ _sceneMode = 0;
+ signal();
+ } else {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 2358;
+ setAction(&_sequenceManager, this, 3551, &BF_GLOBALS._player, &_doorway, NULL);
+ }
+ } else if (BF_GLOBALS.getFlag(gunDrawn)) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 1356;
+ setAction(&_sequenceManager, this, 1358, &BF_GLOBALS._player, NULL);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 1356;
+ setAction(&_sequenceManager, this, 1356, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ case 9985:
+ _sceneMode = 0;
+ _stripManager.start(3569, this);
+ BF_INVENTORY.setObjectScene(INV_GRENADES, 1);
+ BF_GLOBALS._uiElements.addScore(50);
+ BF_GLOBALS._player._regionBitList |= 0x10;
+ break;
+ case 9986:
+ if (_nextSceneMode) {
+ _sceneMode = _item3._state;
+ signal();
+ } else {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = _item3._state;
+ setAction(&_sequenceManager, this, 3553, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ case 9987:
+ if (_nextSceneMode) {
+ _nextSceneMode = 0;
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 3555;
+ setAction(&_sequenceManager, this, 3555, &BF_GLOBALS._player, NULL);
+ } else {
+ _nextSceneMode = 1;
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 3553;
+ setAction(&_sequenceManager, this, 3553, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ case 9988:
+ BF_GLOBALS._uiElements.addScore(30);
+ if ((BF_INVENTORY.getObjectScene(INV_RAGS) == 0) && (BF_INVENTORY.getObjectScene(INV_JAR) == 0) &&
+ (BF_INVENTORY.getObjectScene(INV_FLARE) == 0)) {
+ _object6.postInit();
+ _object6.setVisage(373);
+ _object6.setPosition(Common::Point(-10, -10));
+ _object6._flag = 0;
+
+ _object9.postInit();
+ _object9.setPosition(Common::Point(-10, -10));
+ _object10.postInit();
+ _object10.setPosition(Common::Point(-10, -10));
+ _object11.postInit();
+ _object11.setPosition(Common::Point(-10, -10));
+
+ BF_GLOBALS._sceneItems.push_front(&_object6);
+ BF_GLOBALS.setFlag(fTookTrailerAmmo);
+ BF_GLOBALS._sound1.fade(0, 5, 60, true, NULL);
+ _sceneMode = 4550;
+
+ setAction(&_sequenceManager, this, 4550, &_doorway, &_object6, &_object9, &_object10, &_object11, NULL);
+ } else {
+ BF_GLOBALS._player.enableControl();
+ }
+ break;
+ case 9989:
+ _lockerDoor.postInit();
+ _lockerDoor.setVisage(2356);
+ _lockerDoor.setStrip(2);
+ BF_GLOBALS._sceneItems.push_front(&_lockerDoor);
+
+ if (BF_INVENTORY.getObjectScene(INV_SCREWDRIVER) == 999) {
+ _lockerDoor.setFrame(2);
+ if (BF_INVENTORY.getObjectScene(INV_FLARE) == 355) {
+ _object5.postInit();
+ _object5.setVisage(2356);
+ _object5.setStrip(3);
+ _object5.setPosition(Common::Point(67, 85));
+ _object5.fixPriority(255);
+ BF_GLOBALS._sceneItems.push_front(&_object5);
+ }
+ } else {
+ _lockerDoor.setFrame(1);
+ }
+
+ _lockerDoor.setPosition(Common::Point(82, 115));
+ _lockerDoor.fixPriority(254);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9990:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 3556;
+ ADD_PLAYER_MOVER(145, 145);
+ break;
+ case 9991:
+ setMode(false, 0);
+ break;
+ case 9992:
+ _sceneMode = 9993;
+ ADD_PLAYER_MOVER(59, 174);
+ break;
+ case 9993:
+ BF_INVENTORY.setObjectScene(INV_SCREWDRIVER, 1);
+ SceneItem::display2(355, 29);
+ BF_GLOBALS._uiElements.addScore(30);
+ _sceneMode = 0;
+ signal();
+ break;
+ case 9996: {
+ _sceneMode = 9989;
+ ADD_PLAYER_MOVER(116, 146);
+ break;
+ }
+ case 9997:
+ _sceneMode = 9999;
+ _doorway._v1 = 2;
+ _stripManager.start(3562, this);
+ break;
+ case 9998:
+ error("Talkdoor state");
+ break;
+ case 9999:
+ if (_doorway._v1 != 2) {
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player._canWalk = false;
+ } else if (BF_GLOBALS.getFlag(gunDrawn)) {
+ _sceneMode = 2358;
+ setAction(&_sequenceManager, this, 2359, &BF_GLOBALS._player, &_doorway, &_harrison, NULL);
+ } else {
+ _sceneMode = 2358;
+ setAction(&_sequenceManager, this, 2358, &BF_GLOBALS._player, &_doorway, &_harrison, NULL);
+ }
+ break;
+ case 0:
+ case 3555:
+ default:
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene355::process(Event &event) {
+ if (BF_GLOBALS._dayNumber == 5) {
+ // Handling for day 5
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ // Check if the cursor is on an exit
+ if (_item12.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_NW);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+
+ // Special handling of actions
+ if (event.eventType == EVENT_BUTTON_DOWN) {
+ switch (BF_GLOBALS._events.getCursor()) {
+ case INV_COLT45:
+ if (BF_GLOBALS._player.contains(event.mousePos)) {
+ BF_GLOBALS._player.addMover(NULL);
+
+ if (BF_GLOBALS.getFlag(gunDrawn)) {
+ BF_GLOBALS.clearFlag(gunDrawn);
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 1357;
+ setAction(&_sequenceManager, this, 3560, &BF_GLOBALS._player, NULL);
+ } else {
+ BF_GLOBALS.setFlag(gunDrawn);
+ if (_modeFlag) {
+ setMode(true, 3561);
+ } else {
+ _sceneMode = 3561;
+ signal();
+ }
+ }
+ }
+ break;
+ case CURSOR_WALK:
+ if (BF_GLOBALS.getFlag(gunDrawn))
+ event.handled = true;
+ break;
+ case CURSOR_LOOK:
+ case CURSOR_TALK:
+ break;
+ case CURSOR_USE:
+ if (BF_GLOBALS.getFlag(gunDrawn)) {
+ SceneItem::display2(355, 50);
+ event.handled = true;
+ }
+ break;
+ default:
+ if (BF_GLOBALS.getFlag(gunDrawn)) {
+ SceneItem::display2(355, 50);
+ event.handled = true;
+ }
+ break;
+ }
+ }
+ } else {
+ // All other days
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ // Check if the cursor is on an exit
+ if (_item2.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(!_modeFlag ? EXITFRAME_SW : EXITFRAME_NE);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+
+ if ((_sceneMode != 2357) && (_sceneMode != 1357) && !BF_GLOBALS.getFlag(greenTaken) &&
+ (event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == INV_COLT45)) {
+ if (BF_GLOBALS._player.contains(event.mousePos)) {
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS.getFlag(gunDrawn)) {
+ BF_GLOBALS.clearFlag(gunDrawn);
+ _sceneMode = 2357;
+ setAction(&_sequenceManager, this, 2357, &BF_GLOBALS._player, &_harrison, NULL);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 1357;
+ setAction(&_sequenceManager, this, 1357, &BF_GLOBALS._player, &_harrison, NULL);
+ BF_GLOBALS.setFlag(gunDrawn);
+ }
+ } else {
+ _item11.startAction(INV_COLT45, event);
+ }
+ event.handled = true;
+ }
+ }
+
+ PalettedScene::process(event);
+}
+
+void Scene355::dispatch() {
+ PalettedScene::dispatch();
+ if (BF_GLOBALS._sceneObjects->contains(&_object7)) {
+ _object7.updateAngle(BF_GLOBALS._player._position);
+ }
+
+ if (!_action && (BF_GLOBALS._player.getRegionIndex() == 20)) {
+ ADD_MOVER(BF_GLOBALS._player, 238, 142);
+ }
+}
+
+void Scene355::setMode(bool mode, int sceneMode) {
+ Scene355 *scene = (Scene355 *)BF_GLOBALS._sceneManager._scene;
+
+ if (mode) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = sceneMode;
+ setAction(&scene->_sequenceManager, this, 4553, &BF_GLOBALS._player, NULL);
+ _modeFlag = false;
+ } else {
+ _sceneMode = 9990;
+ _nextSceneMode = sceneMode;
+ signal();
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 360 - Future Wave Interior
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene360::Item1::startAction(CursorType action, Event &event) {
+ Scene360 *scene = (Scene360 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(360, 9);
+ return true;
+ case CURSOR_TALK:
+ scene->_sceneMode = 3607;
+ BF_GLOBALS._player.disableControl();
+ scene->_stripManager.start(3550, this);
+ return true;
+ case INV_COLT45:
+ SceneItem::display2(1, 4);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene360::Item2::startAction(CursorType action, Event &event) {
+ Scene360 *scene = (Scene360 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(360, 10);
+ return true;
+ case CURSOR_USE:
+ if (BF_GLOBALS._dayNumber != 4)
+ SceneItem::display2(360, 5);
+ else
+ scene->setAction(&scene->_action1);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene360::Item3::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(360, 11);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(360, 12);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene360::Barometer::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(360, 15);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(360, 16);
+ return true;
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene360::SlidingDoor::startAction(CursorType action, Event &event) {
+ Scene360 *scene = (Scene360 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(360, 0);
+ return true;
+ case CURSOR_USE:
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS.getFlag(greenTaken)) {
+ scene->_sceneMode = 3611;
+ setAction(&scene->_sequenceManager1, scene, 3611, &BF_GLOBALS._player, this, NULL);
+ } else {
+ scene->_sceneMode = 3604;
+ setAction(&scene->_sequenceManager1, scene, 3604, &BF_GLOBALS._player, NULL);
+ }
+ return true;
+ case CURSOR_TALK:
+ scene->_sceneMode = 3607;
+ BF_GLOBALS._player.disableControl();
+ scene->_stripManager.start(3550, scene);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene360::Window::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(360, 13);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(360, 14);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene360::Object4::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(360, 3);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(360, 2);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene360::BsseballCards::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ if (event.mousePos.x >= (_bounds.left + _bounds.width() / 2))
+ SceneItem::display2(360, 4);
+ else
+ SceneItem::display2(360, 22);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(360, 2);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene360::Object6::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(360, 6);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(360, 7);
+ return true;
+ case CURSOR_TALK:
+ SceneItem::display2(360, 8);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene360::Object7::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(360, 1);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(360, 21);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene360::Action1::signal() {
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ ADD_PLAYER_MOVER(153, 115);
+ break;
+ case 1:
+ BF_GLOBALS._player.setStrip(7);
+ if (BF_INVENTORY.getObjectScene(INV_WAREHOUSE_KEYS) == 360) {
+ SceneItem::display2(360, 20);
+ BF_INVENTORY.setObjectScene(INV_WAREHOUSE_KEYS, 1);
+ BF_GLOBALS._uiElements.addScore(30);
+ } else {
+ SceneItem::display2(360, 5);
+ }
+
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene360::Scene360() {
+ _field380 = 0;
+}
+
+void Scene360::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_field380);
+}
+
+void Scene360::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(760);
+ setZoomPercents(108, 90, 135, 100);
+ _sound1.play(125);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeUniformSpeaker);
+ _stripManager.addSpeaker(&_harrisonSpeaker);
+ _stripManager.addSpeaker(&_greenSpeaker);
+
+ _item2._sceneRegionId = 11;
+ BF_GLOBALS._sceneItems.push_back(&_item2);
+
+ _slidingDoor.postInit();
+ _slidingDoor.setVisage(760);
+ _slidingDoor.setPosition(Common::Point(42, 120));
+ _slidingDoor.setStrip(2);
+ _slidingDoor.fixPriority(85);
+ BF_GLOBALS._sceneItems.push_back(&_slidingDoor);
+
+ _window.postInit();
+ _window.setVisage(760);
+ _window.setStrip(4);
+ _window.setPosition(Common::Point(176, 43));
+ _window.fixPriority(10);
+ _window._numFrames = 2;
+ _window.animate(ANIM_MODE_8, 0, NULL);
+ BF_GLOBALS._sceneItems.push_back(&_window);
+
+ _object4.postInit();
+ _object4.setVisage(760);
+ _object4.setStrip(5);
+ _object4.setPosition(Common::Point(157, 75));
+ _object4.fixPriority(50);
+ BF_GLOBALS._sceneItems.push_back(&_object4);
+
+ if (BF_GLOBALS._dayNumber <= 1) {
+ _object7.postInit();
+ _object7.setVisage(760);
+ _object7.setStrip(1);
+ _object7.setPosition(Common::Point(246, 105));
+ _object7.fixPriority(50);
+ BF_GLOBALS._sceneItems.push_back(&_object7);
+
+ _baseballCards.postInit();
+ _baseballCards.setVisage(760);
+ _baseballCards.setStrip(6);
+ _baseballCards.setPosition(Common::Point(159, 115));
+ _baseballCards.fixPriority(50);
+ BF_GLOBALS._sceneItems.push_back(&_baseballCards);
+ }
+
+ BF_GLOBALS._player.postInit();
+ if (BF_GLOBALS.getFlag(onDuty)) {
+ if (BF_GLOBALS.getFlag(gunDrawn)) {
+ BF_GLOBALS._player.setVisage(1351);
+ BF_GLOBALS._player._moveDiff.x = 5;
+ } else {
+ BF_GLOBALS._player.setVisage(361);
+ BF_GLOBALS._player._moveDiff.x = 6;
+ }
+ } else {
+ BF_GLOBALS._player.setVisage(368);
+ BF_GLOBALS._player._moveDiff.x = 6;
+ }
+
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.setStrip(3);
+ BF_GLOBALS._player.setPosition(Common::Point(340, 160));
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player._moveDiff.y = 4;
+ BF_GLOBALS._player.enableControl();
+
+ if (BF_GLOBALS._sceneManager._previousScene == 370) {
+ BF_GLOBALS._player.setPosition(Common::Point(62, 122));
+ } else {
+ BF_GLOBALS._player.setPosition(Common::Point(253, 135));
+ BF_GLOBALS._player.setStrip(2);
+
+ if (BF_GLOBALS.getFlag(fBackupIn350)) {
+ _object6.postInit();
+ _object6.setVisage(BF_GLOBALS.getFlag(gunDrawn) ? 363 : 1363);
+ _object6.animate(ANIM_MODE_1, NULL);
+ _object6.setObjectWrapper(new SceneObjectWrapper());
+ _object6.setPosition(Common::Point(235, 150));
+ _object6.setStrip(2);
+ BF_GLOBALS._sceneItems.push_back(&_object6);
+ }
+
+ _sceneMode = 3607;
+ if (BF_GLOBALS.getFlag(greenTaken)) {
+ _slidingDoor.setPosition(Common::Point(42, 120));
+ } else {
+ BF_GLOBALS._player.disableControl();
+
+ _object2.postInit();
+ _object2.setPosition(Common::Point(-40, -40));
+
+ _slidingDoor.setPosition(Common::Point(6, 130));
+ _slidingDoor.setAction(&_sequenceManager1, this, 3606, &_slidingDoor, &_object7, NULL);
+ }
+ }
+
+ _barometer._sceneRegionId = 9;
+ BF_GLOBALS._sceneItems.push_back(&_barometer);
+ _item3._sceneRegionId = 10;
+ BF_GLOBALS._sceneItems.push_back(&_item3);
+ _item1.setBounds(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y));
+ BF_GLOBALS._sceneItems.push_back(&_item1);
+}
+
+void Scene360::signal() {
+ switch (_sceneMode) {
+ case 3600:
+ case 3611:
+ BF_GLOBALS._sceneManager.changeScene(370);
+ break;
+ case 3602:
+ BF_GLOBALS.setFlag(gunDrawn);
+ BF_GLOBALS._deathReason = BF_GLOBALS.getFlag(fBackupIn350) ? 2 : 1;
+ BF_GLOBALS._player.setPosition(Common::Point(BF_GLOBALS._player._position.x - 20,
+ BF_GLOBALS._player._position.y));
+ _sceneMode = 3610;
+ setAction(&_sequenceManager1, this, 3610, &_slidingDoor, &_object2, &BF_GLOBALS._player, NULL);
+ break;
+ case 3603:
+ _sceneMode = 3605;
+ setAction(&_sequenceManager1, this, 3605, &BF_GLOBALS._player, &_slidingDoor, NULL);
+ break;
+ case 3604:
+ _sceneMode = BF_GLOBALS.getFlag(fBackupIn350) ? 3603 : 3605;
+ setAction(&_sequenceManager1, this, _sceneMode, &_object6, NULL);
+ break;
+ case 3605:
+ if (BF_GLOBALS.getFlag(fBackupIn350)) {
+ _sceneMode = 3600;
+ setAction(&_sequenceManager1, this, 3600, NULL);
+ } else {
+ BF_GLOBALS._deathReason = BF_GLOBALS.getFlag(fBackupIn350) ? 2 : 1;
+ _sceneMode = 3610;
+ setAction(&_sequenceManager1, this, 3601, &BF_GLOBALS._player, NULL);
+ }
+ break;
+ case 3607:
+ case 3609:
+ _object6.setVisage(1363);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 3608:
+ BF_GLOBALS._sceneManager.changeScene(355);
+ break;
+ case 3610:
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 9998:
+ BF_GLOBALS._player.setVisage(1351);
+ BF_GLOBALS._player._moveDiff.x = 5;
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9999:
+ BF_GLOBALS._player.setVisage(361);
+ BF_GLOBALS._player._moveDiff.x = 6;
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.enableControl();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene360::process(Event &event) {
+ SceneExt::process(event);
+
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == INV_COLT45) &&
+ BF_GLOBALS._player.contains(event.mousePos) && !BF_GLOBALS.getFlag(greenTaken)) {
+ // Player clicked gun on themselves
+ if (BF_GLOBALS.getFlag(gunDrawn)) {
+ // Handle holstering gun
+ if (BF_GLOBALS._player._position.x <= 160)
+ SceneItem::display2(360, 18);
+ else {
+ if (BF_GLOBALS.getFlag(fBackupIn350))
+ SceneItem::display2(360, 19);
+
+ BF_GLOBALS.clearFlag(gunDrawn);
+ _sceneMode = 9999;
+ BF_GLOBALS._player.setVisage(1361);
+ BF_GLOBALS._player.addMover(NULL);
+ BF_GLOBALS._player.setFrame(BF_GLOBALS._player.getFrameCount());
+ BF_GLOBALS._player.animate(ANIM_MODE_6, this);
+
+ _object6.setVisage(1363);
+ }
+ } else {
+ // Handle drawing gun
+ if (BF_GLOBALS.getFlag(fBackupIn350))
+ SceneItem::display2(360, 19);
+
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.addMover(NULL);
+ BF_GLOBALS._player.setVisage(1361);
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player.animate(ANIM_MODE_5, this);
+
+ BF_GLOBALS.setFlag(gunDrawn);
+ _sceneMode = 9998;
+ _object6.setVisage(363);
+ }
+
+ event.handled = true;
+ }
+}
+
+void Scene360::dispatch() {
+ SceneExt::dispatch();
+
+ if (!_action) {
+ if (BF_GLOBALS._player.getRegionIndex() == 8) {
+ // Leaving the boat
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS.getFlag(fBackupIn350)) {
+ BF_GLOBALS._player.addMover(NULL);
+ _sceneMode = 3609;
+ setAction(&_sequenceManager1, this, 3609, &BF_GLOBALS._player, NULL);
+ } else {
+ BF_GLOBALS._sceneManager.changeScene(355);
+ }
+ }
+
+ if ((BF_GLOBALS._player._position.x <= 168) && !BF_GLOBALS.getFlag(greenTaken) &&
+ !BF_GLOBALS.getFlag(gunDrawn)) {
+ // Moving to doorway without drawn gun before Green is captured
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.addMover(NULL);
+ _sceneMode = 3602;
+ setAction(&_sequenceManager1, this, 3602, &_slidingDoor, &_object2, &BF_GLOBALS._player, NULL);
+ }
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 370 - Future Wave Bedroom
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene370::GreensGun::startAction(CursorType action, Event &event) {
+ Scene370 *scene = (Scene370 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(370, 4);
+ return true;
+ case CURSOR_USE:
+ if ((BF_INVENTORY.getObjectScene(INV_HANDCUFFS) != 1) || BF_GLOBALS.getFlag(greenTaken)) {
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._walkRegions.proc2(3);
+ scene->_sceneMode = 3711;
+ scene->setAction(&scene->_sequenceManager, scene, 3711, &BF_GLOBALS._player, this, NULL);
+ } else {
+ SceneItem::display2(370, 5);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene370::Green::startAction(CursorType action, Event &event) {
+ Scene370 *scene = (Scene370 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(370, (_v2 < 3) ? 10 : 0);
+ return true;
+ case CURSOR_USE:
+ if (_v2 != 3)
+ SceneItem::display2(370, 1);
+ else if (BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 1)
+ SceneItem::display2(370, 26);
+ else if (BF_INVENTORY.getObjectScene(INV_GREENS_KNIFE) == 1) {
+ scene->_sceneMode = 2;
+ scene->_stripManager.start(3717, scene);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._walkRegions.proc2(3);
+ scene->_sceneMode = 3715;
+ scene->setAction(&scene->_sequenceManager, scene, 3715, &BF_GLOBALS._player, this, NULL);
+ }
+ return true;
+ case CURSOR_TALK:
+ BF_GLOBALS._player.disableControl();
+ switch (_v2) {
+ case 0:
+ ++_v2;
+ scene->_sceneMode = 3706;
+ scene->setAction(&scene->_sequenceManager, scene, 3706, NULL);
+ break;
+ case 1:
+ ++_v2;
+ scene->_sceneMode = 3707;
+
+ scene->_object5.postInit();
+ scene->_object5.setVisage(362);
+ scene->_object5.setStrip(3);
+ scene->_object5.setPosition(scene->_harrison._position);
+ scene->_object5.hide();
+
+ scene->setAction(&scene->_sequenceManager, scene, 3707, &scene->_harrison, &scene->_object5, NULL);
+ break;
+ case 2:
+ ++_v2;
+ scene->_sceneMode = 3708;
+ scene->setAction(&scene->_sequenceManager, scene, 3708, this, &scene->_laura, &scene->_harrison,
+ &scene->_object5, &scene->_greensGun, NULL);
+ break;
+ case 3:
+ scene->_sceneMode = BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 1 ? 3713 : 2;
+ scene->_stripManager.start(3717, scene);
+ break;
+ default:
+ break;
+ }
+ return true;
+ case INV_COLT45:
+ if ((BF_INVENTORY.getObjectScene(INV_GREENS_GUN) == 370) || (BF_INVENTORY.getObjectScene(INV_GREENS_GUN) == 1))
+ SceneItem::display2(370, 28);
+ else if (!BF_GLOBALS.getHasBullets())
+ SceneItem::display2(1, 1);
+ else {
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._deathReason = 9;
+ scene->_sceneMode = 3702;
+ scene->setAction(&scene->_sequenceManager, scene, 3702, &BF_GLOBALS._player, this, &scene->_harrison, NULL);
+ }
+ return true;
+ case INV_HANDCUFFS:
+ if (_v2 != 3)
+ SceneItem::display2(370, 2);
+ else {
+ BF_GLOBALS._uiElements.addScore(50);
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3704;
+ scene->setAction(&scene->_sequenceManager, scene, 3704, &BF_GLOBALS._player, this, &scene->_harrison, NULL);
+ }
+ return true;
+ case INV_MIRANDA_CARD:
+ if (BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 1)
+ SceneItem::display2(370, 5);
+ else if (BF_GLOBALS.getFlag(readGreenRights))
+ SceneItem::display2(390, 15);
+ else {
+ BF_GLOBALS.setFlag(readGreenRights);
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.updateAngle(this->_position);
+ scene->_sceneMode = 3717;
+ scene->setAction(&scene->_sequenceManager, scene, 3717, &BF_GLOBALS._player, NULL);
+ }
+ return true;
+ default:
+ break;
+ }
+
+ return NamedObject2::startAction(action, event);
+}
+
+bool Scene370::Harrison::startAction(CursorType action, Event &event) {
+ Scene370 *scene = (Scene370 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(370, 8);
+ return true;
+ case CURSOR_TALK:
+ if (scene->_green._v2 != 3) {
+ scene->_sceneMode = 3;
+ scene->_stripManager.start(3714, scene);
+ } else if ((BF_INVENTORY.getObjectScene(INV_GREENS_KNIFE) == 1) ||
+ ((BF_INVENTORY.getObjectScene(INV_GREENS_GUN) == 1) && BF_GLOBALS._sceneObjects->contains(&scene->_laura))) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3716;
+ scene->setAction(&scene->_sequenceManager, scene, 3716, &BF_GLOBALS._player, &scene->_green, this, NULL);
+ } else {
+ BF_GLOBALS._player.updateAngle(this->_position);
+ scene->_stripManager.start(3715, scene);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene370::Laura::startAction(CursorType action, Event &event) {
+ Scene370 *scene = (Scene370 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(370, 11);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(370, BF_GLOBALS._sceneObjects->contains(&scene->_green) ? 12 : 13);
+ return true;
+ case CURSOR_TALK:
+ if (BF_INVENTORY.getObjectScene(INV_HANDCUFFS) != 1) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3705;
+ scene->setAction(&scene->_sequenceManager, scene, 3705, &BF_GLOBALS._player, this, NULL);
+ return true;
+ }
+ // Deliberate fall-through
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene370::Item1::startAction(CursorType action, Event &event) {
+ Scene370 *scene = (Scene370 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(370, 15);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(370, 16);
+ return true;
+ case INV_COLT45:
+ if (BF_GLOBALS._sceneObjects->contains(&scene->_green) && (BF_INVENTORY.getObjectScene(INV_GREENS_GUN) != 370)) {
+ scene->_green.setAction(NULL);
+ scene->_sceneMode = 3703;
+ scene->setAction(&scene->_sequenceManager, scene, 3703, &BF_GLOBALS._player, &scene->_green, &scene->_harrison, NULL);
+ return true;
+ }
+ // Deliberate fall-through
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene370::Item6::startAction(CursorType action, Event &event) {
+ Scene370 *scene = (Scene370 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(370, 14);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(370, 29);
+ return true;
+ case INV_COLT45:
+ if (BF_GLOBALS._sceneObjects->contains(&scene->_green) && (BF_INVENTORY.getObjectScene(INV_GREENS_GUN) != 370) &&
+ (BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 1)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_green.setAction(NULL);
+ scene->_sceneMode = 3703;
+ scene->setAction(&scene->_sequenceManager, scene, 3703, &BF_GLOBALS._player, &scene->_green, &scene->_harrison, NULL);
+ return true;
+ }
+ // Deliberate fall-through
+ default:
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+
+bool Scene370::Exit::startAction(CursorType action, Event &event) {
+ Scene370 *scene = (Scene370 *)BF_GLOBALS._sceneManager._scene;
+
+ if (BF_GLOBALS._sceneObjects->contains(&scene->_green))
+ return false;
+ else {
+ ADD_PLAYER_MOVER(event.mousePos.x, event.mousePos.y);
+ return true;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene370::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(370);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeUniformSpeaker);
+ _stripManager.addSpeaker(&_lauraSpeaker);
+ _stripManager.addSpeaker(&_lauraHeldSpeaker);
+ _stripManager.addSpeaker(&_greenSpeaker);
+ _stripManager.addSpeaker(&_harrisonSpeaker);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(1351);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.setStrip(8);
+ BF_GLOBALS._player.setPosition(Common::Point(310, 153));
+ BF_GLOBALS._player._moveDiff = Common::Point(7, 2);
+ BF_GLOBALS._player.disableControl();
+
+ if (BF_GLOBALS.getFlag(greenTaken)) {
+ // Green has already been arrested
+ BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 361 : 368);
+ BF_GLOBALS._player._moveDiff.x = 6;
+ BF_GLOBALS._player.enableControl();
+ } else {
+ // Hostage scene setup
+ _green.postInit();
+ _green.setVisage(373);
+ _green.setStrip(2);
+ _green._numFrames = 5;
+ _green.setPosition(Common::Point(164, 137));
+ _green.animate(ANIM_MODE_7, 0, NULL);
+ _green.fixPriority(125);
+ BF_GLOBALS._sceneItems.push_back(&_green);
+
+ _laura.postInit();
+ _laura.setVisage(374);
+ _laura.setStrip(2);
+ _laura.setPosition(_green._position);
+ _laura.hide();
+ _laura.animate(ANIM_MODE_1, NULL);
+
+ _harrison.postInit();
+ _harrison.setVisage(372);
+ _harrison.setPosition(Common::Point(256, 166));
+ BF_GLOBALS._sceneItems.push_back(&_harrison);
+
+ _sceneMode = 3700;
+ setAction(&_sequenceManager, this, 3700, NULL);
+ }
+
+ if ((BF_INVENTORY.getObjectScene(INV_GREENS_GUN) != 320) && (BF_INVENTORY.getObjectScene(INV_GREENS_GUN) != 1)) {
+ _greensGun.postInit();
+ _greensGun.setVisage(362);
+ _greensGun.setStrip(6);
+ _greensGun.setPosition(_green._position);
+ _greensGun.fixPriority(149);
+ _greensGun.hide();
+ }
+
+ if ((BF_INVENTORY.getObjectScene(INV_GREENS_GUN) == 370) && (BF_GLOBALS._dayNumber == 1)) {
+ _greensGun.setPosition(Common::Point(172, 137));
+ _greensGun.show();
+ BF_GLOBALS._sceneItems.push_front(&_greensGun);
+ }
+
+ _item1._sceneRegionId = 8;
+ BF_GLOBALS._sceneItems.push_back(&_item1);
+ _item2.setDetails(9, 370, 17, -1, 18, 1);
+ _item3.setDetails(10, 370, 19, -1, 20, 1);
+ _item4.setDetails(11, 370, 21, -1, 22, 1);
+ _item5.setDetails(12, 370, 23, -1, 24, 1);
+ _exit.setDetails(Rect(316, 133, 320, 166), 360, -1, -1, -1, 1, NULL);
+ _item6.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
+
+ BF_GLOBALS._sceneItems.push_back(&_item6);
+ BF_GLOBALS._sceneItems.remove(&BF_GLOBALS._player);
+ BF_GLOBALS._sceneItems.push_back(&BF_GLOBALS._player);
+}
+
+void Scene370::signal() {
+ switch (_sceneMode) {
+ case 1:
+ BF_GLOBALS._bookmark = bArrestedGreen;
+ BF_GLOBALS._sceneManager.changeScene(350);
+ break;
+ case 2:
+ case 3717:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 3:
+ break;
+ case 3707:
+ _object5.setDetails(370, 6, -1, 7, 1, NULL);
+ BF_GLOBALS._sceneItems.push_back(&_object5);
+ // Deliberate fall-through
+ case 3700:
+ case 3706:
+ _green.setAction(&_sequenceManager, this, 3701, NULL);
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player._canWalk = false;
+ break;
+ case 3701:
+ BF_GLOBALS._player.disableControl();
+ setAction(&_sequenceManager, this, 3710, NULL);
+ break;
+ case 3702:
+ // Player tried to shoot Green
+ BF_GLOBALS._deathReason = 2;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 3703:
+ // Player dropped his gun
+ BF_GLOBALS._deathReason = 9;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 3704:
+ BF_GLOBALS.clearFlag(gunDrawn);
+ BF_INVENTORY.setObjectScene(INV_HANDCUFFS, 390);
+ BF_GLOBALS._player.setVisage(361);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.setStrip(3);
+
+ BF_GLOBALS._sceneItems.push_front(&_laura);
+ BF_GLOBALS._walkRegions.proc1(3);
+ _harrison.setAction(NULL);
+ BF_GLOBALS._player.enableControl();
+
+ BF_GLOBALS.set2Flags(f1015Marina);
+ BF_GLOBALS.set2Flags(f1027Marina);
+ BF_GLOBALS.set2Flags(f1098Marina);
+ break;
+ case 3705:
+ _laura.remove();
+ BF_GLOBALS._walkRegions.proc2(6);
+ BF_GLOBALS._walkRegions.proc2(1);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 3708:
+ _sound1.play(6);
+ BF_GLOBALS._sound1.changeSound(35);
+ BF_INVENTORY.setObjectScene(INV_GREENS_GUN, 370);
+ BF_GLOBALS._uiElements.addScore(50);
+ BF_GLOBALS._sceneItems.push_front(&_greensGun);
+
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player._canWalk = false;
+
+ _sceneMode = 0;
+ _object5.remove();
+ _green.setAction(NULL);
+ BF_GLOBALS._walkRegions.proc1(6);
+ BF_GLOBALS._walkRegions.proc1(1);
+ break;
+ case 3709:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 3713;
+ setAction(&_sequenceManager, this, 3713, NULL);
+ break;
+ case 3710:
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player._canWalk = false;
+ _sceneMode = 3701;
+ _green.setAction(&_sequenceManager, this, 3701, NULL);
+ break;
+ case 3711:
+ BF_GLOBALS._walkRegions.proc1(3);
+ BF_INVENTORY.setObjectScene(INV_GREENS_GUN, 1);
+ BF_GLOBALS._uiElements.addScore(30);
+ _greensGun.remove();
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 3712:
+ BF_GLOBALS._uiElements._active = false;
+ BF_GLOBALS._uiElements.hide();
+
+ if (BF_GLOBALS._sceneObjects->contains(&_greensGun))
+ _greensGun.remove();
+ _sceneMode = 1;
+ setAction(&_sequenceManager, this, 3714, NULL);
+ break;
+ case 3713:
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player._canWalk = false;
+ break;
+ case 3715:
+ BF_GLOBALS._uiElements.addScore(50);
+ BF_INVENTORY.setObjectScene(INV_GREEN_ID, 1);
+ BF_INVENTORY.setObjectScene(INV_GREENS_KNIFE, 1);
+ BF_GLOBALS._walkRegions.proc1(3);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 3716:
+ BF_GLOBALS.clearFlag(fCalledBackup);
+ BF_GLOBALS.clearFlag(fBackupIn350);
+ BF_GLOBALS.clearFlag(fBackupArrived340);
+ BF_GLOBALS.setFlag(greenTaken);
+ BF_GLOBALS.setFlag(fToldToLeave340);
+
+ BF_GLOBALS._bookmark = bCalledToDomesticViolence;
+ _harrison.remove();
+ _green.remove();
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene370::process(Event &event) {
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ // Check if the cursor is on an exit
+ if (_exit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_E);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+}
+
+void Scene370::dispatch() {
+ SceneExt::dispatch();
+
+ if ((BF_GLOBALS._player._position.x >= 316) && !BF_GLOBALS._sceneObjects->contains(&_laura) &&
+ !BF_GLOBALS._sceneObjects->contains(&_green)) {
+ if (BF_GLOBALS._bookmark < bArrestedGreen) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 3712;
+ setAction(&_sequenceManager, this, 3712, &BF_GLOBALS._player, NULL);
+ } else {
+ BF_GLOBALS._sound1.fadeSound(35);
+ BF_GLOBALS._sceneManager.changeScene(360);
+ }
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 380 - Outside City Hall & Jail
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene380::Vechile::startAction(CursorType action, Event &event) {
+ Scene380 *scene = (Scene380 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1;
+ scene->setAction(&scene->_sequenceManager, scene, 3802, &BF_GLOBALS._player, NULL);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene380::Door::startAction(CursorType action, Event &event) {
+ Scene380 *scene = (Scene380 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2;
+ scene->setAction(&scene->_sequenceManager, scene, 3800, &BF_GLOBALS._player, &scene->_door, NULL);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene380::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(380);
+ setZoomPercents(68, 80, 131, 100);
+
+ BF_GLOBALS._sound1.fadeSound(33);
+ BF_GLOBALS._walkRegions.proc1(9);
+
+ _door.postInit();
+ _door.setVisage(380);
+ _door.setStrip(4);
+ _door.setPosition(Common::Point(132, 66));
+ _door.setDetails(380, 12, 13, -1, 1, NULL);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.changeZoom(-1);
+
+ _vechile.postInit();
+ _vechile.setVisage(380);
+ _vechile.fixPriority(109);
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ // Show vechile as car
+ _vechile.setStrip(3);
+ _vechile.setPosition(Common::Point(273, 125));
+ _vechile.setDetails(580, 2, 3, -1, 1, NULL);
+
+ BF_GLOBALS._player.setVisage(129);
+ BF_GLOBALS._walkRegions.proc1(12);
+ BF_GLOBALS._walkRegions.proc1(18);
+ BF_GLOBALS._walkRegions.proc1(19);
+ BF_GLOBALS._walkRegions.proc1(20);
+ BF_GLOBALS._walkRegions.proc1(25);
+ BF_GLOBALS._walkRegions.proc1(26);
+ BF_GLOBALS._walkRegions.proc1(27);
+ } else if (BF_GLOBALS.getFlag(onDuty)) {
+ // Show on duty motorcycle
+ _vechile.setStrip(2);
+ _vechile.setDetails(300, 11, 13, -1, 1, NULL);
+ _vechile.setPosition(Common::Point(252, 115));
+
+ BF_GLOBALS._player.setVisage(1341);
+ } else {
+ // Show off duty motorcycle
+ _vechile.setStrip(1);
+ _vechile.setDetails(580, 0, 1, -1, 1, NULL);
+ _vechile.setPosition(Common::Point(249, 110));
+
+ BF_GLOBALS._player.setVisage(129);
+ }
+
+ BF_GLOBALS._player.updateAngle(_vechile._position);
+ BF_GLOBALS._sceneItems.push_back(&_door);
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 50:
+ case 60:
+ case 330:
+ case 370:
+ BF_GLOBALS._player.setPosition(Common::Point(251, 100));
+ BF_GLOBALS._player._strip = 3;
+ BF_GLOBALS._player.enableControl();
+ break;
+ default:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager, this, 3801, &BF_GLOBALS._player, &_door, NULL);
+ break;
+ }
+
+ _item1.setDetails(7, 380, 0, 1, 2, 1);
+ _item2.setDetails(9, 380, 3, 4, 5, 1);
+ _item3.setDetails(17, 380, 6, 7, 8, 1);
+ _item4.setDetails(20, 380, 9, 10, 11, 1);
+ _item5.setDetails(15, 380, 14, 15, 16, 1);
+ _item6.setDetails(4, 380, 17, 18, 19, 1);
+ _item7.setDetails(19, 380, 20, 4, 21, 1);
+ _item8.setDetails(18, 380, 22, 23, 24, 1);
+ _item9.setDetails(6, 380, 25, 26, 27, 1);
+}
+
+void Scene380::signal() {
+ switch (_sceneMode) {
+ case 1:
+ BF_GLOBALS._sceneManager.changeScene(60);
+ break;
+ case 2:
+ BF_GLOBALS._sceneManager.changeScene(385);
+ break;
+ default:
+ BF_GLOBALS._player.enableControl();
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 385 - City Hall
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene385::Action1::signal() {
+ Scene385 *scene = (Scene385 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+
+ switch (scene->_talkAction) {
+ case 0:
+ error("Bugs::talkscript385");
+ break;
+ case 3850:
+ case 3851:
+ case 3852:
+ case 3853:
+ case 3854:
+ case 3855:
+ case 3856:
+ case 3857:
+ case 3863:
+ case 3866: {
+ ADD_PLAYER_MOVER(187, 144);
+ break;
+ }
+ default: {
+ ADD_PLAYER_MOVER(231, 158);
+ break;
+ }
+ }
+ break;
+ case 1:
+ BF_GLOBALS._player.changeAngle(45);
+ setDelay(3);
+ break;
+ case 2:
+ scene->_stripManager.start(scene->_talkAction, this);
+ break;
+ case 3:
+ if (scene->_talkAction)
+ scene->_dezi.animate(ANIM_MODE_5, NULL);
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ }
+}
+
+void Scene385::Action2::signal() {
+ Scene385 *scene = (Scene385 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ ADD_PLAYER_MOVER(231, 158);
+ break;
+ }
+ case 1:
+ BF_GLOBALS._player.updateAngle(BF_GLOBALS._player._position);
+ setDelay(3);
+ break;
+ case 2:
+ scene->_stripManager.start(3864, this);
+ break;
+ case 3:
+ scene->_jim.animate(ANIM_MODE_5, this);
+ break;
+ case 4:
+ scene->_jim.setStrip(4);
+ scene->_jim.animate(ANIM_MODE_5, this);
+ break;
+ case 5:
+ scene->_stripManager.start(3865, this);
+ break;
+ case 6:
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene385::Door::startAction(CursorType action, Event &event) {
+ Scene385 *scene = (Scene385 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ BF_GLOBALS._walkRegions.proc2(6);
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3850;
+ scene->setAction(&scene->_sequenceManager, scene, 3850, &BF_GLOBALS._player, this, NULL);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene385::Jim::startAction(CursorType action, Event &event) {
+ Scene385 *scene = (Scene385 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ if (scene->_jimFlag) {
+ scene->_talkAction = 3867;
+ scene->setAction(&scene->_action1);
+ } else {
+ switch (BF_GLOBALS._dayNumber) {
+ case 1:
+ scene->_talkAction = 3858;
+ break;
+ case 2:
+ scene->_talkAction = 3859;
+ break;
+ case 3:
+ scene->_talkAction = 3860;
+ break;
+ case 4:
+ scene->_talkAction = 3861;
+ break;
+ default:
+ BF_GLOBALS._deziTopic = 3;
+ scene->_talkAction = 3868;
+ break;
+ }
+
+ scene->_jimFlag = 1;
+ scene->setAction(&scene->_action1);
+ }
+ return true;
+ case INV_PRINT_OUT:
+ if (!BF_GLOBALS.getFlag(fGotPointsForMCard)) {
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.getFlag(fGotPointsForMCard);
+
+ scene->setAction(&scene->_action2);
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+}
+
+bool Scene385::Dezi::startAction(CursorType action, Event &event) {
+ Scene385 *scene = (Scene385 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ if (BF_GLOBALS._deziTopic == 3) {
+ scene->_talkAction = 3857;
+ } else {
+ BF_GLOBALS._deziTopic = 3;
+
+ switch (BF_GLOBALS._dayNumber) {
+ case 1:
+ if (BF_GLOBALS._deziTopic++ == 0) {
+ scene->_talkAction = 3850;
+ } else {
+ BF_GLOBALS._deziTopic = 3;
+ scene->_talkAction = 3851;
+ }
+ break;
+ case 2:
+ if (BF_GLOBALS._deziTopic++ == 0) {
+ scene->_talkAction = 3852;
+ } else {
+ BF_GLOBALS._deziTopic = 3;
+ scene->_talkAction = 3853;
+ }
+ break;
+ case 3:
+ if (BF_GLOBALS._deziTopic++ == 0) {
+ scene->_talkAction = 3854;
+ } else {
+ BF_GLOBALS._deziTopic = 3;
+ scene->_talkAction = 3855;
+ }
+ break;
+ case 4:
+ BF_GLOBALS._deziTopic = 3;
+ scene->_talkAction = 3856;
+ break;
+ default:
+ BF_GLOBALS._deziTopic = 3;
+ scene->_talkAction = 3868;
+ break;
+ }
+ }
+
+ scene->setAction(&scene->_action1);
+ return true;
+ case INV_PRINT_OUT:
+ scene->_talkAction = 3863;
+ scene->setAction(&scene->_action1);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene385::Exit::startAction(CursorType action, Event &event) {
+ ADD_PLAYER_MOVER(BF_GLOBALS._player._position.x - 100, BF_GLOBALS._player._position.y + 100);
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+
+Scene385::Scene385(): SceneExt() {
+ _talkAction = _jimFlag = 0;
+}
+
+void Scene385::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_talkAction);
+ s.syncAsSint16LE(_jimFlag);
+}
+
+void Scene385::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ if (BF_GLOBALS._dayNumber == 0)
+ BF_GLOBALS._dayNumber = 1;
+
+ _exit.setDetails(Rect(0, 162, 320, 167), 385, -1, -1, -1, 1, NULL);
+ BF_GLOBALS._sound1.fadeSound(119);
+
+ loadScene(385);
+ setZoomPercents(115, 90, 145, 100);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jake385Speaker);
+ _stripManager.addSpeaker(&_jimSpeaker);
+ _stripManager.addSpeaker(&_deziSpeaker);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 361 : 368);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.enableControl();
+
+ _item3.setDetails(1, 385, 5, -1, -1, 1);
+ _item2.setDetails(2, 385, 7, -1, -1, 1);
+ _item1.setDetails(3, 385, 6, -1, 6, 1);
+ _item5.setDetails(4, 385, 14, -1, -1, 1);
+
+ _jim.postInit();
+ _jim.setVisage(385);
+ _jim.setStrip(3);
+ _jim.setPosition(Common::Point(304, 113));
+ _jim.setDetails(385, 1, -1, 2, 1, NULL);
+
+ _dezi.postInit();
+ _dezi.setVisage(385);
+ _dezi.setStrip(2);
+ _dezi.setPosition(Common::Point(235, 93));
+ _dezi.fixPriority(120);
+ _dezi.setDetails(385, 3, -1, 2, 1, NULL);
+
+ _door.postInit();
+ _door.setVisage(385);
+ _door.setPosition(Common::Point(107, 27));
+ _door.setDetails(385, 0, -1, -1, 1, NULL);
+
+ BF_GLOBALS._walkRegions.proc1(6);
+
+ if (BF_GLOBALS._sceneManager._previousScene == 390) {
+ BF_GLOBALS._player.setPosition(Common::Point(109, 119));
+ } else {
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.setPosition(Common::Point(15, 250));
+ _sceneMode = 3852;
+ setAction(&_sequenceManager, this, 3852, &BF_GLOBALS._player, NULL);
+ }
+
+ _item4.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 385, 4, -1, -1, 1, NULL);
+}
+
+void Scene385::signal() {
+ switch (_sceneMode) {
+ case 3850:
+ BF_GLOBALS._sceneManager.changeScene(390);
+ break;
+ case 3851:
+ BF_GLOBALS._sceneManager.changeScene(380);
+ break;
+ case 3852:
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene385::process(Event &event) {
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ // Check if the cursor is on an exit
+ if (_exit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+}
+
+void Scene385::dispatch() {
+ SceneExt::dispatch();
+
+ if (!_action && (BF_GLOBALS._player._position.y > 162)) {
+ // Leaving by exit
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 3851;
+ setAction(&_sequenceManager, this, 3851, &BF_GLOBALS._player, NULL);
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 390 - City Jail
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene390::Action1::signal() {
+ Scene390 *scene = (Scene390 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(1);
+ break;
+ case 1:
+ switch (scene->_sceneMode) {
+ case 3900:
+ case 3905:
+ case 3906:
+ case 3913:
+ case 3914:
+ case 3916:
+ case 3917: {
+ ADD_PLAYER_MOVER(75, 122);
+ break;
+ }
+ default: {
+ ADD_PLAYER_MOVER(147, 133);
+ break;
+ }
+ }
+ break;
+ case 2:
+ switch (scene->_sceneMode) {
+ case 3900:
+ case 3905:
+ case 3906:
+ case 3913:
+ case 3914:
+ case 3916:
+ case 3917: {
+ BF_GLOBALS._player.changeAngle(315);
+ break;
+ }
+ default: {
+ BF_GLOBALS._player.changeAngle(90);
+ break;
+ }
+ }
+ setDelay(1);
+ break;
+ case 3:
+ scene->_stripManager.start(scene->_sceneMode, this);
+ break;
+ case 4:
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene390::BookingForms::startAction(CursorType action, Event &event) {
+ Scene390 *scene = (Scene390 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (_flag) {
+ SceneItem::display2(390, 16);
+ } else if (!BF_GLOBALS.getFlag(onDuty)) {
+ SceneItem::display2(390, 22);
+ } else if (((BF_GLOBALS._bookmark < bLauraToParamedics) && BF_GLOBALS.getFlag(greenTaken)) ||
+ ((BF_GLOBALS._bookmark >= bStoppedFrankie) && !BF_GLOBALS.getFlag(frankInJail) && (BF_GLOBALS._dayNumber == 1))) {
+ BF_GLOBALS._player.disableControl();
+ ++_flag;
+ scene->_sceneMode = 3902;
+ setAction(&scene->_sequenceManager, scene, 3902, &BF_GLOBALS._player, NULL);
+ } else {
+ SceneItem::display2(390, 23);
+ }
+ return true;
+ default:
+ return NamedHotspotExt::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene390::Green::startAction(CursorType action, Event &event) {
+ Scene390 *scene = (Scene390 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ if (!_flag) {
+ ++_flag;
+ scene->_sceneMode = 3901;
+ } else {
+ scene->_sceneMode = 3902;
+ }
+ scene->setAction(&scene->_action1);
+ return true;
+ case INV_MIRANDA_CARD:
+ if (BF_GLOBALS.getFlag(readGreenRights)) {
+ SceneItem::display2(390, 15);
+ } else {
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(readGreenRights);
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3904;
+
+ scene->setAction(&scene->_sequenceManager, scene, 3904, &BF_GLOBALS._player, this, NULL);
+ }
+ return true;
+ default:
+ return NamedObjectExt::startAction(action, event);
+ }
+}
+
+bool Scene390::Object2::startAction(CursorType action, Event &event) {
+ Scene390 *scene = (Scene390 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ if (!_flag)
+ break;
+
+ if (!BF_GLOBALS.getFlag(onDuty)) {
+ scene->_sceneMode = 3917;
+ } else if (BF_GLOBALS.getFlag(fTalkedToBarry) && !BF_GLOBALS.getFlag(fTalkedToLarry)) {
+ scene->_sceneMode = 3913;
+ } else if (!BF_GLOBALS.getFlag(fTalkedToLarry)) {
+ scene->_sceneMode = 3914;
+ } else {
+ ++_flag;
+
+ if (BF_GLOBALS._sceneObjects->contains(&scene->_green)) {
+ scene->_sceneMode = 3900;
+ } else if (!BF_GLOBALS._sceneObjects->contains(&scene->_green)) {
+ scene->_sceneMode = 3905;
+ } else if (BF_GLOBALS.getFlag(fCuffedFrankie)) {
+ scene->_sceneMode = 3906;
+ } else {
+ scene->_sceneMode = 3916;
+ }
+ }
+
+ BF_GLOBALS.setFlag(fTalkedToLarry);
+ scene->setAction(&scene->_action1);
+ return true;
+ case INV_BOOKING_GREEN:
+ if (BF_GLOBALS._bookmark >= bLauraToParamedics)
+ SceneItem::display2(390, 21);
+ else {
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._bookmark = bLauraToParamedics;
+ scene->_sceneMode = 3905;
+
+ BF_INVENTORY.setObjectScene(INV_GREEN_ID, 390);
+ if (BF_GLOBALS.getFlag(fLeftTraceIn910))
+ BF_GLOBALS.clearFlag(fLeftTraceIn910);
+
+ scene->setAction(&scene->_sequenceManager, scene, 3905, &BF_GLOBALS._player, this, NULL);
+ BF_GLOBALS.clearFlag(f1015Marina);
+ BF_GLOBALS.clearFlag(f1027Marina);
+ BF_GLOBALS.clearFlag(f1035Marina);
+ }
+ return true;
+ case INV_BOOKING_FRANKIE:
+ case INV_BOOKING_GANG:
+ if (BF_GLOBALS.getFlag(frankInJail)) {
+ SceneItem::display2(390, 21);
+ } else {
+ scene->_sceneMode = 3905;
+ BF_GLOBALS._player.disableControl();
+ scene->setAction(&scene->_sequenceManager, scene, 3905, &BF_GLOBALS._player, this, NULL);
+
+ BF_INVENTORY.setObjectScene(INV_FRANKIE_ID, 390);
+ BF_INVENTORY.setObjectScene(INV_TYRONE_ID, 390);
+ BF_GLOBALS.clearFlag(frankInJail);
+ BF_GLOBALS.clearFlag(f1015Frankie);
+ BF_GLOBALS.clearFlag(f1027Frankie);
+ BF_GLOBALS.clearFlag(f1035Frankie);
+ }
+ return true;
+ default:
+ break;
+ }
+
+ return NamedObjectExt::startAction(action, event);
+}
+
+bool Scene390::Object3::startAction(CursorType action, Event &event) {
+ Scene390 *scene = (Scene390 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case INV_GREEN_ID:
+ scene->_sceneMode = 3903;
+ setAction(&scene->_sequenceManager, scene, 3902, &BF_GLOBALS._player, NULL);
+ remove();
+ BF_INVENTORY.setObjectScene(INV_BOOKING_GREEN, 1);
+ return true;
+ case INV_FRANKIE_ID:
+ BF_INVENTORY.setObjectScene(INV_BOOKING_FRANKIE, 1);
+ scene->_sceneMode = 3903;
+ setAction(&scene->_sequenceManager, scene, 3902, &BF_GLOBALS._player, NULL);
+ remove();
+ return true;
+ case INV_TYRONE_ID:
+ scene->_sceneMode = 3903;
+ setAction(&scene->_sequenceManager, scene, 3902, &BF_GLOBALS._player, NULL);
+ remove();
+ BF_INVENTORY.setObjectScene(INV_BOOKING_GANG, 1);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene390::GangMember1::startAction(CursorType action, Event &event) {
+ Scene390 *scene = (Scene390 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ scene->_sceneMode = 3908;
+ scene->setAction(&scene->_action1);
+ return true;
+ case INV_MIRANDA_CARD:
+ if (BF_GLOBALS.getFlag(readFrankRights)) {
+ SceneItem::display2(390, 15);
+ } else {
+ BF_GLOBALS.setFlag(readFrankRights);
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS._player.disableControl();
+
+ scene->_sceneMode = 3904;
+ scene->setAction(&scene->_sequenceManager, scene, 3907, &BF_GLOBALS._player, NULL);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene390::GangMember2::startAction(CursorType action, Event &event) {
+ Scene390 *scene = (Scene390 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ scene->_sceneMode = 3909;
+ scene->setAction(&scene->_action1);
+ return true;
+ case INV_MIRANDA_CARD:
+ if (BF_GLOBALS.getFlag(readFrankRights)) {
+ SceneItem::display2(390, 15);
+ } else {
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(readFrankRights);
+ BF_GLOBALS._player.disableControl();
+
+ scene->_sceneMode = 3904;
+ scene->setAction(&scene->_sequenceManager, scene, 3907, &BF_GLOBALS._player, NULL);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene390::Door::startAction(CursorType action, Event &event) {
+ Scene390 *scene = (Scene390 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if ((BF_INVENTORY.getObjectScene(INV_BOOKING_GREEN) == 1) && (BF_INVENTORY.getObjectScene(INV_GREEN_ID) == 1)) {
+ scene->_stripManager.start(3918, &BF_GLOBALS._stripProxy);
+ } else if ((BF_INVENTORY.getObjectScene(INV_BOOKING_FRANKIE) == 1) && (BF_INVENTORY.getObjectScene(INV_FRANKIE_ID) == 1)) {
+ scene->_stripManager.start(3918, &BF_GLOBALS._stripProxy);
+ } else if ((BF_INVENTORY.getObjectScene(INV_BOOKING_GANG) == 1) && (BF_INVENTORY.getObjectScene(INV_TYRONE_ID) == 1)) {
+ scene->_stripManager.start(3918, &BF_GLOBALS._stripProxy);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 3900;
+ scene->setAction(&scene->_sequenceManager, scene, 3900, &BF_GLOBALS._player, this, NULL);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene390::postInit(TsAGE::SceneObjectList *OwnerList) {
+ BF_GLOBALS._sound1.play(17);
+ SceneExt::postInit();
+ setZoomPercents(105, 85, 130, 100);
+ loadScene(390);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeUniformSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ _stripManager.addSpeaker(&_greenSpeaker);
+ _stripManager.addSpeaker(&_jailerSpeaker);
+ _stripManager.addSpeaker(&_shooterSpeaker);
+ _stripManager.addSpeaker(&_driverSpeaker);
+
+ if (BF_GLOBALS._dayNumber == 0) {
+ BF_GLOBALS.setFlag(onDuty);
+ BF_GLOBALS._bookmark = bStoppedFrankie;
+ BF_GLOBALS.clearFlag(frankInJail);
+ BF_GLOBALS.setFlag(fTalkedToBarry);
+ BF_INVENTORY.setObjectScene(INV_22_SNUB, 1);
+ }
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 361 : 368);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.setPosition(Common::Point(147, 114));
+ BF_GLOBALS._player.setStrip(6);
+ BF_GLOBALS._player.changeZoom(-1);
+
+ _object2.postInit();
+ _object2.setVisage(395);
+ _object2.setStrip(2);
+ _object2.setPosition(Common::Point(38, 84));
+ _object2.fixPriority(50);
+ _object2._flag = 0;
+ _object2.setDetails(390, 10, 17, 10, 1, NULL);
+
+ _door.postInit();
+ _door.setVisage(390);
+ _door.setStrip(2);
+ _door.setPosition(Common::Point(151, 18));
+ _door.setDetails(390, 5, -1, -1, 1, NULL);
+
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 3901;
+ setAction(&_sequenceManager, this, 3901, &BF_GLOBALS._player, NULL);
+
+ if ((BF_GLOBALS._bookmark < bLauraToParamedics) && BF_GLOBALS.getFlag(greenTaken)) {
+ _green.postInit();
+ _green.setVisage(392);
+ _green.setPosition(Common::Point(241, 164));
+ _green.fixPriority(153);
+ _green.setDetails(390, 12, -1, 13, 1, NULL);
+ _green._flag = 0;
+ }
+
+ if ((BF_GLOBALS._bookmark >= bStoppedFrankie) && !BF_GLOBALS.getFlag(frankInJail) && (BF_GLOBALS._dayNumber == 1)) {
+ _gangMember1.postInit();
+ _gangMember1.setVisage(396);
+ _gangMember1.setPosition(Common::Point(273, 169));
+ _gangMember1.fixPriority(152);
+ _gangMember1._flag = 0;
+ _gangMember1.setDetails(390, 19, -1, 20, 1, NULL);
+
+ _gangMember2.postInit();
+ _gangMember2.setVisage(396);
+ _gangMember2.setStrip(2);
+ _gangMember2.setPosition(Common::Point(241, 153));
+ _gangMember2.fixPriority(152);
+ _gangMember2._flag = 0;
+ _gangMember2.setDetails(390, 19, -1, 20, 1, NULL);
+ }
+
+ _item1.setDetails(Rect(22, 40, 77, 67), 390, 0, -1, 1, 1, NULL);
+ _bookingForms.setDetails(Rect(89, 46, 110, 65), 390, 2, -1, -1, 1, NULL);
+ _item3.setDetails(Rect(193, 0, 320, 165), 390, 4, -1, -1, 1, NULL);
+ _item4.setDetails(Rect(0, 0, 320, 170), 390, 7, -1, -1, 1, NULL);
+}
+
+void Scene390::signal() {
+ switch (_sceneMode) {
+ case 3900:
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(385);
+ break;
+ case 3901:
+ case 3904:
+ if ((BF_INVENTORY.getObjectScene(INV_22_SNUB) == 410) && BF_GLOBALS._sceneObjects->contains(&_gangMember1)) {
+ _sceneMode = 3906;
+ setAction(&_sequenceManager, this, 3906, &BF_GLOBALS._player, &_object2, NULL);
+ } else if ((BF_INVENTORY.getObjectScene(INV_GREENS_KNIFE) == 370) && BF_GLOBALS._sceneObjects->contains(&_green)) {
+ _sceneMode = 3906;
+ setAction(&_sequenceManager, this, 3906, &BF_GLOBALS._player, &_object2, NULL);
+ } else {
+ BF_GLOBALS._player.enableControl();
+ }
+ break;
+ case 3902:
+ SceneItem::display2(390, 3);
+
+ _object3.postInit();
+ _object3.setVisage(390);
+ _object3.setPosition(Common::Point(250, 60));
+ _object3.fixPriority(255);
+ _object3.setDetails(390, 8, -1, 9, 2, NULL);
+
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 3903:
+ SceneItem::display2(390, 18);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 3905:
+ BF_GLOBALS._uiElements.addScore(30);
+ _object2.remove();
+ BF_INVENTORY.setObjectScene(INV_HANDCUFFS, 1);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 3906:
+ BF_GLOBALS._deathReason = 18;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ }
+}
+
} // End of namespace BlueForce
} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_scenes3.h b/engines/tsage/blue_force/blueforce_scenes3.h
index 42ae69fc3f..86150433fd 100644
--- a/engines/tsage/blue_force/blueforce_scenes3.h
+++ b/engines/tsage/blue_force/blueforce_scenes3.h
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
#include "tsage/blue_force/blueforce_logic.h"
+#include "tsage/blue_force/blueforce_speakers.h"
#include "tsage/converse.h"
#include "tsage/events.h"
#include "tsage/core.h"
@@ -46,29 +47,29 @@ class Scene300: public SceneExt {
public:
Object(int stripNumber) { _stripNumber = stripNumber; }
- virtual void startMover(CursorType action);
+ virtual bool startAction(CursorType action, Event &event);
};
- class Object17: public NamedObject {
+ class Object19: public NamedObject {
public:
- virtual void startMover(CursorType action);
+ virtual bool startAction(CursorType action, Event &event);
};
/* Items */
class Item1: public NamedHotspot {
public:
- virtual void startMover(CursorType action);
+ virtual bool startAction(CursorType action, Event &event);
};
class Item2: public NamedHotspot {
public:
- virtual void startMover(CursorType action);
+ virtual bool startAction(CursorType action, Event &event);
};
class Item14: public NamedHotspot {
public:
- virtual void startMover(CursorType action);
+ virtual bool startAction(CursorType action, Event &event);
};
class Item15: public NamedHotspot {
public:
- virtual void startMover(CursorType action);
+ virtual bool startAction(CursorType action, Event &event);
};
/* Actions */
@@ -102,8 +103,8 @@ public:
SceneObject _object8, _object9, _object10;
NamedObject _object11, _object12;
Object _object13, _object14, _object15, _object16;
- Object17 _object17;
- NamedObject _object18, _object19;
+ NamedObject _object17, _object18;
+ Object19 _object19;
Item1 _item1;
Item2 _item2;
NamedHotspot _item3, _item4, _item5, _item6, _item7;
@@ -130,6 +131,761 @@ public:
virtual void dispatch();
};
+class Scene315: public SceneExt {
+ /* Objects */
+ class BulletinMemo: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object2: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class ATFMemo: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Barry: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class SutterSlot: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Sign: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class BulletinBoard: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class CleaningKit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class BriefingMaterial: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class WestExit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class SouthWestExit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Actions */
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerSutter _sutterSpeaker;
+ SpeakerHarrison _harrisonSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerJakeUniform _jakeUniformSpeaker;
+ SpeakerJailer _jailerSpeaker;
+ Barry _barry;
+ SutterSlot _sutterSlot;
+ NamedHotspot _item3;
+ Sign _sign;
+ BulletinBoard _bulletinBoard;
+ BulletinMemo _bulletinMemo;
+ Object2 _object2;
+ ATFMemo _atfMemo;
+ SceneObject _object4, _object5, _object6;
+ SceneObject _object7, _object8, _object9;
+ NamedHotspot _item6, _item7, _item8, _item9;
+ NamedHotspot _item10, _item11, _item12, _item13;
+ CleaningKit _cleaningKit;
+ BriefingMaterial _briefingMaterial;
+ WestExit _westExit;
+ SouthWestExit _swExit;
+ Action1 _action1;
+ int _field1390;
+ int _stripNumber;
+ int _field1398;
+ int _field1B60, _field1B62, _field1B64;
+ int _field1B66, _field1B6C, _field139C;
+ bool _field1B68, _field1B6A;
+ CursorType _currentCursor;
+
+ Scene315();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene325: public SceneExt {
+ /* Items */
+ class Item1: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerPSutter _PSutterSpeaker;
+ Item1 _item1;
+ NamedObject _object1, _object2, _object3, _object4, _object5;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
+class Scene330: public SceneExt {
+ class Timer1: public Timer {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ NamedObject _object1;
+ SceneObject _object2;
+ ASoundExt _sound1, _sound2;
+ Timer1 _timer;
+ int _seqNumber;
+
+ Scene330();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+};
+
+class Scene340: public PalettedScene {
+ /* Actions */
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action3: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action4: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action5: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action6: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action7: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action8: public Action {
+ public:
+ virtual void signal();
+ void process(Event &event);
+ };
+
+ /* Items */
+ class Item1: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class WestExit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class SouthWestExit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class NorthExit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Objects */
+ class Child: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Woman: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Harrison: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Timers */
+ class Timer2: public Timer {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager1, _sequenceManager2, _sequenceManager3;
+ Child _child;
+ Woman _woman;
+ Harrison _harrison;
+ SceneObject _object4, _object5;
+ Item1 _item1;
+ NamedHotspot _item2, _item3;
+ WestExit _westExit;
+ SouthWestExit _swExit;
+ NorthExit _northExit;
+ Action1 _action1;
+ Action2 _action2;
+ Action3 _action3;
+ Action4 _action4;
+ Action5 _action5;
+ Action6 _action6;
+ Action7 _action7;
+ Action8 _action8;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJordan _jordanSpeaker;
+ SpeakerSkipB _skipBSpeaker;
+ SpeakerJakeUniform _jakeUniformSpeaker;
+ SpeakerHarrison _harrisonSpeaker;
+ ASoundExt _sound1, _sound2;
+ TimerExt _timer1;
+ Timer2 _timer2;
+ int _seqNumber1, _field2652, _field2654;
+
+ Scene340();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene342: public PalettedScene {
+ /* Items */
+ class Item1: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class WestExit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class SouthWestExit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class NorthExit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Objects */
+ class Lyle: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Timers */
+ class Timer1: public Timer {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager1, _sequenceManager2;
+ Lyle _lyle;
+ NamedObject _object2;
+ SceneObject _object3, _object4;
+ Item1 _item1;
+ NamedHotspot _item2, _item3;
+ WestExit _westExit;
+ SouthWestExit _swExit;
+ NorthExit _northExit;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerLyleHat _lyleHatSpeaker;
+ ASoundExt _sound1;
+ Timer1 _timer1;
+ int _field1A1A;
+
+ Scene342();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene350: public SceneExt {
+ /* Items */
+ class Item5: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Yacht: public NamedHotspot {
+ public:
+ bool _flag;
+
+ virtual Common::String getClassName() { return "Scene350_Item6"; }
+ virtual void synchronize(Serializer &s);
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class SouthWestExit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Objects */
+ class Hook: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object5: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Timers */
+ class Timer1: public Timer {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager1, _sequenceManager2, _sequenceManager3;
+ NamedObject _harrison;
+ SceneObject _yachtDoor;
+ BackgroundSceneObject _yachtBody;
+ Hook _hook;
+ Object5 _object5;
+ NamedHotspot _item1, _item2, _item3, _item4;
+ Item5 _item5;
+ Yacht _yacht;
+ SouthWestExit _swExit;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeUniform _jakeUniformSpeaker;
+ SpeakerHarrison _harrisonSpeaker;
+ ASoundExt _sound1, _sound2;
+ Timer1 _timer1;
+ int _field1D44, _field1D46;
+
+ Scene350();
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void checkGun();
+};
+
+class Scene355: public PalettedScene {
+ /* Objects */
+ class Doorway: public NamedObject {
+ public:
+ int _v1, _v2, _v3;
+
+ Doorway() { _v1 = _v2 = _v3 = 0; }
+ virtual Common::String getClassName() { return "Scene355_Doorway"; }
+ virtual void synchronize(Serializer &s);
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Locker: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class LockerDoor: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object5: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object6: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object7: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object8: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Item1: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item2: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item3: public SceneHotspotExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item4: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item5: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item11: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item12: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Actions */
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeUniform _jakeUniformSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerHarrison _harrisonSpeaker;
+ SpeakerLyleHat _lyleHatSpeaker;
+ SpeakerGreen _greenSpeaker;
+ NamedObject _harrison;
+ Doorway _doorway;
+ Locker _locker;
+ LockerDoor _lockerDoor;
+ Object5 _object5;
+ Object6 _object6;
+ Object7 _object7;
+ Object8 _object8;
+ NamedObject _object9, _object10, _object11;
+ Item1 _item1;
+ Item2 _item2;
+ Item3 _item3;
+ Item4 _item4;
+ Item5 _item5;
+ NamedHotspot _item6, _item7, _item8;
+ NamedHotspot _item9, _item10;
+ Item11 _item11;
+ Item12 _item12;
+ ASoundExt _sound1, _sound2, _sound3;
+ Action1 _action1;
+ Action2 _action2;
+ int _nextSceneMode;
+ bool _modeFlag;
+
+ Scene355();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+
+ void setMode(bool mode, int sceneMode);
+};
+
+class Scene360: public SceneExt {
+ /* Objects */
+ class SlidingDoor: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Window: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object4: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class BsseballCards: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object6: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object7: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Item1: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item2: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item3: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Barometer: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Actions */
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager1, _sequenceManager2;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeUniform _jakeUniformSpeaker;
+ SpeakerHarrison _harrisonSpeaker;
+ SpeakerGreen _greenSpeaker;
+ SlidingDoor _slidingDoor;
+ SceneObject _object2;
+ Window _window;
+ Object4 _object4;
+ BsseballCards _baseballCards;
+ Object6 _object6;
+ Object7 _object7;
+ Item1 _item1;
+ Item2 _item2;
+ Item3 _item3;
+ Barometer _barometer;
+ Action1 _action1;
+ ASound _sound1;
+ int _field380;
+
+ Scene360();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene370: public SceneExt {
+ /* Items */
+ class Item1: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item6: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Exit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Objects */
+ class GreensGun: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Green: public NamedObject2 {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Harrison: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Laura: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Speakers */
+ class SpeakerLaura370: public SpeakerLaura {
+ public:
+ virtual void setText(const Common::String &msg);
+ };
+public:
+ SequenceManager _sequenceManager;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeUniform _jakeUniformSpeaker;
+ SpeakerLaura _lauraSpeaker;
+ SpeakerLauraHeld _lauraHeldSpeaker;
+ SpeakerGreen _greenSpeaker;
+ SpeakerHarrison _harrisonSpeaker;
+ GreensGun _greensGun;
+ Green _green;
+ Harrison _harrison;
+ Laura _laura;
+ NamedObject _object5;
+ SceneObject _object6;
+ Item1 _item1;
+ NamedHotspot _item2, _item3, _item4, _item5;
+ Item6 _item6;
+ Exit _exit;
+ ASound _sound1;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene380: public SceneExt {
+ /* Objects */
+ class Vechile: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Door: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager;
+ SpeakerGameText _gameTextSpeaker;
+ Vechile _vechile;
+ Door _door;
+ NamedHotspot _item1, _item2, _item3, _item4, _item5;
+ NamedHotspot _item6, _item7, _item8, _item9;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
+class Scene385: public SceneExt {
+ /* Items */
+ class Exit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Objects */
+ class Door: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Jim: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Dezi: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Actions */
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ Action1 _action1;
+ Action2 _action2;
+ Door _door;
+ Jim _jim;
+ Dezi _dezi;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJim _jimSpeaker;
+ SpeakerDezi _deziSpeaker;
+ SpeakerJake385 _jake385Speaker;
+ NamedHotspot _item1, _item2, _item3, _item4, _item5;
+ Exit _exit;
+ int _talkAction, _jimFlag;
+
+ Scene385();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene390: public SceneExt {
+ /* Items */
+ class BookingForms: public NamedHotspotExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Objects */
+ class Green: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object2: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object3: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class GangMember1: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class GangMember2: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Door: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Actions */
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeUniform _jakeUniformSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerGreen _greenSpeaker;
+ SpeakerJailer _jailerSpeaker;
+ SpeakerDriver _driverSpeaker;
+ SpeakerShooter _shooterSpeaker;
+ Action1 _action1;
+ Green _green;
+ Object2 _object2;
+ Object3 _object3;
+ GangMember1 _gangMember1;
+ GangMember2 _gangMember2;
+ Door _door;
+ NamedHotspot _item1, _item3, _item4;
+ BookingForms _bookingForms;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
} // End of namespace BlueForce
} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_scenes4.cpp b/engines/tsage/blue_force/blueforce_scenes4.cpp
new file mode 100644
index 0000000000..07445a7e76
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_scenes4.cpp
@@ -0,0 +1,1659 @@
+/* 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 "tsage/blue_force/blueforce_scenes4.h"
+#include "tsage/blue_force/blueforce_dialogs.h"
+#include "tsage/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/staticres.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+/*--------------------------------------------------------------------------
+ * Scene 410 - Traffic Stop Gang Members
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene410::Action1::signal() {
+ Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (scene->_field1FB6++) {
+ case 0:
+ if (BF_GLOBALS.getFlag(fTalkedDriverNoBkup)) {
+ setDelay(3);
+ } else {
+ scene->_sceneMode = 4101;
+ scene->_stripManager.start(4103, scene);
+ }
+ break;
+ case 1:
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(4104, scene);
+ break;
+ case 2:
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(4105, scene);
+ break;
+ default:
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(4106, scene);
+ break;
+ }
+}
+
+void Scene410::Action2::signal() {
+ Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
+ BF_GLOBALS._player.disableControl();
+
+ switch (scene->_field1FB8++) {
+ case 0:
+ scene->_sceneMode = 4105;
+ scene->_stripManager.start(BF_GLOBALS.getFlag(fTalkedShooterNoBkup) ? 4123 : 4107, scene);
+ break;
+ case 1:
+ scene->_sceneMode = 4110;
+ scene->_stripManager.start(4102, scene);
+ break;
+ case 2:
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(4108, scene);
+ break;
+ case 3:
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(4109, scene);
+ break;
+ case 4:
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(4110, scene);
+ break;
+ default:
+ SceneItem::display(410, 11, SET_WIDTH, 300,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 10,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + BF_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 13, SET_EXT_BGCOLOR, 82,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene410::Action3::signal() {
+ Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
+ if (BF_GLOBALS.getFlag(fTalkedShooterNoBkup)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2;
+ scene->setAction(&scene->_sequenceManager1, scene, 4102, &scene->_object2, &BF_GLOBALS._player, NULL);
+ } else {
+ BF_GLOBALS.setFlag(fTalkedShooterNoBkup);
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(4107, scene);
+ }
+}
+
+void Scene410::Action4::signal() {
+ Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ if (scene->_field1FC4 == 0) {
+ ADD_PLAYER_MOVER(114, 133);
+ } else {
+ ADD_PLAYER_MOVER(195, 139);
+ }
+ break;
+ case 1:
+ BF_GLOBALS._player.updateAngle(scene->_object2._position);
+ setDelay(3);
+ break;
+ case 2:
+ setDelay(3);
+ break;
+ case 3:
+ if (BF_GLOBALS.getFlag(fCalledBackup))
+ scene->setAction(&scene->_action2);
+ else
+ scene->setAction(&scene->_action3);
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene410::Action5::signal() {
+ Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ if (scene->_field1FC4 == 0) {
+ ADD_PLAYER_MOVER(114, 133);
+ } else {
+ ADD_PLAYER_MOVER(195, 139);
+ }
+ break;
+ case 1:
+ BF_GLOBALS._player.updateAngle(scene->_object2._position);
+ setDelay(3);
+ break;
+ case 2:
+ setDelay(3);
+ break;
+ case 3:
+ if (BF_GLOBALS.getFlag(fCalledBackup))
+ scene->setAction(&scene->_action2);
+ else
+ scene->setAction(&scene->_action3);
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene410::Action6::signal() {
+ Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ if (scene->_field1FC4 == 0) {
+ ADD_PLAYER_MOVER(114, 133);
+ } else {
+ ADD_PLAYER_MOVER(126, 99);
+ }
+ break;
+ case 1:
+ BF_GLOBALS._player.updateAngle(scene->_object1._position);
+ setDelay(3);
+ break;
+ case 2:
+ setDelay(3);
+ break;
+ case 3:
+ if (BF_GLOBALS.getFlag(fCalledBackup))
+ scene->setAction(&scene->_action1);
+ else
+ scene->setAction(&scene->_action4);
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene410::Action7::signal() {
+ Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ setDelay(2);
+ break;
+ case 1:
+ BF_GLOBALS._bookmark = bStoppedFrankie;
+ BF_GLOBALS.set2Flags(f1098Frankie);
+ BF_GLOBALS.clearFlag(f1098Marina);
+ scene->_stripManager.start(4113, this);
+ break;
+ case 2:
+ case 4:
+ setDelay(2);
+ break;
+ case 3:
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.updateAngle(Common::Point(100, 170));
+ scene->setAction(&scene->_sequenceManager1, this, 4112, &scene->_object1, &scene->_object2,
+ &scene->_object3, NULL);
+ break;
+ case 5:
+ BF_GLOBALS._uiElements.addScore(30);
+ setAction(&scene->_sequenceManager1, this, 4118, &BF_GLOBALS._player, NULL);
+ BF_GLOBALS._player.disableControl();
+ break;
+ case 6:
+ scene->_sceneMode = 3;
+ scene->signal();
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene410::Item2::startAction(CursorType action, Event &event) {
+ Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (!BF_GLOBALS.getFlag(fCalledBackup)) {
+ scene->_sceneMode = 4103;
+ scene->signal();
+ } else if (BF_GLOBALS.getFlag(fSearchedTruck) && !BF_GLOBALS._sceneObjects->contains(&scene->_object3)) {
+ scene->_sceneMode = 4103;
+ scene->signal();
+ } else if (scene->_field1FBC != 0) {
+ SceneItem::display2(410, 12);
+ } else {
+ scene->_sceneMode = 4103;
+ scene->signal();
+ }
+ return true;
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene410::Item4::startAction(CursorType action, Event &event) {
+ Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if ((BF_GLOBALS._bookmark < bStoppedFrankie) && (!scene->_field1FBC || !scene->_field1FBA))
+ break;
+ else if (BF_GLOBALS.getFlag(fSearchedTruck))
+ SceneItem::display2(410, 13);
+ else if (BF_GLOBALS.getFlag(fGangInCar)) {
+ BF_GLOBALS._uiElements.addScore(30);
+ scene->_sceneMode = 4118;
+ scene->signal();
+ } else {
+ scene->setAction(&scene->_action7);
+ }
+ return true;
+ default:
+ break;
+ }
+
+ return NamedHotspot::startAction(action, event);
+}
+
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene410::Object1::startAction(CursorType action, Event &event) {
+ Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (!BF_GLOBALS.getFlag(fCalledBackup)) {
+ if (BF_GLOBALS.getFlag(fTalkedDriverNoBkup)) {
+ scene->setAction(&scene->_action4);
+ } else {
+ SceneItem::display2(410, 7);
+ }
+ } else if (!scene->_field1FBC) {
+ SceneItem::display2(410, 7);
+ } else if (!scene->_field1FC0) {
+ scene->_sceneMode = 4124;
+ scene->_field1FC0 = 1;
+ BF_GLOBALS._uiElements.addScore(30);
+ scene->signal();
+ } else {
+ break;
+ }
+ return true;
+ case CURSOR_TALK:
+ BF_GLOBALS._player.setAction(&scene->_action6);
+ return true;
+ case INV_HANDCUFFS:
+ if (BF_GLOBALS.getFlag(fCalledBackup)) {
+ if ((scene->_field1FB8 < 5) || (scene->_field1FB6 < 1) || (scene->_field1FBC != 0))
+ break;
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 4123;
+ scene->_stripManager.start(4125, scene);
+ scene->_field1FBC = 1;
+ BF_GLOBALS._uiElements.addScore(30);
+ } else {
+ if (BF_GLOBALS.getFlag(fTalkedDriverNoBkup)) {
+ scene->setAction(&scene->_action4);
+ } else {
+ break;
+ }
+ }
+ return true;
+ case INV_TICKET_BOOK:
+ if (!BF_GLOBALS.getFlag(fDriverOutOfTruck)) {
+ return startAction(CURSOR_TALK, event);
+ } else if (!scene->_field1FC4) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2;
+ scene->setAction(&scene->_sequenceManager1, scene, 4120, &scene->_object2, &BF_GLOBALS._player, NULL);
+ } else if ((scene->_field1FBC != 0) || (scene->_field1FC2 != 0)) {
+ break;
+ } else {
+ scene->_field1FC2 = 1;
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 4127;
+ scene->setAction(&scene->_sequenceManager1, scene, 4127, &scene->_object1, NULL);
+ }
+ return true;
+ case INV_MIRANDA_CARD:
+ if (scene->_field1FBC == 0)
+ return false;
+
+ if (BF_GLOBALS.getFlag(readFrankRights)) {
+ SceneItem::display2(390, 15);
+ } else {
+ BF_GLOBALS.setFlag(readFrankRights);
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+
+ // TODO: Original code pushes a copy of the entirety of object1 onto stack
+ scene->setAction(&scene->_sequenceManager1, scene, 4126, &BF_GLOBALS._player, &scene->_object1, NULL);
+ }
+ return true;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+}
+
+bool Scene410::Object2::startAction(CursorType action, Event &event) {
+ Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (!BF_GLOBALS.getFlag(fCalledBackup)) {
+ if (BF_GLOBALS.getFlag(fTalkedShooterNoBkup)) {
+ scene->setAction(&scene->_action3);
+ } else {
+ SceneItem::display2(410, 5);
+ }
+ } else if (!scene->_field1FBA) {
+ SceneItem::display2(410, 5);
+ } else if (!scene->_field1FBE) {
+ scene->_sceneMode = 4121;
+ scene->_field1FBE = 1;
+ BF_GLOBALS._uiElements.addScore(50);
+ scene->signal();
+ } else {
+ break;
+ }
+ return true;
+ case CURSOR_TALK:
+ scene->setAction(&scene->_action5);
+ return true;
+ case INV_HANDCUFFS:
+ if (BF_GLOBALS.getFlag(fCalledBackup)) {
+ if ((scene->_field1FB8 < 5) || (scene->_field1FBA != 0))
+ break;
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9;
+ ADD_PLAYER_MOVER(195, 139);
+ } else if (BF_GLOBALS.getFlag(fTalkedShooterNoBkup)) {
+ scene->setAction(&scene->_action3);
+ } else {
+ break;
+ }
+ return true;
+ case INV_MIRANDA_CARD:
+ if (!scene->_field1FBA)
+ break;
+
+ if (BF_GLOBALS.getFlag(readFrankRights)) {
+ SceneItem::display2(390, 15);
+ } else {
+ BF_GLOBALS.setFlag(readFrankRights);
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS._player.disableControl();
+
+ scene->_sceneMode = 0;
+ scene->setAction(&scene->_sequenceManager1, scene, 4125, &BF_GLOBALS._player,
+ &scene->_object2, NULL);
+ }
+ return true;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+}
+
+bool Scene410::Object3::startAction(CursorType action, Event &event) {
+ Scene410 *scene = (Scene410 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ if (BF_GLOBALS._bookmark == bStoppedFrankie) {
+ if (BF_GLOBALS.getFlag(fSearchedTruck)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8;
+ ADD_PLAYER_MOVER(147, 143);
+ } else {
+ SceneItem::display2(350, 13);
+ }
+ } else if ((scene->_field1FBA != 0) && (scene->_field1FBC != 0)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 4112;
+ scene->_stripManager.start(4113, scene);
+ BF_GLOBALS._bookmark = bStoppedFrankie;
+ BF_GLOBALS.set2Flags(f1098Frankie);
+ BF_GLOBALS.clearFlag(f1098Marina);
+ } else if ((BF_INVENTORY.getObjectScene(INV_HANDCUFFS) == 1) ||
+ (!scene->_field1FBA && (scene->_field1FB8 < 5))) {
+ SceneItem::display2(350, 13);
+ } else if (!scene->_field1FBA) {
+ if (scene->_field1FBA)
+ error("Error - want to cuff shooter, but he's cuffed already");
+
+ BF_GLOBALS._player.disableControl();
+ scene->_field1FBA = 1;
+ scene->_field1FBE = 1;
+ BF_GLOBALS._walkRegions.proc2(22);
+ scene->_sceneMode = 4122;
+ scene->_stripManager.start(4112, scene);
+ } else if (scene->_field1FB6 < 1) {
+ break;
+ } else if (scene->_field1FBC != 0) {
+ error("Error - want to cuff driver, but he's cuffed already");
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_field1FBC = 1;
+ scene->_field1FC0 = 1;
+ BF_GLOBALS._walkRegions.proc2(22);
+ scene->_sceneMode = 4109;
+ scene->_stripManager.start(4112, scene);
+ }
+ return true;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+}
+
+
+/*--------------------------------------------------------------------------*/
+
+Scene410::Scene410(): SceneExt() {
+ _field1FB6 = _field1FB8 = _field1FBA = _field1FBC = 0;
+ _field1FBE = _field1FC0 = _field1FC2 = _field1FC4 = 0;
+}
+
+void Scene410::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_field1FB6);
+ s.syncAsSint16LE(_field1FB8);
+ s.syncAsSint16LE(_field1FBA);
+ s.syncAsSint16LE(_field1FBC);
+ s.syncAsSint16LE(_field1FBE);
+ s.syncAsSint16LE(_field1FC0);
+ s.syncAsSint16LE(_field1FC2);
+ s.syncAsSint16LE(_field1FC4);
+}
+
+void Scene410::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(410);
+ setZoomPercents(74, 75, 120, 100);
+
+ if (BF_GLOBALS._sceneManager._previousScene != 60)
+ _sound1.fadeSound(11);
+ BF_GLOBALS._driveToScene = 64;
+ BF_GLOBALS._mapLocationId = 64;
+ BF_GLOBALS.setFlag(fArrivedAtGangStop);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeUniformSpeaker);
+ _stripManager.addSpeaker(&_harrisonSpeaker);
+ _stripManager.addSpeaker(&_shooterSpeaker);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(1341);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.changeAngle(90);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setPosition(Common::Point(114, 133));
+ BF_GLOBALS._player.changeZoom(-1);
+
+ _item2.setDetails(8, 410, 15, -1, -1, 1);
+
+ _object2.postInit();
+ _object2.setVisage(415);
+ _object2.setStrip(1);
+ _object2.setPosition(Common::Point(278, 92));
+ _object2.setDetails(410, 4, -1, 5, 1, NULL);
+
+ _object1.postInit();
+ _object1.setVisage(416);
+ _object1.setStrip(2);
+ _object1.setPosition(Common::Point(244, 85));
+ _object1.setDetails(410, 6, -1, 7, 1, NULL);
+ _object1.changeZoom(-1);
+
+ _object5.postInit();
+ _object5.setVisage(410);
+ _object5.setStrip(2);
+ _object5.setPosition(Common::Point(282, 96));
+
+ _object6.postInit();
+ _object6.setVisage(410);
+ _object6.setStrip(4);
+ _object6.setPosition(Common::Point(240, 43));
+
+ _item4.setDetails(6, 410, 3, -1, -1, 1);
+ _item3.setDetails(7, 410, 3, -1, -1, 1);
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 415:
+ BF_GLOBALS.setFlag(fSearchedTruck);
+ BF_GLOBALS._player.setPosition(Common::Point(210, 90));
+
+ _object2.remove();
+ _object1.remove();
+ BF_GLOBALS._walkRegions.proc1(21);
+ BF_GLOBALS._walkRegions.proc1(22);
+
+ _object3.postInit();
+ _object3.setVisage(343);
+ _object3.setObjectWrapper(new SceneObjectWrapper());
+ _object3.animate(ANIM_MODE_1, NULL);
+ _object3.setDetails(350, 12, 13, 14, 1, NULL);
+ _object3.setPosition(Common::Point(97, 185));
+ _object3.changeZoom(-1);
+
+ _object4.postInit();
+ _object4.setVisage(410);
+ _object4.setDetails(410, 8, 9, 10, 1, NULL);
+ _object4.fixPriority(148);
+ _object4.setPosition(Common::Point(39, 168));
+
+ _field1FC4 = 1;
+ _sceneMode = 0;
+ signal();
+ break;
+ case 60:
+ if (BF_GLOBALS.getFlag(fSearchedTruck)) {
+ _object2.remove();
+ _object1.remove();
+ _sceneMode = 0;
+ } else {
+ _field1FC4 = BF_GLOBALS._v50CC8;
+ _field1FBA = BF_GLOBALS._v50CC2;
+ _field1FB8 = BF_GLOBALS._v50CC6;
+ _field1FB6 = BF_GLOBALS._v50CC4;
+
+ _object2.setVisage(418);
+ _object2.setStrip(6);
+ _object2.setPosition(Common::Point(227, 137));
+
+ if (_field1FB8 > 0) {
+ _object2.setVisage(415);
+ _object2.setStrip(2);
+ _object2.setFrame(5);
+ }
+ if (_field1FBA) {
+ _object2.setVisage(415);
+ _object2.setStrip(6);
+ _object2.setFrame(8);
+ }
+
+ BF_GLOBALS._walkRegions.proc1(16);
+ if (BF_GLOBALS.getFlag(fDriverOutOfTruck)) {
+ _object1.setVisage(417);
+ _object1.setStrip(1);
+ _object1.setPosition(Common::Point(152, 97));
+
+ BF_GLOBALS._walkRegions.proc1(7);
+ }
+
+ if (BF_GLOBALS.getFlag(fCalledBackup)) {
+ BF_GLOBALS._walkRegions.proc1(21);
+ BF_GLOBALS._walkRegions.proc1(22);
+
+ _object3.postInit();
+ _object3.setVisage(343);
+ _object3.setObjectWrapper(new SceneObjectWrapper());
+ _object3.animate(ANIM_MODE_1, NULL);
+ _object3.setDetails(350, 12, 13, 14, 1, NULL);
+ BF_GLOBALS._sceneItems.addBefore(&_object1, &_object3);
+
+ _object3.setPosition(Common::Point(-10, 124));
+ _object3.changeZoom(-1);
+
+ _object4.postInit();
+ _object4.setVisage(410);
+ _object4.setDetails(410, 8, 9, 10, 1, NULL);
+ _object4.fixPriority(148);
+
+ if (_field1FC4) {
+ _object3.setPosition(Common::Point(108, 112));
+ _object4.fixPriority(148);
+ _object4.setPosition(Common::Point(39, 168));
+
+ _sceneMode = 0;
+ } else {
+ _sceneMode = 4104;
+ }
+ } else {
+ _sceneMode = 0;
+ }
+
+ _field1FC4 = 1;
+ }
+ break;
+ case 50:
+ default:
+ BF_GLOBALS.setFlag(onDuty);
+ _sound1.play(21);
+ _sceneMode = 4100;
+ break;
+ }
+
+ signal();
+
+ _item1.setDetails(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y), 410, 0, 1, 2, 1, NULL);
+}
+
+void Scene410::signal() {
+ switch (_sceneMode) {
+ case 1:
+ BF_GLOBALS.set2Flags(f1097Frankie);
+ BF_GLOBALS.clearFlag(f1097Marina);
+
+ BF_GLOBALS._v50CC8 = _field1FC4;
+ BF_GLOBALS._v50CC2 = _field1FBA;
+ BF_GLOBALS._v50CC6 = _field1FB8;
+ BF_GLOBALS._v50CC4 = _field1FB6;
+ BF_GLOBALS._sceneManager.changeScene(60);
+ break;
+ case 2:
+ BF_GLOBALS._deathReason = 3;
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 3:
+ BF_GLOBALS._sceneManager.changeScene(415);
+ break;
+ case 5:
+ BF_INVENTORY.setObjectScene(INV_HANDCUFFS, 315);
+ _sceneMode = 0;
+ BF_GLOBALS.set2Flags(f1015Frankie);
+ BF_GLOBALS.clearFlag(f1015Marina);
+ signal();
+ break;
+ case 6:
+ BF_INVENTORY.setObjectScene(INV_22_SNUB, 1);
+ BF_INVENTORY.setObjectScene(INV_FRANKIE_ID, 1);
+ BF_GLOBALS.set2Flags(f1027Frankie);
+ BF_GLOBALS.clearFlag(f1027Marina);
+ _sceneMode = 0;
+ signal();
+ break;
+ case 7:
+ BF_INVENTORY.setObjectScene(INV_TYRONE_ID, 1);
+ signal();
+ break;
+ case 8:
+ BF_GLOBALS._walkRegions.proc2(22);
+ BF_GLOBALS._player.changeAngle(225);
+ _object3.changeAngle(45);
+ _sceneMode = 4114;
+ _stripManager.start(4120, this);
+ break;
+ case 9:
+ _sceneMode = 4106;
+ _stripManager.start(4111, this);
+ _field1FBA = 1;
+ BF_GLOBALS.setFlag(fCuffedFrankie);
+ BF_GLOBALS._uiElements.addScore(30);
+ break;
+ case 10:
+ BF_GLOBALS._player.updateAngle(_object3._position);
+ _sceneMode = 0;
+ break;
+ case 4100:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 4100, &_object2, &_object5, NULL);
+ BF_GLOBALS._walkRegions.proc1(16);
+ break;
+ case 4101:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 4100, &_object1, &_object6, NULL);
+ BF_GLOBALS.setFlag(fDriverOutOfTruck);
+ BF_GLOBALS._walkRegions.proc1(7);
+ break;
+ case 4103:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 1;
+ setAction(&_sequenceManager1, this, 4103, &BF_GLOBALS._player, NULL);
+ break;
+ case 4104:
+ _field1FC4 = 1;
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 4104, &_object4, &_object3, NULL);
+ break;
+ case 4105:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 4105, &_object2, NULL);
+ case 4106:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 4119;
+ setAction(&_sequenceManager1, this, 4106, &_object2, NULL);
+ break;
+ case 4107:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 5;
+ setAction(&_sequenceManager1, this, 4107, &_object2, NULL);
+ break;
+ case 4108:
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.updateAngle(Common::Point(100, 170));
+ BF_GLOBALS._walkRegions.proc2(22);
+ BF_GLOBALS._walkRegions.proc2(16);
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 4108, &_object3, NULL);
+ break;
+ case 4109:
+ if ((BF_GLOBALS._player._position.x > 116) && (BF_GLOBALS._player._position.x != 195) &&
+ (BF_GLOBALS._player._position.y != 139)) {
+ ADD_PLAYER_MOVER(195, 139);
+ }
+
+ BF_GLOBALS._walkRegions.proc2(22);
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 4109, &_object1, &_object3, NULL);
+ break;
+ case 4110:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 4110, &_object3, &_object1, NULL);
+ break;
+ case 4112:
+ BF_GLOBALS.setFlag(fGangInCar);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.updateAngle(Common::Point(100, 170));
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 4108;
+ setAction(&_sequenceManager1, this, 4112, &_object1, &_object2, &_object3, NULL);
+ break;
+ case 4114:
+ BF_GLOBALS._walkRegions.proc2(22);
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 4116;
+ setAction(&_sequenceManager1, this, 4114, &_object3, &_object4, NULL);
+ break;
+ case 4116:
+ BF_GLOBALS._walkRegions.proc2(21);
+ BF_GLOBALS._walkRegions.proc2(22);
+ _object3.remove();
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 4116, &_object4, NULL);
+ break;
+ case 4118:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 3;
+ setAction(&_sequenceManager1, this, 4118, &BF_GLOBALS._player, NULL);
+ break;
+ case 4119:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 4107;
+ setAction(&_sequenceManager1, this, 4119, &_object2, NULL);
+ break;
+ case 4121:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 6;
+ setAction(&_sequenceManager1, this, 4121, &BF_GLOBALS._player, &_object2, NULL);
+ break;
+ case 4122:
+ BF_GLOBALS._walkRegions.proc2(22);
+ BF_INVENTORY.setObjectScene(INV_22_SNUB, 0);
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 4122, &_object2, &_object3, NULL);
+ break;
+ case 4123:
+ BF_INVENTORY.setObjectScene(INV_TYRONE_ID, 0);
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 5;
+ setAction(&_sequenceManager1, this, 4123, &_object1, &BF_GLOBALS._player, NULL);
+ break;
+ case 4124:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 7;
+ setAction(&_sequenceManager1, this, 4124, &_object1, &BF_GLOBALS._player, NULL);
+ break;
+ case 4127:
+ SceneItem::display2(410, 16);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 0:
+ default:
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene410::process(Event &event) {
+ // Check for gun being clicked on player
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == INV_COLT45) &&
+ BF_GLOBALS._player.contains(event.mousePos) && !BF_GLOBALS.getFlag(fCalledBackup)) {
+ if (BF_GLOBALS.getFlag(fTalkedShooterNoBkup)) {
+ if (!_action) {
+ event.handled = true;
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 2;
+ setAction(&_sequenceManager1, this, 4102, &_object2, &BF_GLOBALS._player, NULL);
+ }
+ } else if (BF_GLOBALS.getFlag(fTalkedDriverNoBkup)) {
+ if (!_action) {
+ _sceneMode = 1;
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 2;
+ setAction(&_sequenceManager1, this, 4120, &_object2, &BF_GLOBALS._player, NULL);
+ }
+ }
+ }
+
+ if (!event.handled)
+ SceneExt::process(event);
+}
+
+void Scene410::dispatch() {
+ SceneExt::dispatch();
+ if ((_sceneMode == 4112) || (_sceneMode == 4101)) {
+ _object3.updateAngle(_object1._position);
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 415 - Searching Truck
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene415::GunInset::startAction(CursorType action, Event &event) {
+ Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ if (BF_GLOBALS.getFlag(fGotAutoWeapon)) {
+ FocusObject::startAction(action, event);
+ } else {
+ remove();
+ scene->_gunAndWig.remove();
+ }
+ return true;
+ } else {
+ return FocusObject::startAction(action, event);
+ }
+}
+
+bool Scene415::GunAndWig::startAction(CursorType action, Event &event) {
+ Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ NamedObject::startAction(action, event);
+ BF_INVENTORY.setObjectScene(INV_AUTO_RIFLE, 1);
+ BF_INVENTORY.setObjectScene(INV_WIG, 1);
+ BF_GLOBALS.setFlag(fGotAutoWeapon);
+ BF_GLOBALS._uiElements.addScore(30);
+
+ remove();
+ return true;
+ case INV_FOREST_RAP:
+ if (scene->_fieldE14)
+ break;
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(4126, scene);
+ BF_GLOBALS._uiElements.addScore(50);
+ scene->_fieldE14 = true;
+ return true;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+}
+
+bool Scene415::BulletsInset::startAction(CursorType action, Event &event) {
+ Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ if (BF_GLOBALS.getFlag(fGotAutoWeapon)) {
+ FocusObject::startAction(action, event);
+ } else {
+ remove();
+ scene->_theBullets.remove();
+ }
+ return true;
+ } else {
+ return FocusObject::startAction(action, event);
+ }
+}
+
+bool Scene415::DashDrawer::startAction(CursorType action, Event &event) {
+ Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_LOOK) || (action == CURSOR_USE)) {
+ scene->showBullets();
+ return true;
+ } else {
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene415::TheBullets::startAction(CursorType action, Event &event) {
+ Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ NamedObject::startAction(action, event);
+ BF_INVENTORY.setObjectScene(INV_22_BULLET, 1);
+ BF_GLOBALS.setFlag(fGotBulletsFromDash);
+ BF_GLOBALS._uiElements.addScore(30);
+
+ remove();
+ scene->_dashDrawer.remove();
+ return true;
+ case INV_FOREST_RAP:
+ if (scene->_fieldE16) {
+ SceneItem::display2(415, 35);
+ return true;
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(4122, scene);
+ BF_GLOBALS._uiElements.addScore(50);
+ scene->_fieldE16 = true;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene415::Lever::startAction(CursorType action, Event &event) {
+ Scene415 *scene = (Scene415 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (BF_GLOBALS.getFlag(fGotAutoWeapon)) {
+ SceneItem::display2(415, 20);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2;
+ scene->setAction(&scene->_sequenceManager, scene, 4150, &scene->_object6, NULL);
+ }
+ return true;
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene415::Scene415(): SceneExt() {
+ _fieldE14 = _fieldE16 = false;
+}
+
+void Scene415::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_fieldE14);
+ s.syncAsSint16LE(_fieldE16);
+}
+
+void Scene415::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(415);
+
+ _stripManager.addSpeaker(&_jakeRadioSpeaker);
+
+ _dashDrawer.postInit();
+ _dashDrawer.setVisage(411);
+ _dashDrawer.setStrip(3);
+ _dashDrawer.setPosition(Common::Point(151, 97));
+ _dashDrawer.setDetails(415, 22, -1, -1, 1, NULL);
+
+ _object6.postInit();
+ _object6.setVisage(419);
+ _object6.setStrip(1);
+ _object6.setPosition(Common::Point(306, 116));
+ _object6.fixPriority(80);
+
+ _windowLever.setDetails(16, 415, 25, -1, 26, 1);
+ _item7.setDetails(17, 415, 32, -1, 33, 1);
+ _seatBelt.setDetails(14, 415, 29, -1, 30, 1);
+ _lever.setDetails(19, 415, 23, 24, -1, 1);
+ _seat.setDetails(18, 415, 3, 4, 2, 1);
+ _dashboard.setDetails(20, 415, 11, 12, 19, 1);
+ _steeringWheel.setDetails(15, 415, 5, 6, 7, 1);
+ _horn.setDetails(31, 415, 8, 9, 10, 1);
+ _item1.setDetails(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y), 415, 0, 1, 2, 1, NULL);
+
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player._canWalk = false;
+ BF_GLOBALS._events.setCursor(CURSOR_WALK);
+
+ signal();
+}
+
+void Scene415::signal() {
+ switch (_sceneMode) {
+ case 1:
+ BF_GLOBALS._sceneManager.changeScene(410);
+ break;
+ case 2:
+ showGunAndWig();
+ _sceneMode = 0;
+ signal();
+ break;
+ case 0:
+ default:
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player._canWalk = false;
+ break;
+ }
+}
+
+void Scene415::dispatch() {
+ SceneExt::dispatch();
+ if (BF_GLOBALS.getFlag(fGotAutoWeapon) && BF_GLOBALS.getFlag(fGotBulletsFromDash)) {
+ _sceneMode = 1;
+ signal();
+ }
+}
+
+void Scene415::showBullets() {
+ _bulletsInset.postInit();
+ _bulletsInset.setVisage(411);
+ _bulletsInset.setStrip(1);
+ _bulletsInset.setPosition(Common::Point(158, 100));
+ _bulletsInset.setDetails(415, -1, -1, -1);
+
+ _theBullets.postInit();
+ _theBullets.setVisage(411);
+ _theBullets.setStrip(1);
+ _theBullets.setFrame(2);
+ _theBullets.setPosition(Common::Point(184, 86));
+ _theBullets.fixPriority(105);
+ _theBullets.setDetails(415, 16, 17, 18, 1, NULL);
+ BF_GLOBALS._sceneItems.remove(&_theBullets);
+ BF_GLOBALS._sceneItems.push_front(&_theBullets);
+}
+
+void Scene415::showGunAndWig() {
+ _gunInset.postInit();
+ _gunInset.setVisage(411);
+ _gunInset.setStrip(2);
+ _gunInset.setPosition(Common::Point(158, 100));
+ _gunInset.setDetails(415, -1, -1, -1);
+
+ _gunAndWig.postInit();
+ _gunAndWig.setVisage(411);
+ _gunAndWig.setStrip(2);
+ _gunAndWig.setFrame(2);
+ _gunAndWig.setPosition(Common::Point(159, 88));
+ _gunAndWig.fixPriority(105);
+ _gunAndWig.setDetails(415, 13, 14, 15, 1, NULL);
+
+ BF_GLOBALS._sceneItems.remove(&_gunAndWig);
+ BF_GLOBALS._sceneItems.push_front(&_gunAndWig);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 440 - Outside Alleycat Bowl
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene440::Doorway::startAction(CursorType action, Event &event) {
+ Scene440 *scene = (Scene440 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(440, 1);
+ return true;
+ case CURSOR_USE:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 4400;
+ scene->setAction(&scene->_sequenceManager, scene, 4400, &BF_GLOBALS._player, this, &scene->_lyle, NULL);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene440::Vechile::startAction(CursorType action, Event &event) {
+ Scene440 *scene = (Scene440 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ SceneItem::display2(440, 3);
+ } else {
+ SceneItem::display2(440, 2);
+ }
+ return true;
+ case CURSOR_USE:
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 4403;
+ scene->setAction(&scene->_sequenceManager, scene, 4403, &BF_GLOBALS._player, &scene->_lyle, NULL);
+ } else {
+ BF_GLOBALS._sceneManager.changeScene(60);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene440::Lyle::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(440, 4);
+ return true;
+ case CURSOR_TALK:
+ SceneItem::display2(440, 5);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene440::Item1::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(440, 0);
+ return true;
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene440::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(440);
+ setZoomPercents(75, 60, 120, 100);
+ BF_GLOBALS._sound1.fadeSound(33);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(303);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.setPosition(Common::Point(203, 113));
+
+ _vechile.postInit();
+
+ _lyle.postInit();
+ _lyle.setVisage(835);
+ _lyle.animate(ANIM_MODE_1, NULL);
+ _lyle.setObjectWrapper(new SceneObjectWrapper());
+ _lyle.setPosition(Common::Point(-40, -10));
+ _lyle.changeZoom(-1);
+ _lyle.hide();
+ BF_GLOBALS._sceneItems.push_back(&_lyle);
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _vechile.setVisage(444);
+ _vechile.setFrame(2);
+ _vechile.setPosition(Common::Point(147, 128));
+ _vechile.fixPriority(114);
+
+ BF_GLOBALS._player.setVisage(303);
+ BF_GLOBALS._player.setPosition(Common::Point(187, 104));
+
+ _lyle.setPosition(Common::Point(135, 128));
+ _lyle.show();
+
+ BF_GLOBALS._walkRegions.proc1(12);
+ BF_GLOBALS._walkRegions.proc1(13);
+ } else {
+ _vechile.setPosition(Common::Point(169, 121));
+ _vechile.fixPriority(117);
+
+ if (BF_GLOBALS.getFlag(onDuty)) {
+ _vechile.setVisage(440);
+ _vechile.setStrip(1);
+
+ BF_GLOBALS._player.setVisage(304);
+ BF_GLOBALS._player.setStrip(3);
+ } else {
+ _vechile.setVisage(580);
+ _vechile.setStrip(2);
+ _vechile.setFrame(3);
+
+ BF_GLOBALS._player.setVisage(303);
+ }
+ }
+
+ BF_GLOBALS._sceneItems.push_back(&_vechile);
+ BF_GLOBALS._walkRegions.proc1(11);
+
+ _doorway.postInit();
+ _doorway.setVisage(440);
+ _doorway.setStrip(5);
+ _doorway.setPosition(Common::Point(198, 91));
+ _doorway.fixPriority(80);
+ BF_GLOBALS._sceneItems.push_back(&_doorway);
+
+ if (BF_GLOBALS._sceneManager._previousScene == 450) {
+ _lyle.setPosition(Common::Point(143, 93));
+ _lyle.setStrip(5);
+ _lyle.fixPriority(90);
+
+ _doorway.setFrame(_doorway.getFrameCount());
+ _sceneMode = 4401;
+ setAction(&_sequenceManager, this, 4401, &BF_GLOBALS._player, &_doorway, NULL);
+ } else if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _sceneMode = 4402;
+ setAction(&_sequenceManager, this, 4402, &_lyle, NULL);
+ } else {
+ BF_GLOBALS._player.enableControl();
+ }
+
+ _item1.setBounds(Rect(0, 0, SCREEN_WIDTH, BF_INTERFACE_Y - 1));
+ BF_GLOBALS._sceneItems.push_back(&_item1);
+}
+
+void Scene440::signal() {
+ switch (_sceneMode) {
+ case 4400:
+ BF_GLOBALS._sceneManager.changeScene(450);
+ break;
+ case 4401:
+ BF_GLOBALS._player.fixPriority(-1);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 4402:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 4403:
+ BF_GLOBALS._sceneManager.changeScene(60);
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 450 - Inside Alleycat Bowl
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene450::Object1::startAction(CursorType action, Event &event) {
+ Scene450 *scene = (Scene450 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(450, 0);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(450, 1);
+ return true;
+ case CURSOR_TALK:
+ case INV_ID:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 4504;
+ if (_flag) {
+ scene->setAction(&scene->_sequenceManager, scene, 4515, &BF_GLOBALS._player, this, NULL);
+ } else {
+ ++_flag;
+ scene->setAction(&scene->_sequenceManager, scene, 4504, &BF_GLOBALS._player, this, NULL);
+ }
+ return true;
+ case INV_FOREST_RAP:
+ BF_INVENTORY.setObjectScene(INV_FOREST_RAP, 450);
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._uiElements.addScore(30);
+
+ scene->_sceneMode = 4505;
+ scene->setAction(&scene->_sequenceManager, scene, 4505, &BF_GLOBALS._player, this,
+ &scene->_counterDoor, &scene->_object2, NULL);
+ return true;
+ default:
+ return NamedObjectExt::startAction(action, event);
+ }
+}
+
+bool Scene450::Object3::startAction(CursorType action, Event &event) {
+ Scene450 *scene = (Scene450 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(450, 4);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(450, 5);
+ return true;
+ case CURSOR_TALK:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 4502;
+ if (BF_GLOBALS.getFlag(onDuty)) {
+ scene->setAction(&scene->_sequenceManager, scene, 4516, &BF_GLOBALS._player, this, NULL);
+ } else {
+ scene->setAction(&scene->_sequenceManager, scene, 4502, &BF_GLOBALS._player, this, NULL);
+ }
+ return true;
+ case INV_NAPKIN:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 4509;
+ scene->setAction(&scene->_sequenceManager, scene, 4509, &BF_GLOBALS._player, this, NULL);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene450::Object4::startAction(CursorType action, Event &event) {
+ Scene450 *scene = (Scene450 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(450, 6);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(450, 7);
+ return true;
+ case CURSOR_TALK:
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS.getFlag(takenWeasel) && !BF_GLOBALS.getFlag(gotTrailer450)) {
+ BF_GLOBALS.setFlag(gotTrailer450);
+ scene->_sceneMode = 4517;
+ scene->setAction(&scene->_sequenceManager, scene, 4517, &BF_GLOBALS._player, this,
+ &scene->_door, NULL);
+ } else {
+ animate(ANIM_MODE_8, 1, NULL);
+
+ if (scene->_field19AC) {
+ scene->_sceneMode = 2;
+ if (scene->_field19AE) {
+ scene->_stripManager.start(4521, scene);
+ } else {
+ scene->_field19AE = 1;
+ scene->_stripManager.start(4512, scene);
+ }
+ } else {
+ scene->_sceneMode = 4506;
+ if (scene->_field19AE) {
+ scene->setAction(&scene->_sequenceManager, scene, 4518, &BF_GLOBALS._player, this, NULL);
+ } else {
+ scene->_sceneMode = 4506;
+ scene->_field19AE = 1;
+ scene->setAction(&scene->_sequenceManager, scene, 4506, &BF_GLOBALS._player, this, NULL);
+ }
+ }
+ }
+ return true;
+ case INV_FOREST_RAP:
+ SceneItem::display2(450, 19);
+ return true;
+ case INV_NAPKIN:
+ animate(ANIM_MODE_8, 1, NULL);
+ BF_GLOBALS._player.disableControl();
+
+ if (BF_GLOBALS.getFlag(showEugeneNapkin)) {
+ SceneItem::display2(450, 16);
+ BF_GLOBALS._player.enableControl();
+ } else {
+ BF_GLOBALS.setFlag(showEugeneNapkin);
+
+ if (!BF_GLOBALS.getFlag(showEugeneID)) {
+ scene->_sceneMode = 4513;
+ scene->setAction(&scene->_sequenceManager, scene, 4513, &BF_GLOBALS._player, this, NULL);
+ } else if (BF_GLOBALS.getFlag(fMgrCallsWeasel)) {
+ SceneItem::display2(450, 16);
+ BF_GLOBALS._player.enableControl();
+ } else {
+ BF_GLOBALS._uiElements.addScore(30);
+ scene->_sceneMode = 4510;
+ BF_INVENTORY.setObjectScene(INV_NAPKIN, 450);
+ scene->setAction(&scene->_sequenceManager, scene, 4510, &BF_GLOBALS._player, this, NULL);
+ }
+ }
+ return true;
+ case INV_ID:
+ if (BF_GLOBALS.getFlag(takenWeasel)) {
+ return startAction(CURSOR_TALK, event);
+ } else {
+ animate(ANIM_MODE_8, 1, NULL);
+ BF_GLOBALS._player.disableControl();
+
+ if (!BF_GLOBALS.getFlag(showEugeneID))
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(showEugeneID);
+
+ if ((BF_GLOBALS.getFlag(showRapEugene) || BF_GLOBALS.getFlag(showEugeneNapkin)) &&
+ !BF_GLOBALS.getFlag(fMgrCallsWeasel)) {
+ BF_GLOBALS._uiElements.addScore(30);
+ scene->_sceneMode = 4511;
+ scene->setAction(&scene->_sequenceManager, scene, 4511, &BF_GLOBALS._player, this, NULL);
+ } else {
+ scene->_sceneMode = 4506;
+ scene->setAction(&scene->_sequenceManager, scene, 4512, &BF_GLOBALS._player, this, NULL);
+ }
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene450::Item1::startAction(CursorType action, Event &event) {
+ Scene450 *scene = (Scene450 *)BF_GLOBALS._sceneManager._scene;
+
+ if (event.eventType == EVENT_BUTTON_DOWN) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 4501;
+ scene->signal();
+ return true;
+ } else {
+ return false;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene450::Scene450(): SceneExt() {
+ _field19AC = _field19AE = 0;
+}
+
+void Scene450::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_field19AC);
+ s.syncAsSint16LE(_field19AE);
+}
+
+void Scene450::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(450);
+ setZoomPercents(110, 90, 155, 115);
+ BF_GLOBALS._sound1.fadeSound(13);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_eugeneSpeaker);
+ _stripManager.addSpeaker(&_billySpeaker);
+ _stripManager.addSpeaker(&_weaselSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ _stripManager.addSpeaker(&_lyleHatSpeaker);
+ _stripManager.addSpeaker(&_jakeUniformSpeaker);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(BF_GLOBALS.getFlag(onDuty) ? 1341 : 129);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.setPosition(Common::Point(-30, 155));
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.disableControl();
+
+ _door.postInit();
+ _door.setVisage(450);
+ _door.setStrip(2);
+ _door.setPosition(Common::Point(72, 80));
+ _door.setDetails(450, 15, -1, 13, 1, NULL);
+
+ _counterDoor.postInit();
+ _counterDoor.setVisage(450);
+ _counterDoor.setPosition(Common::Point(39, 104));
+ _counterDoor.fixPriority(100);
+ _counterDoor.setDetails(450, 12, -1, 13, 1, NULL);
+
+ if (BF_GLOBALS._dayNumber != 3) {
+ _object3.postInit();
+ _object3.setVisage(463);
+ _object3.setPosition(Common::Point(138, 121));
+ _object3.fixPriority(100);
+ _object3.setFrame(_object3.getFrameCount());
+ BF_GLOBALS._sceneItems.push_back(&_object3);
+ } else if (!BF_GLOBALS.getFlag(fWithLyle) || !BF_GLOBALS.getFlag(fGivenNapkin) ||
+ (BF_INVENTORY.getObjectScene(BF_ITEM_67) == 1)) {
+ _object3.postInit();
+ _object3.setVisage(463);
+ _object3.setPosition(Common::Point(138, 121));
+ _object3.fixPriority(100);
+ _object3.setFrame(_object3.getFrameCount());
+ BF_GLOBALS._sceneItems.push_back(&_object3);
+ } else {
+ _object4.postInit();
+ _object4.setVisage(467);
+ _object4.setPosition(Common::Point(138, 121));
+ _object4.changeZoom(-1);
+ BF_GLOBALS._sceneItems.push_back(&_object4);
+
+ if (!BF_GLOBALS.getFlag(takenWeasel)) {
+ _object2.postInit();
+ _object2.setVisage(469);
+ _object2.animate(ANIM_MODE_1, NULL);
+ _object2.setObjectWrapper(new SceneObjectWrapper());
+ _object2.setPosition(Common::Point(-30, 126));
+ ADD_MOVER_NULL(_object2, 27, 126);
+ _object2.changeZoom(-1);
+ _object2.setDetails(450, 2, 18, 3, 1, NULL);
+
+ BF_GLOBALS._walkRegions.proc1(4);
+
+ _object1.postInit();
+ _object1.setVisage(466);
+ _object1.animate(ANIM_MODE_1, NULL);
+ _object1.setObjectWrapper(new SceneObjectWrapper());
+ _object1.setPosition(Common::Point(70, 80));
+ _object1.setStrip(5);
+ _object1.changeZoom(90);
+ _object1.fixPriority(65);
+ _object1._flag = 0;
+ BF_GLOBALS._sceneItems.push_back(&_object1);
+ }
+ }
+
+ _sceneMode = 4500;
+ setAction(&_sequenceManager, this, 4500, &BF_GLOBALS._player, NULL);
+
+ _exit.setDetails(Rect(0, 100, 4, 167), 450, -1, -1, -1, 1, NULL);
+ _counter.setDetails(8, 450, 8, -1, 9, 1);
+ _shelf.setDetails(Rect(114, 10, 179, 77), 450, 10, -1, 11, 1, NULL);
+ _interior.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 450, 14, -1, -1, 1, NULL);
+}
+
+void Scene450::signal() {
+ switch (_sceneMode) {
+ case 450:
+ case 451:
+ BF_GLOBALS._sceneManager.changeScene(440);
+ break;
+ case 4501:
+ if (BF_GLOBALS._sceneObjects->contains(&_object2)) {
+ ADD_MOVER(_object2, -20, 135);
+ } else {
+ ADD_PLAYER_MOVER(0, 160);
+ }
+ break;
+ case 4503:
+ _object1.fixPriority(100);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 4505:
+ BF_GLOBALS.setFlag(takenWeasel);
+ _object1.remove();
+ _object2.remove();
+ BF_GLOBALS._walkRegions.proc2(4);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 4507:
+ case 4510:
+ case 4511:
+ BF_GLOBALS.setFlag(fMgrCallsWeasel);
+ _field19AC = 1;
+ _sceneMode = 4503;
+ setAction(&_sequenceManager, this, 4503, &_object1, &_door, &_object4, NULL);
+ break;
+ case 4508:
+ _object4.remove();
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ break;
+ case 4517:
+ BF_GLOBALS.setFlag(gotTrailer450);
+ BF_INVENTORY.setObjectScene(BF_ITEM_67, 1);
+ _sceneMode = 4508;
+ setAction(&_sequenceManager, this, 4508, &BF_GLOBALS._player, &_object4, &_door, NULL);
+ break;
+ default:
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene450::process(Event &event) {
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ // Check if the cursor is on an exit
+ if (_exit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+}
+
+} // End of namespace BlueForce
+
+} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_scenes4.h b/engines/tsage/blue_force/blueforce_scenes4.h
new file mode 100644
index 0000000000..5da61cfaa0
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_scenes4.h
@@ -0,0 +1,267 @@
+/* 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.
+ *
+ */
+
+#ifndef TSAGE_BLUEFORCE_SCENES4_H
+#define TSAGE_BLUEFORCE_SCENES4_H
+
+#include "common/scummsys.h"
+#include "tsage/blue_force/blueforce_logic.h"
+#include "tsage/blue_force/blueforce_speakers.h"
+#include "tsage/converse.h"
+#include "tsage/events.h"
+#include "tsage/core.h"
+#include "tsage/scenes.h"
+#include "tsage/globals.h"
+#include "tsage/sound.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+using namespace TsAGE;
+
+class Scene410: public SceneExt {
+ /* Actions */
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action3: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action4: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action5: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action6: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action7: public Action {
+ public:
+ virtual void signal();
+ };
+
+ /* Objects */
+ class Object1: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object2: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object3: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Item2: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item4: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager1, _sequenceManager2, _sequenceManager3;
+ Object1 _object1;
+ Object2 _object2;
+ Object3 _object3;
+ NamedObject _object4, _object5, _object6;
+ NamedHotspot _item1;
+ Item2 _item2;
+ NamedHotspot _item3;
+ Item4 _item4;
+ Action1 _action1;
+ Action2 _action2;
+ Action3 _action3;
+ Action4 _action4;
+ Action5 _action5;
+ Action6 _action6;
+ Action7 _action7;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeUniform _jakeUniformSpeaker;
+ SpeakerHarrison _harrisonSpeaker;
+ SpeakerDriver _driverSpeaker;
+ SpeakerShooter _shooterSpeaker;
+ ASoundExt _sound1;
+ int _field1FB6, _field1FB8, _field1FBA;
+ int _field1FBC, _field1FBE;
+ int _field1FC0, _field1FC2, _field1FC4;
+
+ Scene410();
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void synchronize(Serializer &s);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene415: public SceneExt {
+ /* Objects */
+ class GunInset: public FocusObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class GunAndWig: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class BulletsInset: public FocusObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class DashDrawer: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class TheBullets: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Lever: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+private:
+ void showBullets();
+ void showGunAndWig();
+public:
+ SequenceManager _sequenceManager;
+ GunInset _gunInset;
+ GunAndWig _gunAndWig;
+ BulletsInset _bulletsInset;
+ DashDrawer _dashDrawer;
+ TheBullets _theBullets;
+ NamedObject _object6;
+ NamedHotspot _item1, _steeringWheel, _horn, _dashboard;
+ NamedHotspot _seat, _windowLever, _item7, _seatBelt;
+ Lever _lever;
+ SpeakerJakeRadio _jakeRadioSpeaker;
+ bool _fieldE14, _fieldE16;
+
+ Scene415();
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void synchronize(Serializer &s);
+ virtual void signal();
+ virtual void dispatch();
+};
+
+class Scene440: public SceneExt {
+ /* Objects */
+ class Doorway: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Vechile: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Lyle: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Item1: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager;
+ SpeakerGameText _gameTextSpeaker;
+ Doorway _doorway;
+ Vechile _vechile;
+ Lyle _lyle;
+ Item1 _item1;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
+class Scene450: public SceneExt {
+ /* Objects */
+ class Object1: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object2: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object3: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object4: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Item1: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerLyleHat _lyleHatSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerJakeUniform _jakeUniformSpeaker;
+ SpeakerEugene _eugeneSpeaker;
+ SpeakerWeasel _weaselSpeaker;
+ SpeakerBilly _billySpeaker;
+ Object1 _object1;
+ NamedObject _object2;
+ Object3 _object3;
+ Object4 _object4;
+ NamedObject _door, _counterDoor;
+ NamedHotspot _exit, _interior, _shelf, _counter;
+ int _field19AC, _field19AE;
+
+ Scene450();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+};
+
+} // End of namespace BlueForce
+
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/blue_force/blueforce_scenes5.cpp b/engines/tsage/blue_force/blueforce_scenes5.cpp
new file mode 100644
index 0000000000..9b67159f9b
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_scenes5.cpp
@@ -0,0 +1,2547 @@
+/* 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 "tsage/blue_force/blueforce_scenes5.h"
+#include "tsage/blue_force/blueforce_dialogs.h"
+#include "tsage/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/staticres.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+/*--------------------------------------------------------------------------
+ * Scene 550 - Outside Bikini Hut
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene550::Action1::signal() {
+ Scene550 *scene = (Scene550 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ setDelay(5);
+ break;
+ case 1:
+ scene->_stripManager.start(scene->_sceneMode, this);
+ break;
+ case 2:
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene550::Object1::startAction(CursorType action, Event &event) {
+ Scene550 *scene = (Scene550 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ if ((BF_INVENTORY.getObjectScene(INV_SCHEDULE) == 1) ||
+ (BF_INVENTORY.getObjectScene(INV_9MM_BULLETS) == 1)) {
+ if ((BF_INVENTORY.getObjectScene(INV_SCHEDULE) == 1) &&
+ (BF_INVENTORY.getObjectScene(INV_9MM_BULLETS) == 1)) {
+ BF_GLOBALS.setFlag(fToldLyleOfSchedule);
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 5501;
+ scene->setAction(&scene->_sequenceManager, scene, 5514, &BF_GLOBALS._player, this, NULL);
+ } else {
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(5509, scene);
+ }
+ } else if (BF_GLOBALS._sceneManager._previousScene == 930) {
+ scene->_sceneMode = 5512;
+ scene->setAction(&scene->_action1);
+ } else {
+ scene->_sceneMode = BF_INVENTORY.getObjectScene(BF_ITEM_67) == 1 ? 5513 : 5512;
+ scene->_stripManager.setAction(&scene->_action1);
+ }
+ return true;
+ case INV_SCHEDULE:
+ BF_GLOBALS.setFlag(fToldLyleOfSchedule);
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 5501;
+ scene->setAction(&scene->_sequenceManager, scene, 5514, &BF_GLOBALS._player, this, NULL);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene550::CaravanDoor::startAction(CursorType action, Event &event) {
+ Scene550 *scene = (Scene550 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(550, 0);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(550, 7);
+ return true;
+ case BF_ITEM_67:
+ if ((BF_GLOBALS._dayNumber == 3) || !BF_GLOBALS.getFlag(fWithLyle))
+ SceneItem::display2(550, 33);
+ else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 5500;
+ scene->setAction(&scene->_sequenceManager, scene, 5500, &BF_GLOBALS._player, this, NULL);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene550::Vechile::startAction(CursorType action, Event &event) {
+ Scene550 *scene = (Scene550 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(550, 3);
+ return true;
+ case CURSOR_USE:
+ if (!BF_GLOBALS.getFlag(fWithLyle)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 5510;
+ scene->setAction(&scene->_sequenceManager, scene, BF_GLOBALS.getFlag(fWithLyle) ? 5510 : 5515,
+ &BF_GLOBALS._player, this, NULL);
+ } else if (BF_GLOBALS.getFlag(fToldLyleOfSchedule)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2;
+ scene->setAction(&scene->_sequenceManager, scene, 5501, &BF_GLOBALS._player, NULL);
+ } else if ((BF_INVENTORY.getObjectScene(INV_SCHEDULE) == 1) ||
+ (BF_INVENTORY.getObjectScene(INV_9MM_BULLETS) == 1)) {
+ if (BF_INVENTORY.getObjectScene(INV_9MM_BULLETS) == 1) {
+ scene->_sceneMode = 5501;
+ scene->_stripManager.start(5511, scene);
+ } else {
+ scene->_sceneMode = 0;
+ scene->_stripManager.start(5509, scene);
+ }
+ } else if (BF_GLOBALS._sceneManager._previousScene == 930) {
+ scene->_sceneMode = 5512;
+ scene->setAction(&scene->_action1);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2;
+ scene->setAction(&scene->_sequenceManager, scene, 5501, &BF_GLOBALS._player, NULL);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene550::postInit(SceneObjectList *OwnerList) {
+ BF_GLOBALS._sound1.fadeSound(16);
+
+ if ((BF_GLOBALS._bookmark == bInspectionDone) && !BF_GLOBALS.getFlag(fHasDrivenFromDrunk)) {
+ _sceneMode = 1;
+ signal();
+ return;
+ }
+
+ SceneExt::postInit();
+ loadScene(550);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_lyleHatSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.setPosition(Common::Point(160, 100));
+ BF_GLOBALS._player._moveDiff = Common::Point(2, 1);
+ BF_GLOBALS._player.enableControl();
+
+ _caravanDoor.postInit();
+ _caravanDoor.setVisage(550);
+ _caravanDoor.setPosition(Common::Point(34, 66));
+ BF_GLOBALS._sceneItems.push_back(&_caravanDoor);
+
+ _vechile.postInit();
+ _vechile.fixPriority(70);
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ BF_GLOBALS._walkRegions.proc1(10);
+ BF_GLOBALS._walkRegions.proc1(11);
+
+ _vechile.setVisage(444);
+ _vechile.setStrip(4);
+ _vechile.setFrame2(2);
+ _vechile.setPosition(Common::Point(110, 85));
+ _vechile.fixPriority(76);
+
+ _object1.postInit();
+ _object1.setVisage(835);
+ _object1.setPosition(Common::Point(139, 83));
+ _object1.setDetails(550, 29, 30, 31, 1, NULL);
+ _object1.setStrip(8);
+
+ BF_GLOBALS._player.setVisage(303);
+ BF_GLOBALS._player.setPosition(Common::Point(89, 76));
+ BF_GLOBALS._player.updateAngle(_object1._position);
+ } else {
+ BF_GLOBALS._walkRegions.proc1(12);
+
+ _vechile.setPosition(Common::Point(205, 77));
+ _vechile.changeZoom(80);
+
+ if (BF_GLOBALS.getFlag(onDuty)) {
+ _vechile.setVisage(301);
+ _vechile.setStrip(1);
+
+ BF_GLOBALS._player.setVisage(304);
+ } else {
+ _vechile.setVisage(580);
+ _vechile.setStrip(2);
+ _vechile.setFrame(2);
+
+ BF_GLOBALS._player.setVisage(303);
+ }
+
+ BF_GLOBALS._sceneItems.push_back(&_vechile);
+
+ if (BF_GLOBALS._sceneManager._previousScene == 930) {
+ _caravanDoor.setFrame(_caravanDoor.getFrameCount());
+ BF_GLOBALS._player.disableControl();
+
+ _sceneMode = 0;
+ setAction(&_sequenceManager, this, 5512, &BF_GLOBALS._player, &_caravanDoor, NULL);
+ } else if (BF_GLOBALS.getFlag(onDuty)) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager, this, 5502, &BF_GLOBALS._player, &_vechile, NULL);
+ } else if (!BF_GLOBALS.getFlag(fWithLyle)) {
+ BF_GLOBALS._player.setPosition(Common::Point(185, 70));
+ } else if (BF_GLOBALS._bookmark == bFlashBackOne) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager, this, 5513, &_object1, NULL);
+ } else {
+ _sceneMode = 0;
+ }
+ }
+
+ _item2.setDetails(Rect(0, 26, 53, 67), 550, 1, -1, 2, 1, NULL);
+ _item3.setDetails(Rect(53, 12, 173, 65), 550, 4, -1, 5, 1, NULL);
+ _item1.setDetails(Rect(0, 0, 320, 170), 550, 6, -1, -1, 1, NULL);
+}
+
+void Scene550::signal() {
+ switch (_sceneMode) {
+ case 0:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 1:
+ BF_GLOBALS._sceneManager.changeScene(551);
+ break;
+ case 2:
+ case 5510:
+ BF_GLOBALS._sceneManager.changeScene(60);
+ break;
+ case 3:
+ BF_GLOBALS._driveFromScene = 16;
+ BF_GLOBALS._driveToScene = 128;
+ BF_GLOBALS._mapLocationId = 128;
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(800);
+ break;
+ case 5500:
+ BF_GLOBALS._sceneManager.changeScene(930);
+ break;
+ case 5501:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 3;
+ setAction(&_sequenceManager, this, 5501, &BF_GLOBALS._player, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 551 - Outside Bikini Hut (Drunk Stop)
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene551::Action2::signal() {
+ Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._walkRegions.proc2(18);
+ BF_GLOBALS._walkRegions.proc2(4);
+ scene->_field1CD2 = 1;
+
+ scene->_harrison.setObjectWrapper(new SceneObjectWrapper());
+ scene->_harrison.animate(ANIM_MODE_1, NULL);
+
+ BF_GLOBALS._player.setVisage(304);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+
+ if (scene->_drunkStanding._flag != 1) {
+ ADD_PLAYER_MOVER_THIS(scene->_harrison, 126, 85);
+ } else {
+ ADD_PLAYER_MOVER_THIS(scene->_harrison, 88, 91);
+ }
+ break;
+ case 1:
+ scene->_harrison.updateAngle(BF_GLOBALS._player._position);
+
+ if (scene->_drunkStanding._flag == 1) {
+ BF_GLOBALS._walkRegions.proc1(4);
+ ADD_PLAYER_MOVER(71, 97);
+ } else {
+ ADD_PLAYER_MOVER(141, 87);
+ }
+ break;
+ case 2:
+ scene->_harrison.updateAngle(BF_GLOBALS._player._position);
+ BF_GLOBALS._player.updateAngle(scene->_harrison._position);
+ setDelay(10);
+ break;
+ case 3:
+ scene->_stripManager.start(scene->_harrison._flag, this);
+ break;
+ case 4:
+ scene->_field1CD2 = 0;
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene551::Vechile::startAction(CursorType action, Event &event) {
+ Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(550, 3);
+ return true;
+ case CURSOR_USE:
+ if (!BF_GLOBALS.getFlag(didDrunk)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1;
+ scene->setAction(&scene->_sequenceManager, scene, 5510, &BF_GLOBALS._player, this, NULL);
+ } else if (BF_INVENTORY.getObjectScene(INV_CENTER_PUNCH) == 1) {
+ BF_INVENTORY.setObjectScene(INV_CENTER_PUNCH, 0);
+ scene->_harrison._flag = 5505;
+ scene->setAction(&scene->_action2, scene);
+ scene->_sceneMode = 5509;
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1;
+ scene->setAction(&scene->_sequenceManager, scene, 5510, &BF_GLOBALS._player, this, NULL);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene551::DrunkStanding::startAction(CursorType action, Event &event) {
+ Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(550, 15);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(550, 16);
+ return true;
+ case CURSOR_TALK:
+ SceneItem::display2(550, 17);
+ return true;
+ case INV_HANDCUFFS:
+ scene->_harrison.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS.set2Flags(f1098Drunk);
+ BF_GLOBALS.setFlag(didDrunk);
+ _flag = 2;
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 5509;
+
+ scene->setAction(&scene->_sequenceManager, scene, 5509, &BF_GLOBALS._player, this, &scene->_harrison, NULL);
+ BF_GLOBALS.set2Flags(f1015Drunk);
+ return true;
+ default:
+ return NamedObjectExt::startAction(action, event);
+ }
+}
+
+bool Scene551::Drunk::startAction(CursorType action, Event &event) {
+ Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ switch (_flag) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 0;
+ scene->setAction(&scene->_sequenceManager, scene, 5505, &BF_GLOBALS._player, &scene->_object15, NULL);
+ break;
+ case 1:
+ SceneItem::display2(550, 11);
+ break;
+ case 2:
+ SceneItem::display2(550, 12);
+ break;
+ case 3:
+ SceneItem::display2(550, 27);
+ break;
+ }
+ return true;
+ case CURSOR_USE:
+ switch (_flag) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS.getFlag(fTalkedToDrunkInCar)) {
+ scene->_sceneMode = 5508;
+ scene->setAction(&scene->_sequenceManager, scene, 5508, &BF_GLOBALS._player, NULL);
+ } else {
+ BF_GLOBALS.setFlag(fTalkedToDrunkInCar);
+ scene->_sceneMode = 16;
+ scene->setAction(&scene->_sequenceManager, scene, 5504, &BF_GLOBALS._player, &scene->_object15, NULL);
+ }
+ break;
+ case 2:
+ SceneItem::display2(550, 13);
+ break;
+ case 3:
+ SceneItem::display2(550, 27);
+ break;
+ default:
+ break;
+ }
+ return true;
+ case CURSOR_TALK:
+ if (_flag)
+ break;
+ BF_GLOBALS._player.disableControl();
+
+ if (BF_GLOBALS.getFlag(fTalkedToDrunkInCar)) {
+ scene->_sceneMode = 5508;
+ scene->setAction(&scene->_sequenceManager, scene, 5508, &BF_GLOBALS._player, NULL);
+ } else {
+ BF_GLOBALS.setFlag(fTalkedToDrunkInCar);
+ scene->_sceneMode = 0;
+ scene->setAction(&scene->_sequenceManager, scene, 5504, &BF_GLOBALS._player, &scene->_object15, NULL);
+ }
+ return true;
+ case INV_CENTER_PUNCH:
+ if (_flag) {
+ SceneItem::display2(550, 14);
+ } else {
+ BF_GLOBALS.set2Flags(f1098Drunk);
+ BF_GLOBALS.setFlag(didDrunk);
+ _flag = 1;
+ BF_GLOBALS._uiElements.addScore(30);
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 5506;
+ scene->setAction(&scene->_sequenceManager, scene, 5506, &BF_GLOBALS._player, this,
+ &scene->_object12, NULL);
+ }
+ return true;
+ default:
+ break;
+ }
+
+ return NamedObjectExt::startAction(action, event);
+}
+
+bool Scene551::PatrolCarTrunk::startAction(CursorType action, Event &event) {
+ Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (BF_INVENTORY.getObjectScene(INV_CENTER_PUNCH) != 1) {
+ BF_GLOBALS._walkRegions.proc2(18);
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 2;
+ scene->setAction(&scene->_sequenceManager, scene, 5503, &BF_GLOBALS._player, &scene->_harrison, this, NULL);
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+}
+
+void Scene551::TrunkInset::remove() {
+ Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene;
+ scene->_trunkKits.remove();
+ BF_GLOBALS._player.disableControl();
+
+ scene->_sceneMode = 0;
+ scene->setAction(&scene->_sequenceManager, scene, 5516, &scene->_harrison,
+ &scene->_patrolCarTrunk, NULL);
+
+ FocusObject::remove();
+}
+
+bool Scene551::TrunkInset::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(550, 18);
+ return true;
+ case CURSOR_USE:
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene551::TrunkKits::startAction(CursorType action, Event &event) {
+ Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene;
+
+ Rect tempRect = _bounds;
+ tempRect.collapse(10, 6);
+ if (!tempRect.contains(event.mousePos))
+ return false;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ switch (_frame) {
+ case 1:
+ SceneItem::display2(550, 19);
+ break;
+ case 2:
+ SceneItem::display2(550, 20);
+ break;
+ case 3:
+ SceneItem::display2(550, 21);
+ break;
+ default:
+ break;
+ }
+ return true;
+ case CURSOR_USE:
+ if (event.mousePos.y < _bounds.top) {
+ setFrame(1);
+ } else if ((event.mousePos.x < (_bounds.left - 25)) && (_frame > 1)) {
+ SceneItem::display2(550, 28);
+ } else {
+ switch (_frame) {
+ case 1:
+ setFrame(BF_INVENTORY.getObjectScene(INV_CENTER_PUNCH) == 1 ? 3 : 2);
+ break;
+ case 2:
+ if (!BF_GLOBALS.getFlag(fShowedBluePrint)) {
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fShowedBluePrint);
+ }
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 5520;
+ scene->setAction(&scene->_sequenceManager, scene, 5520, &BF_GLOBALS._player, NULL);
+ BF_INVENTORY.setObjectScene(INV_CENTER_PUNCH, 1);
+ setFrame(3);
+ break;
+ case 3:
+ setFrame(1);
+ break;
+ default:
+ break;
+ }
+ }
+ return true;
+ case INV_CENTER_PUNCH:
+ SceneItem::display2(550, 22);
+ BF_INVENTORY.setObjectScene(INV_CENTER_PUNCH, 0);
+ setFrame(2);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene551::Harrison::startAction(CursorType action, Event &event) {
+ Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(550, 23);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(550, 24);
+ return true;
+ case CURSOR_TALK:
+ BF_GLOBALS._player.disableControl();
+
+ if (scene->_drunkStanding._flag == 1) {
+ _flag = 5508;
+ } else if (!scene->_field1CD0) {
+ _flag = 5502;
+ } else {
+ scene->_field1CD0 = 1;
+ _flag = 5500;
+ }
+ scene->setAction(&scene->_action2);
+ return true;
+ default:
+ return NamedObjectExt::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene551::Item4::startAction(CursorType action, Event &event) {
+ Scene551 *scene = (Scene551 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(550, 34);
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1;
+ scene->setAction(&scene->_sequenceManager, scene, 5510, &BF_GLOBALS._player, &scene->_vechile2, NULL);
+ return true;
+ default:
+ return false;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene551::Scene551(): Scene550() {
+ _field1CD0 = _field1CD2 = 0;
+}
+
+void Scene551::synchronize(Serializer &s) {
+ Scene550::synchronize(s);
+ s.syncAsSint16LE(_field1CD0);
+ s.syncAsSint16LE(_field1CD2);
+}
+
+void Scene551::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(550);
+ BF_GLOBALS._walkRegions.load(551);
+ BF_GLOBALS._sound1.fadeSound(16);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeUniformSpeaker);
+ _stripManager.addSpeaker(&_gigglesSpeaker);
+ _stripManager.addSpeaker(&_drunkSpeaker);
+
+ if (BF_GLOBALS.getFlag(fHasLeftDrunk)) {
+ _item4.setBounds(Rect(0, 0, 320, 170));
+ BF_GLOBALS._sceneItems.push_back(&_item4);
+ }
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.setPosition(Common::Point(160, 100));
+ BF_GLOBALS._player._moveDiff = Common::Point(2, 1);
+ BF_GLOBALS._player.enableControl();
+
+ _caravanDoor.postInit();
+ _caravanDoor.setVisage(550);
+ _caravanDoor.setPosition(Common::Point(34, 66));
+ BF_GLOBALS._sceneItems.push_back(&_caravanDoor);
+
+ _vechile2.postInit();
+ _vechile2.setVisage(301);
+ _vechile2.setStrip(1);
+ _vechile2.setPosition(Common::Point(205, 77));
+ _vechile2.fixPriority(70);
+ _vechile2.changeZoom(80);
+ BF_GLOBALS._sceneItems.push_back(&_vechile2);
+
+ BF_GLOBALS._walkRegions.proc1(14);
+
+ _drunk.postInit();
+ _drunk.setVisage(550);
+ _drunk.setStrip(3);
+ _drunk.fixPriority(84);
+ _drunk.setPosition(Common::Point(29, 92));
+ _drunk._flag = 0;
+ BF_GLOBALS._sceneItems.push_back(&_drunk);
+
+ _object12.postInit();
+ _object12.setVisage(550);
+ _object12.setStrip(7);
+ _object12.setPosition(Common::Point(29, 92));
+ _object12.hide();
+
+ _object13.postInit();
+ _object13.setVisage(550);
+ _object13.setStrip(2);
+ _object13.setPosition(Common::Point(29, 92));
+ _object13.fixPriority(82);
+ _object13.setDetails(550, 8, -1, 9, 1, NULL);
+
+ if (BF_GLOBALS.getFlag(didDrunk)) {
+ _drunk._flag = 3;
+ _drunk.setStrip(3);
+
+ _object12.show();
+ _object12.setDetails(550, 25, -1, 26, 1, NULL);
+ BF_GLOBALS._sceneItems.push_front(&_object12);
+
+ _harrison.postInit();
+ _harrison.setVisage(304);
+ _harrison.setPosition(Common::Point(67, 102));
+ _harrison.setStrip(8);
+ _harrison.setFrame(1);
+ _harrison._flag = 1;
+ BF_GLOBALS._sceneItems.push_back(&_harrison);
+
+ _object14.postInit();
+ _object14.setVisage(550);
+ _object14.setStrip(5);
+ _object14.animate(ANIM_MODE_2, NULL);
+ _object14.fixPriority(80);
+ _object14.setPosition(Common::Point(122, 57));
+
+ _object11.postInit();
+ _object11.setVisage(550);
+ _object11.setStrip(2);
+ _object11.setFrame(2);
+ _object11.setPosition(Common::Point(116, 84));
+ _object11.fixPriority(77);
+ _object11.setDetails(550, 32, -1, 10, 1, NULL);
+
+ _drunkStanding.postInit();
+ _drunkStanding._flag = 0;
+ _drunkStanding.setVisage(554);
+ _drunkStanding.setStrip(7);
+ _drunkStanding.setFrame(8);
+ _drunkStanding.fixPriority(83);
+ _drunkStanding.setPosition(Common::Point(57, 99));
+ } else {
+ _harrison.postInit();
+ _harrison.setVisage(304);
+ _harrison.setPosition(Common::Point(126, 83));
+ _harrison.setObjectWrapper(new SceneObjectWrapper());
+ _harrison._flag = 0;
+ _harrison._moveDiff = Common::Point(2, 1);
+ BF_GLOBALS._sceneItems.push_back(&_harrison);
+
+ _object14.postInit();
+ _object14.setVisage(550);
+ _object14.setStrip(5);
+ _object14.animate(ANIM_MODE_2, NULL);
+ _object14.fixPriority(80);
+ _object14.setPosition(Common::Point(122, 57));
+
+ _patrolCarTrunk.postInit();
+ _patrolCarTrunk.setVisage(550);
+ _patrolCarTrunk.setStrip(4);
+ _patrolCarTrunk.setFrame(1);
+ _patrolCarTrunk.setPosition(Common::Point(149, 69));
+ _patrolCarTrunk.fixPriority(79);
+ _patrolCarTrunk.setDetails(550, 18, -1, 9, 1, NULL);
+
+ _object11.postInit();
+ _object11.setVisage(550);
+ _object11.setStrip(2);
+ _object11.setFrame(2);
+ _object11.setPosition(Common::Point(116, 84));
+ _object11.fixPriority(77);
+ _object11.setDetails(550, 32, -1, 10, 1, NULL);
+
+ _drunkStanding.postInit();
+ _drunkStanding._flag = 0;
+ _drunkStanding.setVisage(554);
+ _drunkStanding.fixPriority(83);
+ _drunkStanding.setPosition(Common::Point(47, 93));
+
+ _object15.postInit();
+ _object15.setVisage(552);
+ _object15.setPosition(Common::Point(59, 94));
+ _object15.fixPriority(200);
+ _object15.hide();
+ }
+
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 3;
+ setAction(&_sequenceManager, this, 5502, &BF_GLOBALS._player, &_vechile2, NULL);
+
+ _item2.setDetails(Rect(0, 26, 53, 67), 550, 1, -1, 2, 1, NULL);
+ _item3.setDetails(Rect(53, 12, 173, 65), 550, 4, -1, 5, 1, NULL);
+ _item1.setDetails(Rect(0, 0, 320, 170), 550, 6, -1, -1, 1, NULL);
+}
+
+void Scene551::signal() {
+ switch (_sceneMode) {
+ case 0:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 1:
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS.set2Flags(f1027Drunk);
+ BF_GLOBALS.set2Flags(f1097Drunk);
+
+ if (BF_GLOBALS.getFlag(didDrunk))
+ BF_GLOBALS.setFlag(f1098Drunk);
+
+ BF_GLOBALS._sceneManager.changeScene(60);
+ break;
+ case 2:
+ BF_GLOBALS._walkRegions.proc1(18);
+
+ _trunkInset.postInit();
+ _trunkInset.setVisage(553);
+ _trunkInset.setPosition(Common::Point(59, 92));
+ _trunkInset.fixPriority(252);
+ BF_GLOBALS._sceneItems.push_front(&_trunkInset);
+
+ _trunkKits.postInit();
+ _trunkKits.setVisage(553);
+ _trunkKits.setStrip(2);
+ _trunkKits.setPosition(Common::Point(57, 73));
+ _trunkKits.fixPriority(254);
+ BF_GLOBALS._sceneItems.push_front(&_trunkKits);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 3:
+ if (BF_GLOBALS.getFlag(talkedToHarrisAboutDrunk)) {
+ BF_GLOBALS._player.enableControl();
+ } else {
+ BF_GLOBALS.setFlag(talkedToHarrisAboutDrunk);
+ _harrison._flag = 5500;
+ setAction(&_action2);
+ }
+ break;
+ case 5506:
+ _harrison.setObjectWrapper(new SceneObjectWrapper());
+ ADD_PLAYER_MOVER_NULL(_harrison, 88, 91);
+
+ _object12.show();
+ _object12.setDetails(550, 25, -1, 26, 1, NULL);
+ BF_GLOBALS._sceneItems.push_front(&_object12);
+ BF_GLOBALS._player.enableControl();
+
+ _sceneMode = 5507;
+ setAction(&_sequenceManager, this, 5507, &BF_GLOBALS._player, &_drunk, &_drunkStanding, NULL);
+ break;
+ case 5507:
+ BF_GLOBALS._walkRegions.proc1(2);
+ BF_GLOBALS._walkRegions.proc1(4);
+
+ _drunkStanding._flag = 1;
+ BF_GLOBALS._sceneItems.push_front(&_drunkStanding);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 5508:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager, this, 5505, &BF_GLOBALS._player, &_object15, NULL);
+ break;
+ case 5509:
+ BF_INVENTORY.setObjectScene(INV_CENTER_PUNCH, 0);
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 5510;
+ setAction(&_sequenceManager, this, 5510, &BF_GLOBALS._player, &_vechile2, NULL);
+ break;
+ case 5510:
+ BF_GLOBALS._bookmark = bCalledToDrunkStop;
+ if (BF_GLOBALS.getFlag(didDrunk))
+ BF_GLOBALS.setFlag(fHasLeftDrunk);
+
+ BF_GLOBALS._sceneManager.changeScene(60);
+ break;
+ case 5520:
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ _harrison.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.enableControl();
+ break;
+ default:
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene551::dispatch() {
+ SceneExt::dispatch();
+
+ if ((_drunkStanding._flag != 2) && !_harrison._mover && !_field1CD2)
+ _harrison.updateAngle(BF_GLOBALS._player._position);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 550 - Study
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene560::Action1::signal() {
+ Scene560 *scene = (Scene560 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(10);
+ break;
+ case 1:
+ ADD_MOVER(BF_GLOBALS._player, 105, 140);
+ break;
+ case 2:
+ scene->_deskChair.hide();
+
+ BF_GLOBALS._player.changeZoom(81);
+ BF_GLOBALS._player.setVisage(561);
+ BF_GLOBALS._player.setStrip(2);
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player.setPosition(Common::Point(96, 138));
+ BF_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 3:
+ scene->_deskChair.setVisage(561);
+ scene->_deskChair.setFrame(BF_GLOBALS._player._frame);
+ scene->_deskChair.setStrip(BF_GLOBALS._player._strip);
+ scene->_deskChair.setPosition(BF_GLOBALS._player._position);
+
+ scene->_field380 = 1;
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene560::Action2::signal() {
+ Scene560 *scene = (Scene560 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ setDelay(10);
+ break;
+ case 1:
+ scene->_deskChair.hide();
+
+ BF_GLOBALS._player.setVisage(561);
+ BF_GLOBALS._player.setStrip(2);
+ BF_GLOBALS._player.setFrame(BF_GLOBALS._player.getFrameCount());
+ BF_GLOBALS._player.animate(ANIM_MODE_6, this);
+ break;
+ case 2:
+ scene->_field380 = 0;
+ scene->_deskChair.setPosition(Common::Point(81, 149));
+ scene->_deskChair.setVisage(561);
+ scene->_deskChair.setStrip(3);
+ scene->_deskChair.setFrame(1);
+ scene->_deskChair.fixPriority(151);
+ scene->_deskChair.show();
+
+ BF_GLOBALS._player.setVisage(563);
+ BF_GLOBALS._player.setPosition(Common::Point(105, 140));
+ BF_GLOBALS._player.fixPriority(-1);
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, this);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.enableControl();
+ ADD_PLAYER_MOVER(scene->_destPosition.x, scene->_destPosition.y);
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene560::Action3::signal() {
+ Scene560 *scene = (Scene560 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ setDelay(10);
+ break;
+ case 1:
+ if (scene->_field380) {
+ setDelay(10);
+ } else {
+ setAction(&scene->_action1, this);
+ }
+ break;
+ case 2:
+ BF_GLOBALS._sceneManager.changeScene(570);
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene560::PicturePart::startAction(CursorType action, Event &event) {
+ Scene560 *scene = (Scene560 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ if (scene->_field380) {
+ SceneItem::display2(560, 54);
+ } else if ((scene->_sceneMode != 4) && (scene->_sceneMode != 3)) {
+ scene->_sceneMode = _flag + 4;
+ PlayerMover *mover = new PlayerMover();
+ Common::Point destPos(139, 106);
+ BF_GLOBALS._player.addMover(mover, &destPos, scene);
+ }
+ return true;
+ default:
+ return NamedHotspotExt::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene560::DeskChair::startAction(CursorType action, Event &event) {
+ Scene560 *scene = (Scene560 *)BF_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_USE) && !scene->_field380) {
+ scene->setAction(&scene->_action1);
+ return true;
+ } else {
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene560::Box::startAction(CursorType action, Event &event) {
+ Scene560 *scene = (Scene560 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (scene->_field380) {
+ SceneItem::display2(560, 54);
+ } else {
+ scene->_sceneMode = 9;
+ Common::Point destPos(289, 108);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &destPos, scene);
+ }
+ return true;
+ default:
+ return NamedObjectExt::startAction(action, event);
+ }
+}
+
+void Scene560::SafeInset::postInit(SceneObjectList *OwnerList) {
+ Scene560 *scene = (Scene560 *)BF_GLOBALS._sceneManager._scene;
+ FocusObject::postInit();
+
+ _cursorVisage.setVisage(1, 5);
+
+ if (BF_GLOBALS._safeCombination == 172) {
+ setFrame(2);
+ if (BF_INVENTORY.getObjectScene(INV_NICKEL) == 560) {
+ scene->_nickel.postInit();
+ scene->_nickel.setVisage(560);
+ scene->_nickel.setStrip(2);
+ scene->_nickel.setFrame(3);
+ scene->_nickel.fixPriority(252);
+ scene->_nickel.setPosition(Common::Point(181, 140));
+ scene->_nickel.setDetails(560, 47, 48, -1, 1, NULL);
+ BF_GLOBALS._sceneItems.remove(&scene->_nickel);
+ BF_GLOBALS._sceneItems.push_front(&scene->_nickel);
+ }
+ } else {
+ setFrame(1);
+ _item1.setDetails(Rect(143, 68, 159, 85), 560, 49, 50, -1, 1, NULL);
+ _item2.setDetails(Rect(159, 68, 175, 85), 560, 49, 50, -1, 1, NULL);
+ _item3.setDetails(Rect(175, 68, 191, 85), 560, 49, 50, -1, 1, NULL);
+ _item4.setDetails(Rect(143, 86, 159, 102), 560, 49, 50, -1, 1, NULL);
+ _item5.setDetails(Rect(159, 86, 175, 102), 560, 49, 50, -1, 1, NULL);
+ _item6.setDetails(Rect(175, 86, 191, 102), 560, 49, 50, -1, 1, NULL);
+
+ BF_GLOBALS._sceneItems.remove(&_item1);
+ BF_GLOBALS._sceneItems.remove(&_item2);
+ BF_GLOBALS._sceneItems.remove(&_item3);
+ BF_GLOBALS._sceneItems.remove(&_item4);
+ BF_GLOBALS._sceneItems.remove(&_item5);
+ BF_GLOBALS._sceneItems.remove(&_item6);
+ BF_GLOBALS._sceneItems.push_front(&_item6);
+ BF_GLOBALS._sceneItems.push_front(&_item5);
+ BF_GLOBALS._sceneItems.push_front(&_item4);
+ BF_GLOBALS._sceneItems.push_front(&_item3);
+ BF_GLOBALS._sceneItems.push_front(&_item2);
+ BF_GLOBALS._sceneItems.push_front(&_item1);
+
+ _item1._flag = 1;
+ _item2._flag = 2;
+ _item3._flag = 3;
+ _item4._flag = 4;
+ _item5._flag = 5;
+ _item6._flag = 6;
+
+ _digit2.postInit();
+ _digit2.setVisage(560);
+ _digit2.setStrip(3);
+ _digit2.setPosition(Common::Point(151, 94));
+ _digit2.fixPriority(252);
+
+ _digit1.postInit();
+ _digit1.setVisage(560);
+ _digit1.setStrip(3);
+ _digit1.setPosition(Common::Point(167, 94));
+ _digit1.fixPriority(252);
+
+ _digit0.postInit();
+ _digit0.setVisage(560);
+ _digit0.setStrip(3);
+ _digit0.setPosition(Common::Point(183, 94));
+ _digit0.fixPriority(252);
+
+ int amount = (BF_GLOBALS._safeCombination != 0) ? BF_GLOBALS._safeCombination : 1000;
+
+ // Get digit 0 portion
+ int remainder = amount % 10;
+ amount /= 10;
+ _digit0.setFrame(!remainder ? 10 : remainder);
+
+ // Get digit 1 portion
+ remainder = amount % 10;
+ amount /= 10;
+ _digit1.setFrame(!remainder ? 10 : remainder);
+
+ // Get digit 2 portion
+ remainder = amount % 10;
+ _digit2.setFrame(!remainder ? 10 : remainder);
+ }
+}
+
+void Scene560::SafeInset::remove() {
+ Scene560 *scene = (Scene560 *)BF_GLOBALS._sceneManager._scene;
+
+ _item1.remove();
+ _item2.remove();
+ _item3.remove();
+ _item4.remove();
+ _item5.remove();
+ _item6.remove();
+ _digit2.remove();
+ _digit1.remove();
+ _digit0.remove();
+
+ scene->_nickel.remove();
+
+ if (BF_GLOBALS._events.getCursor() == CURSOR_USE) {
+ GfxSurface cursor = _cursorVisage.getFrame(2);
+ BF_GLOBALS._events.setCursor(cursor);
+ }
+
+ FocusObject::remove();
+}
+
+void Scene560::SafeInset::signal() {
+ Scene560 *scene = (Scene560 *)BF_GLOBALS._sceneManager._scene;
+
+ // Recalculate the new total
+ int total = 0;
+ if (_digit2._frame < 10)
+ total = _digit2._frame * 100;
+ if (_digit1._frame < 10)
+ total += _digit1._frame * 10;
+ if (_digit0._frame < 10)
+ total += _digit0._frame;
+
+ BF_GLOBALS._safeCombination = !total ? 1000 : total;
+
+ // Check if the combination is correct
+ if (total == 172) {
+ BF_GLOBALS._sceneObjects->draw();
+
+ if (!BF_GLOBALS.getFlag(fGotPointsForBank)) {
+ BF_GLOBALS._uiElements.addScore(50);
+ BF_GLOBALS.setFlag(fGotPointsForBank);
+ }
+
+ setFrame(2);
+ GfxSurface cursor = _cursorVisage.getFrame(2);
+ BF_GLOBALS._events.setCursor(cursor);
+
+ _item1.remove();
+ _item2.remove();
+ _item3.remove();
+ _item4.remove();
+ _item5.remove();
+ _item6.remove();
+ _digit2.remove();
+ _digit1.remove();
+ _digit0.remove();
+
+ if (BF_INVENTORY.getObjectScene(INV_NICKEL) == 560) {
+ // Nickel is still in the safe, show it
+ scene->_nickel.postInit();
+ scene->_nickel.setVisage(560);
+ scene->_nickel.setStrip(2);
+ scene->_nickel.setFrame(3);
+ scene->_nickel.fixPriority(252);
+ scene->_nickel.setPosition(Common::Point(181, 140));
+ scene->_nickel.setDetails(560, 47, 48, -1, 1, NULL);
+ BF_GLOBALS._sceneItems.remove(&scene->_nickel);
+ BF_GLOBALS._sceneItems.push_front(&scene->_nickel);
+ }
+ }
+}
+void Scene560::SafeInset::process(Event &event) {
+ if (_bounds.contains(event.mousePos)) {
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ if (cursorId == CURSOR_USE) {
+ // Instead of standard cursor, use special hand cursor
+ GfxSurface cursor = _cursorVisage.getFrame(6);
+ BF_GLOBALS._events.setCursor(cursor);
+ } else {
+ // Set cursor again just in case Exit cursor was showing
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == CURSOR_WALK) &&
+ (event.btnState == 3)) {
+ BF_GLOBALS._events.setCursor(CURSOR_USE);
+ event.handled = true;
+ }
+ } else {
+ GfxSurface cursor = _cursorVisage.getFrame(7);
+ BF_GLOBALS._events.setCursor(cursor);
+
+ if ((event.mousePos.y < BF_INTERFACE_Y) && (event.eventType == EVENT_BUTTON_DOWN)) {
+ // Leave the safe view
+ event.handled = true;
+ remove();
+ }
+ }
+}
+
+bool Scene560::SafeInset::Item::startAction(CursorType action, Event &event) {
+ Scene560 *scene = (Scene560 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ switch (_flag) {
+ case 1: {
+ int newFrame = scene->_safeInset._digit2._frame + 1;
+ if (newFrame == 11)
+ newFrame = 1;
+
+ scene->_safeInset._digit2.setFrame(newFrame);
+ break;
+ }
+ case 2: {
+ int newFrame = scene->_safeInset._digit1._frame + 1;
+ if (newFrame == 11)
+ newFrame = 1;
+
+ scene->_safeInset._digit1.setFrame(newFrame);
+ break;
+ }
+ case 3: {
+ int newFrame = scene->_safeInset._digit0._frame + 1;
+ if (newFrame == 11)
+ newFrame = 1;
+
+ scene->_safeInset._digit0.setFrame(newFrame);
+ break;
+ }
+ case 4: {
+ int newFrame = scene->_safeInset._digit2._frame - 1;
+ if (newFrame == 0)
+ newFrame = 10;
+
+ scene->_safeInset._digit2.setFrame(newFrame);
+ break;
+ }
+ case 5: {
+ int newFrame = scene->_safeInset._digit1._frame - 1;
+ if (newFrame == 0)
+ newFrame = 10;
+
+ scene->_safeInset._digit1.setFrame(newFrame);
+ break;
+ }
+ case 6: {
+ int newFrame = scene->_safeInset._digit0._frame - 1;
+ if (newFrame == 0)
+ newFrame = 10;
+
+ scene->_safeInset._digit0.setFrame(newFrame);
+ break;
+ }
+ default:
+ break;
+ }
+
+ scene->_safeInset.signal();
+ scene->_sound1.play(75);
+ return true;
+ default:
+ return NamedHotspotExt::startAction(action, event);
+ }
+}
+
+bool Scene560::Nickel::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_USE) {
+ BF_INVENTORY.setObjectScene(INV_NICKEL, 1);
+ BF_GLOBALS._uiElements.addScore(10);
+ remove();
+ return true;
+ } else {
+ return NamedObject::startAction(action, event);
+ }
+}
+
+void Scene560::BoxInset::postInit(SceneObjectList *OwnerList) {
+ FocusObject::postInit();
+ _item1.setDetails(Rect(110, 48, 189, 102), 560, 43, 44, -1, 1, NULL);
+ BF_GLOBALS._sceneItems.remove(&_item1);
+ BF_GLOBALS._sceneItems.push_front(&_item1);
+}
+
+void Scene560::BoxInset::remove() {
+ Scene560 *scene = (Scene560 *)BF_GLOBALS._sceneManager._scene;
+
+ if (scene->_sceneMode != 3)
+ scene->_sceneMode = 0;
+
+ _item1.remove();
+ FocusObject::remove();
+}
+
+bool Scene560::BoxInset::Item1::startAction(CursorType action, Event &event) {
+ Scene560 *scene = (Scene560 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ if (!BF_GLOBALS.getFlag(fGotPointsForBox)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ BF_GLOBALS.setFlag(fGotPointsForBox);
+ }
+
+ scene->_safeInset.postInit();
+ scene->_safeInset.setVisage(560);
+ scene->_safeInset.setStrip(2);
+ scene->_safeInset.setPosition(Common::Point(160, 141));
+ scene->_safeInset.fixPriority(251);
+ scene->_safeInset.setDetails(560, 45, 46, -1);
+
+ scene->_sceneMode = 3;
+ scene->_boxInset.remove();
+
+ GfxSurface cursor = surfaceFromRes(1, 5, 6);
+ BF_GLOBALS._events.setCursor(cursor);
+ return true;
+ } else {
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene560::Computer::startAction(CursorType action, Event &event) {
+ Scene560 *scene = (Scene560 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (BF_GLOBALS._bookmark < bTalkedToGrannyAboutSkipsCard) {
+ SceneItem::display2(666, 24);
+ } else {
+ scene->setAction(&scene->_action3);
+ }
+ return true;
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene560::Scene560(): SceneExt() {
+ _field380 = _field11EA = 0;
+}
+
+void Scene560::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(560);
+ setZoomPercents(100, 60, 168, 90);
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+
+ _picture1.setDetails(Rect(121, 16, 139, 35), 560, -1, -1, -1, 1, NULL);
+ _picture2.setDetails(Rect(139, 16, 157, 35), 560, -1, -1, -1, 1, NULL);
+ _picture3.setDetails(Rect(121, 35, 139, 54), 560, -1, -1, -1, 1, NULL);
+ _picture4.setDetails(Rect(139, 35, 157, 54), 560, -1, -1, -1, 1, NULL);
+ _picture1._flag = 3;
+ _picture2._flag = 4;
+ _picture3._flag = 2;
+ _picture4._flag = 1;
+
+ if (BF_GLOBALS._dayNumber == 0)
+ BF_GLOBALS._dayNumber = 3;
+
+ if (BF_GLOBALS._bookmark >= bTalkedToGrannyAboutSkipsCard) {
+ _box.postInit();
+ _box.setVisage(560);
+ _box.setStrip(4);
+ _box.setFrame(1);
+ _box.setPosition(Common::Point(295, 37));
+ _box.setDetails(560, 41, 42, -1, 1, NULL);
+ }
+
+ _deskChair.postInit();
+ _deskChair.setVisage(561);
+ _deskChair.setStrip(3);
+ _deskChair.setPosition(Common::Point(81, 149));
+ _deskChair.fixPriority(151);
+ _deskChair.changeZoom(81);
+
+ if (BF_GLOBALS._sceneManager._previousScene == 570) {
+ // Returning from using computer
+ BF_GLOBALS._events.setCursor(CURSOR_USE);
+
+ _deskChair.hide();
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(561);
+ BF_GLOBALS._player.setStrip(2);
+ BF_GLOBALS._player.setFrame(BF_GLOBALS._player.getFrameCount());
+ BF_GLOBALS._player._moveDiff.x = 11;
+ BF_GLOBALS._player.setPosition(Common::Point(96, 138));
+ BF_GLOBALS._player.changeZoom(81);
+
+ _deskChair.setFrame(BF_GLOBALS._player._frame);
+ _deskChair.setStrip(BF_GLOBALS._player._strip);
+ _deskChair.setPosition(BF_GLOBALS._player._position);
+
+ _field11EA = 0;
+ _field380 = 1;
+ } else {
+ // Entering study through doorway
+ _field11EA = 0;
+ _field380 = 0;
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(563);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.setPosition(Common::Point(79, 110));
+ BF_GLOBALS._player._moveDiff.x = 11;
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.disableControl();
+
+ _sceneMode = 10;
+ ADD_MOVER(BF_GLOBALS._player, 85, 115);
+ }
+
+ _computer.setDetails(Rect(16, 77, 58, 107), 560, 2, -1, -1, 1, NULL);
+ _deskChair.setDetails(560, 3, -1, -1, 1, NULL);
+ _chair.setDetails(Rect(163, 64, 196, 102), 560, 13, 25, 36, 1, NULL);
+ _lamp.setDetails(Rect(197, 43, 214, 56), 560, 7, 19, 30, 1, NULL);
+ _item4.setDetails(Rect(121, 18, 156, 54), 560, 8, 20, 31, 1, NULL);
+ _trophy.setDetails(Rect(259, 52, 275, 63), 560, 10, 22, 33, 1, NULL);
+ _watercolours.setDetails(Rect(214, 48, 239, 64), 560, 12, 24, 35, 1, NULL);
+ _fileCabinets.setDetails(Rect(0, 47, 49, 100), 560, 14, 26, 37, 1, NULL);
+ _certificate.setDetails(Rect(280, 51, 292, 62), 560, 11, 23, 34, 1, NULL);
+ _bookcase.setDetails(Rect(176, 0, 319, 103), 560, 9, 21, 32, 1, NULL);
+ _desk.setDetails(1, 560, 6, 10, 29, 1);
+ _item12.setDetails(Rect(62, 16, 96, 101), 560, 51, 52, 53, 1, NULL);
+ _carpet.setDetails(Rect(0, 103, 319, 167), 560, 5, 16, 28, 1, NULL);
+ _office.setDetails(Rect(0, 0, 320, 168), 560, 4, -1, -1, 1, NULL);
+
+ BF_GLOBALS._player.enableControl();
+}
+
+void Scene560::signal() {
+ switch (_sceneMode) {
+ case 1:
+ _object6.hide();
+ _object6.remove();
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ BF_GLOBALS._player._strip = 4;
+ BF_GLOBALS._player._frame = 1;
+ BF_GLOBALS._player.disableControl();
+
+ _object6.postInit();
+ _object6.setVisage(560);
+ _object6.setStrip(1);
+ _object6.setFrame(_sceneMode - 4);
+ _object6.setPosition(Common::Point(160, 141));
+ _object6.fixPriority(250);
+ _stripManager.start(_sceneMode + 5595, this);
+ _sceneMode = 1;
+ break;
+ case 9:
+ // Clicked on the Baseball Cards Box
+ _object6._strip = 4;
+ _object6._frame = 1;
+
+ if (BF_GLOBALS._safeCombination == 172) {
+ if (_sceneMode != 3) {
+ _safeInset.postInit();
+ _safeInset.setVisage(560);
+ _safeInset.setStrip(2);
+ _safeInset.setPosition(Common::Point(160, 141));
+ _safeInset.fixPriority(251);
+ _safeInset.setDetails(560, 45, 46, -1);
+
+ _sceneMode = 3;
+ }
+ } else if ((_sceneMode != 3) && (_sceneMode != 4)) {
+ if (!BF_GLOBALS.getFlag(fGotPointsForPunch)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ BF_GLOBALS.setFlag(fGotPointsForPunch);
+ }
+
+ _boxInset.postInit();
+ _boxInset.setVisage(560);
+ _boxInset.setStrip(2);
+ _boxInset.setFrame(4);
+ _boxInset.setPosition(Common::Point(160, 141));
+ _boxInset.fixPriority(251);
+ _boxInset.setDetails(560, 43, 44, -1);
+
+ _sceneMode = 4;
+ }
+ break;
+ case 10:
+ _field11EA = 0;
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 11:
+ BF_GLOBALS._sceneManager.changeScene(270);
+ break;
+ }
+}
+
+void Scene560::process(Event &event) {
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == CURSOR_WALK) &&
+ (_field380 == 1) && !_action) {
+ _destPosition = event.mousePos;
+ BF_GLOBALS._player.disableControl();
+ setAction(&_action2);
+
+ event.handled = true;
+ }
+
+ SceneExt::process(event);
+}
+
+void Scene560::dispatch() {
+ if (!_field11EA && (BF_GLOBALS._player._position.y < 105)) {
+ _field11EA = 1;
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._sceneManager.changeScene(270);
+ }
+
+ SceneExt::dispatch();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 570 - Computer
+ *
+ *--------------------------------------------------------------------------*/
+
+Scene570::PasswordEntry::PasswordEntry(): EventHandler() {
+ _passwordStr = SCENE570_PASSWORD;
+}
+
+void Scene570::PasswordEntry::synchronize(Serializer &s) {
+ EventHandler::synchronize(s);
+ s.syncString(_entryBuffer);
+}
+
+void Scene570::PasswordEntry::postInit(SceneObjectList *OwnerList) {
+ Scene570 *scene = (Scene570 *)BF_GLOBALS._sceneManager._scene;
+
+ scene->_sceneMode = 10;
+ scene->_object3.setStrip(6);
+ scene->_object3.setFrame(1);
+ scene->_object3.fixPriority(3);
+
+ _passwordText._color1 = 22;
+ _passwordText._color2 = 9;
+ _passwordText._color3 = 9;
+ _passwordText._width = 128;
+ _passwordText._fontNumber = 9000;
+ _passwordText.setPosition(Common::Point(165, 40));
+ _passwordText.fixPriority(255);
+ _passwordText.setup(_passwordStr);
+
+ _entryText._color1 = 22;
+ _entryText._color2 = 9;
+ _entryText._color3 = 9;
+ _entryText._width = 128;
+ _entryText._fontNumber = 9000;
+ _entryText.setPosition(Common::Point(220, 40));
+ _entryText.fixPriority(255);
+ _entryText.setup(_entryBuffer);
+}
+
+void Scene570::PasswordEntry::process(Event &event) {
+ Scene570 *scene = (Scene570 *)BF_GLOBALS._sceneManager._scene;
+ bool entryChanged = false;
+
+ switch (event.eventType) {
+ case EVENT_KEYPRESS: {
+ int key = toupper(event.kbd.ascii);
+ scene->_sound1.play(72);
+
+ if ((event.kbd.keycode == Common::KEYCODE_BACKSPACE) || (event.kbd.keycode == Common::KEYCODE_DELETE)) {
+ // Delete a key from the entry
+ if (_entryBuffer.size() > 0)
+ _entryBuffer.deleteLastChar();
+ entryChanged = true;
+ } else if (event.kbd.keycode == Common::KEYCODE_RETURN) {
+ // Finished entering password
+ _passwordText.remove();
+ _entryText.remove();
+
+ checkPassword();
+ remove();
+ } else if ((key >= 32) || (key <= 126)) {
+ // Valid character pressed
+ if (_entryBuffer.size() < 10)
+ _entryBuffer += (char)key;
+ event.handled = true;
+ entryChanged = true;
+ }
+ break;
+ }
+ case EVENT_BUTTON_DOWN:
+ event.handled = true;
+ break;
+ default:
+ break;
+ }
+
+ if (entryChanged) {
+ _entryText._color1 = 22;
+ _entryText._color2 = 9;
+ _entryText._color3 = 9;
+ _entryText._width = 128;
+ _entryText._fontNumber = 9000;
+ _entryText.setPosition(Common::Point(213, 40));
+ _entryText.fixPriority(255);
+ _entryText.setup(_entryBuffer);
+
+ // Pad entered text with spaces to make up the allowed width and then display
+ Common::String msg = _entryBuffer;
+ while (msg.size() < 10)
+ msg += " ";
+ _entryText.setup(msg);
+ }
+}
+
+void Scene570::PasswordEntry::checkPassword() {
+ // Check if the password is correctly entered as 'JACKIE' or, as a nod to the
+ // reimplementation in ScummVM, as the project name.
+ Scene570 *scene = (Scene570 *)BF_GLOBALS._sceneManager._scene;
+
+ if (!_entryBuffer.compareTo("JACKIE") || !_entryBuffer.compareTo("SCUMMVM")) {
+ // Password was correct
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS._player.disableControl();
+ scene->_sound1.play(73);
+
+ BF_GLOBALS._uiElements.hide();
+ BF_GLOBALS._uiElements._active = false;
+ scene->_sceneMode = 5701;
+ scene->setAction(&scene->_sequenceManager, scene, 5701, &scene->_object3, NULL);
+ } else {
+ // Password was incorrect
+ _entryBuffer = "";
+
+ scene->_object3.fixPriority(1);
+ scene->_iconManager.refreshList();
+ BF_GLOBALS._events.setCursor(CURSOR_USE);
+ scene->_sceneMode = 0;
+ }
+}
+
+Scene570::IconManager::IconManager(): EventHandler() {
+ _mode = _selectedFolder = _fieldAA = _fieldAC = 0;
+}
+
+void Scene570::IconManager::remove() {
+ _object1.remove();
+ EventHandler::remove();
+}
+
+void Scene570::IconManager::setup(int mode) {
+ _mode = mode;
+ _selectedFolder = 0;
+
+ _object1.postInit();
+ _object1.setVisage(572);
+ _object1.fixPriority(2);
+ _object1.setFrame((mode == 1) ? 4 : 5);
+ EventHandler::postInit();
+}
+
+void Scene570::IconManager::hideList() {
+ SynchronizedList<Icon *>::iterator i;
+ for (i = _list.begin(); i != _list.end(); ++i) {
+ (*i)->_sceneText.remove();
+ }
+}
+
+void Scene570::IconManager::refreshList() {
+ Scene570 *scene = (Scene570 *)BF_GLOBALS._sceneManager._scene;
+
+ _object1.setPosition(Common::Point(163, 19));
+ scene->_object3.setStrip(4);
+
+ // Clear any current icons
+ SynchronizedList<Icon *>::iterator i;
+ for (i = _list.begin(); i != _list.end(); ++i) {
+ Icon *item = *i;
+
+ item->setVisage(572);
+ item->setStrip(1);
+ item->fixPriority(2);
+ item->setPosition(Common::Point(330, 100));
+ item->_sceneText.remove();
+ }
+
+ // Refresh the list
+ int iconIndex = 0, folderIndex = 0;
+ for (i = _list.begin(); i != _list.end(); ++i) {
+ Icon *item = *i;
+
+ if (item->_iconId == 1) {
+ // Folder
+ int parentId = item->_parentFolderId;
+ item->setFrame((_selectedFolder == (item->_folderId - 1)) ? 1 : 8);
+ item->setPosition(Common::Point(168 + parentId * 11, folderIndex * 8 + 27));
+ item->_sceneText.setPosition(Common::Point(175 + parentId * 11, folderIndex * 8 + 21));
+ item->_sceneText.setup(item->_text);
+ ++folderIndex;
+ } else if (item->_parentFolderId == _selectedFolder) {
+ item->setPosition(Common::Point(229, 27 + iconIndex * 12));
+
+ switch (item->_iconId) {
+ case 2:
+ item->setFrame(9);
+ break;
+ case 3:
+ item->setFrame(7);
+ break;
+ case 5:
+ item->setFrame(10);
+ break;
+ case 6:
+ item->setFrame(11);
+ break;
+ case 7:
+ item->setFrame(12);
+ break;
+ default:
+ break;
+ }
+
+ item->_sceneText.setPosition(Common::Point(236, iconIndex * 12 + 22));
+ item->_sceneText.setup(item->_text);
+ ++iconIndex;
+ }
+ }
+}
+
+void Scene570::IconManager::addItem(Icon *item) {
+ item->_mode = _mode;
+ _list.push_back(item);
+}
+
+Scene570::Icon::Icon(): NamedObject() {
+ _iconId = _folderId = 0;
+}
+
+void Scene570::Icon::synchronize(Serializer &s) {
+ NamedObject::synchronize(s);
+ s.syncAsSint16LE(_iconId);
+ s.syncAsSint16LE(_folderId);
+ s.syncAsSint16LE(_parentFolderId);
+ s.syncAsSint16LE(_mode);
+}
+
+void Scene570::Icon::remove() {
+ _sceneText.remove();
+ NamedObject::remove();
+}
+
+bool Scene570::Icon::startAction(CursorType action, Event &event) {
+ Scene570 *scene = (Scene570 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ switch (_iconId) {
+ case 1:
+ SceneItem::display2(570, 9);
+ break;
+ case 2:
+ SceneItem::display2(570, 10);
+ break;
+ case 3:
+ SceneItem::display2(570, 4);
+ break;
+ case 5:
+ SceneItem::display2(570, 11);
+ break;
+ case 6:
+ SceneItem::display2(570, 12);
+ break;
+ case 7:
+ SceneItem::display2(570, 13);
+ break;
+ default:
+ break;
+ }
+ return true;
+ case CURSOR_USE:
+ // Select the given icon
+ scene->_sound1.play(73);
+ switch (_iconId) {
+ case 1:
+ // Folder, so select it
+ scene->_iconManager._selectedFolder = _folderId - 1;
+ scene->_iconManager.refreshList();
+ break;
+ case 2:
+ scene->_iconManager.hideList();
+ scene->_sceneMode = 5702;
+ scene->setAction(&scene->_sequenceManager, scene, 5702, &scene->_object3, NULL);
+ break;
+ case 3:
+ scene->_iconManager.hideList();
+ scene->_passwordEntry.postInit();
+ break;
+ case 5:
+ SceneItem::display2(570, 5);
+ break;
+ case 6:
+ scene->_iconManager.hideList();
+ switch (_folderId) {
+ case 8:
+ BF_GLOBALS._uiElements.hide();
+ BF_GLOBALS._uiElements._active = false;
+ scene->_sceneMode = 5705;
+ scene->setAction(&scene->_sequenceManager, scene, 5705, &scene->_object3, NULL);
+ break;
+ case 10:
+ BF_GLOBALS._uiElements.hide();
+ BF_GLOBALS._uiElements._active = false;
+ scene->_sceneMode = 5706;
+ scene->setAction(&scene->_sequenceManager, scene, 5706, &scene->_object3, NULL);
+ break;
+ case 12:
+ BF_GLOBALS._uiElements.hide();
+ BF_GLOBALS._uiElements._active = false;
+ scene->_sceneMode = 5707;
+ scene->setAction(&scene->_sequenceManager, scene, 5707, &scene->_object3, NULL);
+ break;
+ default:
+ break;
+ }
+ break;
+ case 7:
+ scene->_iconManager.hideList();
+ BF_GLOBALS._uiElements.hide();
+ BF_GLOBALS._uiElements._active = false;
+ scene->_sceneMode = 5704;
+ scene->setAction(&scene->_sequenceManager, scene, 5704, &scene->_object3, NULL);
+ break;
+ }
+ return true;
+ case CURSOR_TALK:
+ SceneItem::display2(570, 15);
+ return true;
+ case CURSOR_PRINTER:
+ switch (_iconId) {
+ case 1:
+ // Folder - "You can't print that"
+ SceneItem::display2(570, 8);
+ break;
+ case 7:
+ scene->_sound1.play(74);
+ if (BF_INVENTORY.getObjectScene(INV_PRINT_OUT) == 570) {
+ SceneItem::display2(570, 6);
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_INVENTORY.setObjectScene(INV_PRINT_OUT, 1);
+ } else {
+ SceneItem::display2(570, 7);
+ }
+ break;
+ default:
+ // You don't want to print that
+ SceneItem::display2(570, 18);
+ break;
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+void Scene570::Icon::setDetails(int iconId, int folderId, int parentFolderId, int unused, const Common::String &msg) {
+ Scene570 *scene = (Scene570 *)BF_GLOBALS._sceneManager._scene;
+ NamedObject::postInit();
+
+ _iconId = iconId;
+ _folderId = folderId;
+ _parentFolderId = parentFolderId;
+ _text = msg;
+
+ _sceneText._color1 = 22;
+ _sceneText._color2 = 9;
+ _sceneText._color3 = 9;
+ _sceneText._width = 128;
+ _sceneText._fontNumber = 9000;
+ _sceneText.fixPriority(2);
+
+ BF_GLOBALS._sceneItems.push_front(this);
+ scene->_iconManager.addItem(this);
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene570::PowerSwitch::startAction(CursorType action, Event &event) {
+ Scene570 *scene = (Scene570 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (scene->_object4._flag == 1) {
+ setFrame(1);
+ scene->_object3.remove();
+ } else {
+ if (!BF_GLOBALS.getFlag(fGotPointsForCoin)) {
+ BF_GLOBALS._uiElements.addScore(10);
+ BF_GLOBALS.setFlag(fGotPointsForCoin);
+ }
+
+ scene->_sound1.play(70);
+ scene->_object4._flag = 1;
+ setFrame(2);
+
+ scene->_object3.postInit();
+ scene->_object3.fixPriority(1);
+ scene->_object3.setDetails(570, 16, 15, 17);
+ BF_GLOBALS._sceneItems.remove(&scene->_object3);
+ BF_GLOBALS._sceneItems.push_front(&scene->_object3);
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 5700;
+ setAction(&scene->_sequenceManager, scene, 5700, &scene->_object3, NULL);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene570::PrinterIcon::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_USE) {
+ BF_GLOBALS._events.setCursor(CURSOR_PRINTER);
+ return true;
+ } else {
+ return NamedObject::startAction(action, event);
+ }
+}
+
+void Scene570::Object3::remove() {
+ Scene570 *scene = (Scene570 *)BF_GLOBALS._sceneManager._scene;
+ scene->_object4._flag = 0;
+
+ scene->_printerIcon.remove();
+ scene->_iconManager.remove();
+ scene->_folder1.remove();
+ scene->_folder2.remove();
+ scene->_folder3.remove();
+ scene->_folder4.remove();
+ scene->_icon1.remove();
+ scene->_icon2.remove();
+ scene->_icon3.remove();
+ scene->_icon4.remove();
+ scene->_icon5.remove();
+ scene->_icon6.remove();
+ scene->_icon7.remove();
+ scene->_icon8.remove();
+ scene->_icon9.remove();
+
+ FocusObject::remove();
+ BF_GLOBALS._sceneManager.changeScene(560);
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene570::FloppyDrive::startAction(CursorType action, Event &event) {
+ Scene570 *scene = (Scene570 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (BF_INVENTORY.getObjectScene(INV_D_FLOPPY) == 571) {
+ BF_INVENTORY.setObjectScene(INV_D_FLOPPY, 1);
+ scene->_iconManager.refreshList();
+ SceneItem::display2(570, 2);
+ } else {
+ SceneItem::display2(570, 3);
+ }
+ return true;
+ case INV_D_FLOPPY:
+ BF_INVENTORY.setObjectScene(INV_D_FLOPPY, 571);
+ scene->_iconManager.refreshList();
+ return true;
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene570::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(570);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ if (BF_GLOBALS._dayNumber == 0)
+ BF_GLOBALS._dayNumber = 1;
+
+ _object4._flag = 0;
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player.hide();
+
+ _powerSwitch.postInit();
+ _powerSwitch.setVisage(570);
+ _powerSwitch.setStrip(4);
+ _powerSwitch.setFrame(1);
+ _powerSwitch.setPosition(Common::Point(163, 131));
+ _powerSwitch.setDetails(570, 1, 15, -1, 1, NULL);
+
+ _floppyDrive.setDetails(Rect(258, 111, 303, 120), 570, 0, 15, -1, 1, NULL);
+ _item11.setDetails(0, 570, 15, 15, 15, 1);
+ _monitor.setDetails(1, 570, 19, 20, 21, 1);
+ _item3.setDetails(2, 570, 22, 23, 24, 1);
+ _case.setDetails(3, 570, 25, 26, 27, 1);
+ _keyboard.setDetails(4, 570, 28, 29, 30, 1);
+ _desk.setDetails(5, 570, 31, 32, 33, 1);
+ _printer.setDetails(7, 570, 37, 38, 39, 1);
+ _window.setDetails(8, 570, 40, 41, 42, 1);
+ _plant.setDetails(9, 570, 43, 44, 45, 1);
+
+ if ((BF_GLOBALS._dayNumber == 1) && (BF_INVENTORY.getObjectScene(INV_CRATE1) == 1)) {
+ _object4.postInit();
+ _object4.setVisage(574);
+ _object4.setPosition(Common::Point(90, 84));
+ }
+}
+
+void Scene570::signal() {
+ switch (_sceneMode) {
+ case 5700:
+ _object3.setStrip(4);
+ _object3.setFrame(1);
+
+ _printerIcon.postInit();
+ _printerIcon.setVisage(572);
+ _printerIcon.setFrame(3);
+ _printerIcon.setPosition(Common::Point(172, 71));
+ _printerIcon.fixPriority(2);
+ _printerIcon.setDetails(570, 14, 15, -1, 2, NULL);
+
+ _iconManager.setup(2);
+ _folder1.setDetails(1, 1, 0, 2, SCENE570_C_DRIVE);
+ _folder2.setDetails(1, 2, 1, 2, SCENE570_RING);
+ _folder3.setDetails(1, 3, 1, 2, SCENE570_PROTO);
+ _folder4.setDetails(1, 4, 1, 2, SCENE570_WACKY);
+
+ if (!BF_GLOBALS.getFlag(fDecryptedBluePrints))
+ _icon1.setDetails(3, 5, 0, 2, SCENE570_COBB);
+ _icon2.setDetails(2, 7, 0, 2, SCENE570_LETTER);
+ if (BF_GLOBALS.getFlag(fDecryptedBluePrints))
+ _icon3.setDetails(7, 6, 0, 2, SCENE570_COBB);
+
+ _icon4.setDetails(6, 8, 1, 2, SCENE570_RINGEXE);
+ _icon5.setDetails(5, 9, 1, 2, SCENE570_RINGDATA);
+ _icon6.setDetails(6, 10, 2, 2, SCENE570_PROTOEXE);
+ _icon7.setDetails(5, 11, 2, 2, SCENE570_PROTODATA);
+ _icon8.setDetails(6, 12, 3, 2, SCENE570_WACKYEXE);
+ _icon9.setDetails(5, 13, 3, 2, SCENE570_WACKYDATA);
+
+ _iconManager.refreshList();
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 5701:
+ BF_GLOBALS.setFlag(fDecryptedBluePrints);
+ _iconManager._list.remove(&_icon1);
+ _icon1.remove();
+
+ _object3.setVisage(572);
+ _object3.setStrip(4);
+ _object3.setFrame(1);
+ _object3.fixPriority(1);
+
+ _icon3.setDetails(7, 6, 0, 2, SCENE570_COBB);
+ _iconManager.refreshList();
+ BF_GLOBALS._uiElements._active = true;
+ BF_GLOBALS._uiElements.show();
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 5704:
+ case 5705:
+ case 5706:
+ case 5707:
+ BF_GLOBALS._uiElements._active = true;
+ BF_GLOBALS._uiElements.show();
+ _object3.setPosition(Common::Point(220, 75));
+ _object3.setVisage(572);
+ _object3.setStrip(4);
+ _object3.setFrame(1);
+ // Deliberate fall-through
+ case 5702:
+ case 5703:
+ _object3.fixPriority(1);
+ _iconManager.refreshList();
+ BF_GLOBALS._player.enableControl();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene570::process(Event &event) {
+ SceneExt::process(event);
+
+ if (!event.handled && (_sceneMode == 10))
+ // Password entry active, so pass events to it
+ _passwordEntry.process(event);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 580 - Child Protective Services Parking Lot
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene580::Vechile::startAction(CursorType action, Event &event) {
+ Scene580 *scene = (Scene580 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1;
+ scene->setAction(&scene->_sequenceManager, scene, 5800, &BF_GLOBALS._player, NULL);
+ return true;
+ } else {
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene580::Door::startAction(CursorType action, Event &event) {
+ Scene580 *scene = (Scene580 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 5802;
+ scene->setAction(&scene->_sequenceManager, scene, 5802, &BF_GLOBALS._player, this, NULL);
+ return true;
+ } else {
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene580::Lyle::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_LOOK) {
+ SceneItem::display2(580, 7);
+ return true;
+ } else {
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene580::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(580);
+ setZoomPercents(45, 95, 55, 100);
+ BF_GLOBALS._sound1.changeSound(33);
+
+ if (BF_GLOBALS._dayNumber == 0)
+ BF_GLOBALS._dayNumber = 1;
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player._moveDiff = Common::Point(2, 1);
+
+ _door.postInit();
+ _door.setVisage(580);
+ _door.setStrip(4);
+ _door.setPosition(Common::Point(168, 41));
+ _door.hide();
+ _door.setDetails(580, 5, -1, -1, 1, NULL);
+
+ _vechile.postInit();
+ _vechile.setVisage(580);
+ _vechile.fixPriority(65);
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _lyle.postInit();
+ _lyle.setVisage(835);
+ _lyle.setObjectWrapper(new SceneObjectWrapper());
+ _lyle.animate(ANIM_MODE_1, NULL);
+ _lyle._moveDiff = Common::Point(2, 1);
+ _lyle.setPosition(Common::Point(149, 70));
+ BF_GLOBALS._sceneItems.push_back(&_lyle);
+
+ _vechile.changeZoom(90);
+ _vechile.setStrip(3);
+ _vechile.setPosition(Common::Point(165, 76));
+ _vechile.setDetails(580, 2, 3, -1, 1, NULL);
+ _vechile.setVisage(303);
+
+ BF_GLOBALS._player.setVisage(303);
+
+ BF_GLOBALS._walkRegions.proc1(8);
+ BF_GLOBALS._walkRegions.proc1(9);
+ BF_GLOBALS._walkRegions.proc1(10);
+ BF_GLOBALS._walkRegions.proc1(11);
+ } else {
+ _vechile.setPosition(Common::Point(159, 72));
+
+ if (BF_GLOBALS.getFlag(onDuty)) {
+ _vechile.setStrip(1);
+ _vechile.setFrame(2);
+ _vechile.setDetails(300, 11, 13, -1, 1, NULL);
+
+ BF_GLOBALS._player.setVisage(304);
+ } else {
+ _vechile.setStrip(2);
+ _vechile.setFrame(3);
+ _vechile.setDetails(580, 0, 1, -1, 1, NULL);
+
+ BF_GLOBALS._player.setVisage(303);
+ }
+ }
+
+ BF_GLOBALS._player.updateAngle(_vechile._position);
+
+ if (BF_GLOBALS._sceneManager._previousScene == 590) {
+ // Leaving Services
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager, this, 5801, &BF_GLOBALS._player, NULL);
+ } else {
+ // Arriving at parking lot
+ BF_GLOBALS._player.setPosition(Common::Point(177, 58));
+ signal();
+ }
+
+ _item1.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 580, 6, -1, -1, 1, NULL);
+}
+
+void Scene580::signal() {
+ switch (_sceneMode) {
+ case 1:
+ BF_GLOBALS._sceneManager.changeScene(60);
+ break;
+ case 5802:
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(590);
+ break;
+ default:
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene580::process(Event &event) {
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == INV_COLT45) &&
+ BF_GLOBALS._player.contains(event.mousePos)) {
+ BF_GLOBALS._player.disableControl();
+ SceneItem::display2(350, 26);
+
+ _sceneMode = 0;
+ signal();
+ event.handled = true;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 590 - Child Protective Services
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene590::Laura::startAction(CursorType action, Event &event) {
+ Scene590 *scene = (Scene590 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ if (!scene->_field17DC)
+ scene->_stripNumber = 5905;
+ else if (!scene->_field17DE) {
+ if (scene->_field17E2) {
+ scene->_stripNumber = 5907;
+ } else {
+ scene->_field17E2 = 1;
+ scene->_stripNumber = 5906;
+ }
+ }
+
+ scene->setAction(&scene->_action1);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene590::Skip::startAction(CursorType action, Event &event) {
+ Scene590 *scene = (Scene590 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ if (BF_INVENTORY.getObjectScene(INV_BASEBALL_CARD) == 1) {
+ scene->_stripNumber = !scene->_field17DC ? 5903 : 5902;
+ } else {
+ scene->_stripNumber = !scene->_field17DC ? 5901 : 5902;
+ }
+
+ scene->setAction(&scene->_action1);
+ scene->_field17DC = 1;
+ return true;
+ case INV_BASEBALL_CARD:
+ scene->_field17DE = 1;
+ BF_GLOBALS._uiElements.addScore(10);
+ BF_INVENTORY.setObjectScene(INV_BASEBALL_CARD, 2);
+ BF_GLOBALS._player.disableControl();
+
+ scene->_stripNumber = !scene->_field17DC ? 5900 : 5904;
+ scene->_field17DC = 1;
+ scene->setAction(&scene->_action2);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene590::Exit::startAction(CursorType action, Event &event) {
+ ADD_PLAYER_MOVER(BF_GLOBALS._player._position.x - 100, BF_GLOBALS._player._position.y + 75);
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene590::Action1::signal() {
+ Scene590 *scene = (Scene590 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ ADD_PLAYER_MOVER(220, 132);
+ break;
+ case 1:
+ scene->_stripManager.start(scene->_stripNumber, this);
+ break;
+ case 2:
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene590::Action2::signal() {
+ Scene590 *scene = (Scene590 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, 220, 132);
+ break;
+ }
+ case 1:
+ ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, 220, 132);
+ break;
+ case 2:
+ BF_GLOBALS._player.setVisage(381);
+ BF_GLOBALS._player.setStrip(2);
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player.setPosition(Common::Point(257, 130));
+ BF_GLOBALS._player.animate(ANIM_MODE_4, 3, 1, this);
+
+ scene->_skip.setStrip(2);
+ scene->_skip.animate(ANIM_MODE_5, NULL);
+ break;
+ case 3:
+ scene->_skip.animate(ANIM_MODE_6, NULL);
+ BF_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 4:
+ scene->_skip.setStrip(1);
+ scene->_skip.animate(ANIM_MODE_1, NULL);
+
+ BF_GLOBALS._player.setVisage(368);
+ BF_GLOBALS._player.setStrip(7);
+ BF_GLOBALS._player.setPosition(Common::Point(238, 131));
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ scene->_stripManager.start(scene->_stripNumber, this);
+ break;
+ case 5:
+ scene->_sceneMode = 3;
+ scene->signal();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene590::Scene590(): PalettedScene() {
+ _field17DC = _field17DE = _stripNumber = _field17E2 = 0;
+}
+
+void Scene590::synchronize(Serializer &s) {
+ PalettedScene::synchronize(s);
+ s.syncAsSint16LE(_field17DC);
+ s.syncAsSint16LE(_field17DE);
+ s.syncAsSint16LE(_stripNumber);
+ s.syncAsSint16LE(_field17E2);
+}
+
+void Scene590::postInit(SceneObjectList *OwnerList) {
+ PalettedScene::postInit();
+ loadScene(590);
+
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ _sound1.play(18);
+ _sound1.fade(100, 5, 10, false, NULL);
+
+ if (BF_GLOBALS._dayNumber == 0) {
+ BF_GLOBALS._dayNumber = 1;
+ BF_GLOBALS._bookmark = bEndOfWorkDayOne;
+ BF_INVENTORY.setObjectScene(INV_BASEBALL_CARD, 1);
+ }
+
+ _exit.setDetails(Rect(0, 157, 182, 167), 590, -1, -1, -1, 1, NULL);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setPosition(Common::Point(0, 190));
+
+ _stripManager.addSpeaker(&_skipSpeaker);
+ _stripManager.addSpeaker(&_lauraSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+
+ if (BF_GLOBALS.getFlag(onDuty)) {
+ BF_GLOBALS._player.setVisage(361);
+ BF_GLOBALS._player._moveDiff = Common::Point(6, 2);
+ } else {
+ BF_GLOBALS._player.setVisage(368);
+ BF_GLOBALS._player._moveDiff = Common::Point(6, 2);
+
+ if ((BF_GLOBALS._bookmark >= bEndOfWorkDayOne) && (BF_GLOBALS._bookmark < bLyleStoppedBy)) {
+ _skip.postInit();
+ _skip.setVisage(693);
+ _skip.setPosition(Common::Point(271, 117));
+ _skip.setDetails(590, 26, -1, 27, 1, NULL);
+
+ _laura.postInit();
+ _laura.setVisage(692);
+ _laura.setPosition(Common::Point(248, 115));
+ _laura.setDetails(590, 24, -1, 25, 1, NULL);
+ }
+ }
+
+ _item2.setDetails(1, 590, 0, -1, 12, 1);
+ _item3.setDetails(3, 590, 2, -1, 14, 1);
+ _item4.setDetails(20, 590, 3, -1, 15, 1);
+ _item5.setDetails(22, 590, 4, -1, 16, 1);
+ _item6.setDetails(7, 590, 6, -1, 17, 1);
+ _item7.setDetails(7, 590, 6, -1, 18, 1);
+ _item8.setDetails(9, 590, 7, -1, 19, 1);
+ _item9.setDetails(11, 590, 8, -1, 20, 1);
+ _item10.setDetails(13, 590, 9, -1, 21, 1);
+ _item11.setDetails(15, 590, 10, -1, 22, 1);
+ _item12.setDetails(17, 590, 11, -1, 23, 1);
+
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager, this, 5900, &BF_GLOBALS._player, NULL);
+}
+
+void Scene590::signal() {
+ static uint32 black = 0;
+
+ switch (_sceneMode) {
+ case 1:
+ _sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(271);
+ break;
+ case 2:
+ _sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(580);
+ break;
+ case 3:
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 0, 170);
+
+ _skip.animate(ANIM_MODE_1, NULL);
+ ADD_MOVER_NULL(_skip, 0, 170);
+
+ _laura.animate(ANIM_MODE_1, NULL);
+ ADD_MOVER_NULL(_laura, 0, 170);
+
+ _sceneMode = 1;
+ addFader((byte *)&black, 2, this);
+ break;
+ default:
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene590::process(Event &event) {
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ // Check if the cursor is on an exit
+ if (_exit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SW);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+}
+
+} // End of namespace BlueForce
+
+} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_scenes5.h b/engines/tsage/blue_force/blueforce_scenes5.h
new file mode 100644
index 0000000000..8ff5b40657
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_scenes5.h
@@ -0,0 +1,406 @@
+/* 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.
+ *
+ */
+
+#ifndef TSAGE_BLUEFORCE_SCENES5_H
+#define TSAGE_BLUEFORCE_SCENES5_H
+
+#include "common/scummsys.h"
+#include "tsage/blue_force/blueforce_logic.h"
+#include "tsage/blue_force/blueforce_speakers.h"
+#include "tsage/converse.h"
+#include "tsage/events.h"
+#include "tsage/core.h"
+#include "tsage/scenes.h"
+#include "tsage/globals.h"
+#include "tsage/sound.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+using namespace TsAGE;
+
+class Scene550: public SceneExt {
+ /* Objects */
+ class Object1: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class CaravanDoor: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Vechile: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Actions */
+ class Action1: public ActionExt {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ Object1 _object1;
+ CaravanDoor _caravanDoor;
+ Vechile _vechile;
+ NamedHotspot _item1, _item2, _item3;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerLyleHat _lyleHatSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ Action1 _action1;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
+class Scene551: public Scene550 {
+ /* Objects */
+ class Vechile: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class DrunkStanding: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Drunk: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class PatrolCarTrunk: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class TrunkInset: public FocusObject {
+ public:
+ virtual void remove();
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class TrunkKits: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Harrison: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Item4: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Actions */
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SpeakerDrunk _drunkSpeaker;
+ SpeakerJakeUniform _jakeUniformSpeaker;
+ SpeakerGiggles _gigglesSpeaker;
+ Vechile _vechile2;
+ DrunkStanding _drunkStanding;
+ Drunk _drunk;
+ PatrolCarTrunk _patrolCarTrunk;
+ TrunkInset _trunkInset;
+ TrunkKits _trunkKits;
+ Harrison _harrison;
+ NamedObject _object11, _object12, _object13;
+ SceneObject _object14, _object15;
+ Item4 _item4;
+ Action2 _action2;
+ int _field1CD0, _field1CD2;
+
+ Scene551();
+ virtual void synchronize(Serializer &s);
+ void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void dispatch();
+};
+
+class Scene560: public SceneExt {
+ /* Objects */
+ class DeskChair: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Box: public NamedObjectExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class SafeInset: public FocusObject {
+ /* Items */
+ class Item: public NamedHotspotExt {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ public:
+ NamedObject _digit0, _digit1, _digit2;
+ Item _item1, _item2, _item3, _item4, _item5, _item6;
+ Visage _cursorVisage;
+
+ virtual Common::String getClassName() { return "Scene560_SafeInset"; }
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ };
+ class Nickel: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class BoxInset: public FocusObject {
+ /* Items */
+ class Item1: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ public:
+ Item1 _item1;
+
+ virtual Common::String getClassName() { return "Scene560_BoxInset"; }
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ };
+
+ /* Item groups */
+ class PicturePart: public NamedHotspotExt {
+ public:
+ virtual Common::String getClassName() { return "Scene560_PicturePart"; }
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Computer: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Actions */
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action3: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ Action1 _action1;
+ Action2 _action2;
+ Action3 _action3;
+ SpeakerGameText _gameTextSpeaker;
+ DeskChair _deskChair;
+ Box _box;
+ SafeInset _safeInset;
+ Nickel _nickel;
+ BoxInset _boxInset;
+ NamedObject _object6;
+ PicturePart _picture1, _picture2, _picture3, _picture4;
+ Computer _computer;
+ NamedHotspot _chair, _lamp, _item4, _trophy, _watercolours, _fileCabinets;
+ NamedHotspot _certificate, _bookcase, _desk, _carpet, _item12, _office;
+ ASound _sound1;
+ int _field380, _field11EA;
+ Common::Point _destPosition;
+
+ Scene560();
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene570: public SceneExt {
+ /* Custom classes */
+ class PasswordEntry: public EventHandler {
+ private:
+ void checkPassword();
+ public:
+ SceneText _passwordText, _entryText;
+ Common::String _passwordStr, _entryBuffer;
+
+ PasswordEntry();
+ virtual Common::String getClassName() { return "Scene570_PasswordEntry"; }
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void process(Event &event);
+ };
+ class Icon: public NamedObject {
+ public:
+ SceneText _sceneText;
+ int _iconId, _folderId, _parentFolderId, _mode;
+ Common::String _text;
+
+ Icon();
+ virtual Common::String getClassName() { return "Scene570_Custom2"; }
+ virtual void synchronize(Serializer &s);
+ virtual void remove();
+ virtual bool startAction(CursorType action, Event &event);
+
+ void setDetails(int iconId, int folderId, int parentFolderId, int unused, const Common::String &msg);
+ };
+ class IconManager: public EventHandler {
+ public:
+ NamedObject _object1;
+ SynchronizedList<Icon *> _list;
+ int _mode, _selectedFolder, _fieldAA, _fieldAC;
+
+ IconManager();
+ virtual void remove();
+
+ void setup(int mode);
+ void hideList();
+ void refreshList();
+ void addItem(Icon *item);
+ };
+
+ /* Objects */
+ class PowerSwitch: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class PrinterIcon: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object3: public FocusObject {
+ public:
+ virtual void remove();
+ };
+
+ /* Items */
+ class FloppyDrive: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager;
+ SpeakerGameText _gameTextSpeaker;
+ PasswordEntry _passwordEntry;
+ PowerSwitch _powerSwitch;
+ PrinterIcon _printerIcon;
+ Object3 _object3;
+ NamedObjectExt _object4;
+ Icon _folder1, _folder2, _folder3, _folder4;
+ Icon _icon1, _icon2, _icon3, _icon4, _icon5;
+ Icon _icon6, _icon7, _icon8, _icon9;
+ IconManager _iconManager;
+ FloppyDrive _floppyDrive;
+ NamedHotspot _monitor, _item3, _case, _keyboard, _desk;
+ NamedHotspot _item7, _printer, _window, _plant, _item11;
+ ASound _sound1;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+};
+
+class Scene580: public SceneExt {
+ /* Objects */
+ class Vechile: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Door: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Lyle: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager;
+ Vechile _vechile;
+ Door _door;
+ Lyle _lyle;
+ NamedHotspot _item1;
+ SpeakerGameText _gameTextSpeaker;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+};
+
+class Scene590: public PalettedScene {
+ /* Objects */
+ class Laura: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Skip: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Items */
+ class Exit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Actions */
+ class Action1: public Action {
+ public:
+ virtual void signal();
+ };
+ class Action2: public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ Laura _laura;
+ Skip _skip;
+ SceneObject _object3;
+ Exit _exit;
+ NamedHotspot _item2, _item3, _item4, _item5, _item6, _item7;
+ NamedHotspot _item8, _item9, _item10, _item11, _item12;
+ SpeakerSkip _skipSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerLaura _lauraSpeaker;
+ ASoundExt _sound1;
+ Action1 _action1;
+ Action2 _action2;
+ int _field17DC, _field17DE, _stripNumber, _field17E2;
+
+ Scene590();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+};
+
+} // End of namespace BlueForce
+
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/blue_force/blueforce_scenes6.cpp b/engines/tsage/blue_force/blueforce_scenes6.cpp
new file mode 100644
index 0000000000..0d6587daa9
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_scenes6.cpp
@@ -0,0 +1,507 @@
+/* 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 "tsage/blue_force/blueforce_scenes6.h"
+#include "tsage/blue_force/blueforce_dialogs.h"
+#include "tsage/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/staticres.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+/*--------------------------------------------------------------------------
+ * Scene 600 - Crash cut-scene
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene600::Action1::signal() {
+ Scene600 *scene = (Scene600 *)BF_GLOBALS._sceneManager._scene;
+ static const uint32 black = 0;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(2);
+ break;
+ case 1:
+ BF_GLOBALS._sound1.play(57);
+ setDelay(120);
+ break;
+ case 2:
+ scene->_sound1.play(59);
+ setAction(&scene->_sequenceManager, this, 600, &scene->_object2, &scene->_object1,
+ &BF_GLOBALS._player, &scene->_object3, NULL);
+ break;
+ case 3:
+ BF_GLOBALS._sound1.play(61);
+ setDelay(180);
+ break;
+ case 4:
+ setDelay(180);
+ break;
+ case 5: {
+ BF_GLOBALS._player.remove();
+ scene->_object1.remove();
+ scene->_object2.remove();
+ scene->_object3.remove();
+
+ for (int percent = 100; percent >= 0; percent -= 5) {
+ BF_GLOBALS._scenePalette.fade((byte *)&black, false, percent);
+ g_system->delayMillis(10);
+ }
+
+ SynchronizedList<SceneObject *>::iterator i;
+ for (i = BF_GLOBALS._sceneObjects->begin(); i != BF_GLOBALS._sceneObjects->end(); ++i) {
+ SceneObject *pObj = *i;
+ pObj->addMover(NULL);
+ pObj->setObjectWrapper(NULL);
+ pObj->animate(ANIM_MODE_NONE, NULL);
+ }
+
+ BF_GLOBALS._screenSurface.fillRect(BF_GLOBALS._screenSurface.getBounds(), 0);
+ BF_GLOBALS._v51C44 = 1;
+ scene->loadScene(999);
+ setDelay(5);
+ break;
+ }
+ case 6:
+ setDelay(5);
+ break;
+ case 7:
+ BF_GLOBALS._v51C44 = 0;
+ remove();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene600::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(600);
+ setZoomPercents(0, 100, 200, 100);
+ _sceneBounds.moveTo(320, 0);
+
+ _sound1.play(58);
+ _sound1.holdAt(1);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.hide();
+ BF_GLOBALS._player.setPosition(Common::Point(639, 0));
+ BF_GLOBALS._player.disableControl();
+
+ _object3.postInit();
+ _object3.hide();
+ _object2.postInit();
+
+ _object1.postInit();
+ _object1.setVisage(600);
+ _object1.setStrip(7);
+ _object1.setPosition(Common::Point(417, 82));
+
+ BF_GLOBALS.clearFlag(onDuty);
+ BF_INVENTORY.setObjectScene(INV_TICKET_BOOK, 60);
+ BF_INVENTORY.setObjectScene(INV_MIRANDA_CARD, 60);
+ _sceneMode = 600;
+
+ setAction(&_action1, this);
+}
+
+void Scene600::signal() {
+ BF_GLOBALS._sceneManager.changeScene(620);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 620 - Hospital cut-scene
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene620::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(999);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.setVisage(621);
+ BF_GLOBALS._player.setPosition(Common::Point(47, 96));
+
+ static const uint32 black = 0;
+ add2Faders((const byte *)&black, 2, 621, this);
+}
+
+void Scene620::signal() {
+ static const uint32 black = 0;
+
+ switch (_sceneMode++) {
+ case 0:
+ case 3:
+ case 9:
+ case 12:
+ _timer1.set(60, this);
+ break;
+ case 1:
+ case 4:
+ case 7:
+ case 10:
+ case 13:
+ case 16:
+ case 19:
+ addFader((const byte *)&black, 2, this);
+ break;
+ case 2:
+ BF_GLOBALS._player.remove();
+ _object1.postInit();
+ _object1.setVisage(622);
+ _object1.setPosition(Common::Point(101, 41));
+ addFader((const byte *)&black, 2, this);
+ break;
+ case 5:
+ _object1.remove();
+
+ _object2.postInit();
+ _object2.setVisage(623);
+ _object2.setPosition(Common::Point(216, 4));
+ add2Faders((const byte *)&black, 2, 623, this);
+ break;
+ case 6:
+ _object2.animate(ANIM_MODE_5, this);
+ break;
+ case 8:
+ _object2.remove();
+
+ _object3.postInit();
+ _object3.setVisage(624);
+ _object3.setFrame(1);
+ _object3.setPosition(Common::Point(28, 88));
+ add2Faders((const byte *)&black, 2, 624, this);
+ break;
+ case 11:
+ _object3.remove();
+
+ _object4.postInit();
+ _object4.setVisage(625);
+ _object4.setPosition(Common::Point(168, 8));
+ add2Faders((const byte *)&black, 2, 625, this);
+ break;
+ case 14:
+ _object4.remove();
+
+ _object5.postInit();
+ _object5.setVisage(626);
+ _object5.setPosition(Common::Point(249, 183));
+ add2Faders((const byte *)&black, 2, 626, this);
+ break;
+ case 15:
+ _object5.animate(ANIM_MODE_5, this);
+ break;
+ case 17:
+ _object5.remove();
+
+ _object6.postInit();
+ _object6.setVisage(627);
+ _object6.setPosition(Common::Point(65, 24));
+ add2Faders((const byte *)&black, 2, 627, this);
+ break;
+ case 18:
+ _object6.animate(ANIM_MODE_5, this);
+ break;
+ case 20:
+ _object6.remove();
+ BF_GLOBALS._bookmark = bArrestedDrunk;
+ BF_GLOBALS._v4CEB6 = 0;
+ BF_GLOBALS._dayNumber = 3;
+ BF_GLOBALS._sceneManager.changeScene(271);
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 666 - Death Scene
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene666::Action1::signal() {
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.hide();
+ setDelay(6);
+ break;
+ case 1:
+ BF_GLOBALS._game->restartGame();
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene666::Item1::startAction(CursorType action, Event &event) {
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene666::postInit(SceneObjectList *OwnerList) {
+ BF_GLOBALS._sound1.play(27);
+ SceneExt::postInit();
+ BF_GLOBALS._interfaceY = 200;
+ loadScene(999);
+ BF_GLOBALS._screenSurface.fillRect(BF_GLOBALS._screenSurface.getBounds(), 0);
+
+ if (BF_GLOBALS._dayNumber == 0) {
+ BF_GLOBALS._dayNumber = 1;
+ BF_GLOBALS._deathReason = BF_GLOBALS._randomSource.getRandomNumber(23);
+ }
+
+ BF_GLOBALS._scenePalette.loadPalette(BF_GLOBALS._sceneManager._previousScene);
+ BF_GLOBALS._uiElements._active = false;
+
+ _item1.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 666, -1, -1, -1, 1, NULL);
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._events.setCursor(CURSOR_WALK);
+
+ if (BF_GLOBALS._sceneManager._previousScene == 271) {
+ setAction(&_action1);
+ } else {
+ switch (BF_GLOBALS._deathReason) {
+ case 4:
+ case 18:
+ case 19:
+ case 20:
+ BF_GLOBALS._scenePalette.loadPalette(668);
+ BF_GLOBALS._player.setVisage(668);
+ BF_GLOBALS._player.setStrip2(1);
+ BF_GLOBALS._player.setPosition(Common::Point(77, 155));
+ BF_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 5:
+ BF_GLOBALS._scenePalette.loadPalette(900);
+ BF_GLOBALS._scenePalette.refresh();
+ BF_GLOBALS._player.setVisage(666);
+ BF_GLOBALS._player.setPosition(Common::Point(60, 160));
+ signal();
+ break;
+ case 7:
+ case 11:
+ case 12:
+ case 22:
+ BF_GLOBALS._scenePalette.loadPalette(667);
+ BF_GLOBALS._scenePalette.refresh();
+
+ _object1.postInit();
+ _object2.postInit();
+ _object3.postInit();
+ setAction(&_sequenceManager, this, 6660, &BF_GLOBALS._player, &_object1, &_object2,
+ &_object3, NULL);
+ break;
+ case 13:
+ case 14:
+ BF_GLOBALS._scenePalette.loadPalette(665);
+ BF_GLOBALS._scenePalette.refresh();
+ BF_GLOBALS._player.setVisage(665);
+ BF_GLOBALS._player.setPosition(Common::Point(80, 140));
+ signal();
+ break;
+ case 24:
+ BF_GLOBALS._player.setVisage(664);
+ BF_GLOBALS._player.setPosition(Common::Point(70, 160));
+ signal();
+ break;
+ default:
+ BF_GLOBALS._scenePalette.loadPalette(669);
+ BF_GLOBALS._scenePalette.refresh();
+ BF_GLOBALS._player.setVisage(669);
+ BF_GLOBALS._player.setStrip(1);
+ BF_GLOBALS._player.setPosition(Common::Point(27, 27));
+ BF_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ }
+ }
+}
+
+void Scene666::remove() {
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._scrollFollower = &BF_GLOBALS._player;
+ SceneExt::remove();
+ BF_GLOBALS._uiElements._active = true;
+}
+
+void Scene666::signal() {
+ BF_GLOBALS._player.enableControl();
+ Rect textRect, sceneBounds;
+
+ _text._color1 = 19;
+ _text._color2 = 9;
+ _text._color3 = 13;
+ _text._fontNumber = 4;
+ _text._width = 150;
+
+ Common::String msg = g_resourceManager->getMessage(666, BF_GLOBALS._deathReason);
+ sceneBounds = BF_GLOBALS._sceneManager._scene->_sceneBounds;
+ sceneBounds.collapse(4, 2);
+ BF_GLOBALS.gfxManager()._font.getStringBounds(msg.c_str(), textRect, _text._width);
+ textRect.moveTo(160, 10);
+ textRect.contain(sceneBounds);
+
+ _text.setup(msg);
+ _text.setPosition(Common::Point(textRect.left, textRect.top));
+ _text.setPriority(255);
+ _text.show();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 690 - Decking
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene690::Object1::startAction(CursorType action, Event &event) {
+ Scene690 *scene = (Scene690 *)BF_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_USE) && (scene->_object2._strip == 1)) {
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._walkRegions.proc2(1);
+ BF_GLOBALS._walkRegions.proc2(6);
+ scene->_sceneMode = 6901;
+ scene->setAction(&scene->_sequenceManager, scene, 6901, &BF_GLOBALS._player,
+ &scene->_object2, &scene->_object1, &scene->_object4, &scene->_object5, NULL);
+ return true;
+ } else {
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene690::Object2::startAction(CursorType action, Event &event) {
+ Scene690 *scene = (Scene690 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (scene->_object2._strip == 3) {
+ scene->_object6.postInit();
+ scene->_object6.hide();
+ scene->_object6.fixPriority(1);
+ scene->_object6.setDetails(690, 21, 17, 23, 1, NULL);
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 6902;
+ scene->setAction(&scene->_sequenceManager, scene, 6902, &BF_GLOBALS._player,
+ &scene->_object2, &scene->_object6, NULL);
+ return true;
+ }
+ break;
+ case CURSOR_TALK:
+ scene->_stripManager.start(6900, &BF_GLOBALS._stripProxy);
+ return true;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene690::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(690);
+ setZoomPercents(125, 80, 140, 100);
+ BF_GLOBALS._sound1.fadeSound(48);
+
+ if (BF_GLOBALS._dayNumber == 0)
+ BF_GLOBALS._dayNumber = 1;
+
+ _stripManager.addSpeaker(&_jakeSpeaker);
+
+ _object1.postInit();
+ _object1.setVisage(690);
+ _object1.setStrip2(2);
+ _object1.fixPriority(188);
+ _object1.setPosition(Common::Point(50, 166));
+ _object1.setDetails(690, 4, 17, 26, 1, NULL);
+
+ _object3.postInit();
+ _object3.setVisage(690);
+ _object3.fixPriority(100);
+ _object3.setPosition(Common::Point(238, 125));
+ _object3.setDetails(690, 7, 17, 28, 1, NULL);
+
+ _object2.postInit();
+ _object2.setVisage(694);
+ _object2.setStrip2(3);
+ _object2.fixPriority(125);
+ _object2.setPosition(Common::Point(100, 134));
+ _object2.setDetails(690, 12, -1, 11, 1, NULL);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player._moveDiff.x = 8;
+
+ _object4.postInit();
+ _object4.setDetails(690, 13, -1, -1, 1, NULL);
+
+ _object5.postInit();
+ _object5.setDetails(690, 14, -1, -1, 1, NULL);
+
+ _sceneMode = 6903;
+ setAction(&_sequenceManager, this, 6903, &BF_GLOBALS._player, &_object3, &_object4, &_object5, NULL);
+
+ _item1.setDetails(Rect(45, 28, 74, 48), 690, 0, 15, 20, 1, NULL);
+ _item2.setDetails(Rect(0, 0, 129, 78), 690, 1, 15, 20, 1, NULL);
+ _item9.setDetails(Rect(4, 26, 35, 143), 690, 29, 17, 22, 1, NULL);
+ _item10.setDetails(Rect(87, 29, 109, 112), 690, 29, 17, 22, 1, NULL);
+ _item11.setDetails(Rect(135, 30, 160, 120), 690, 29, 17, 22, 1, NULL);
+ _item3.setDetails(Rect(37, 89, 84, 117), 690, 2, 16, 21, 1, NULL);
+ _item4.setDetails(Rect(123, 98, 201, 131), 690, 5, -1, -1, 1, NULL);
+ _item7.setDetails(Rect(285, 95, 303, 133), 690, 8, -1, 25, 1, NULL);
+ _item16.setDetails(Rect(166, 35, 210, 116), 690, 32, -1, -1, 1, NULL);
+ _item6.setDetails(Rect(255, 44, 289, 130), 690, 7, 17, 24, 1, NULL);
+ _item8.setDetails(Rect(299, 44, 314, 53), 690, 27, 15, -1, 1, NULL);
+ _item5.setDetails(Rect(130, 20, 319, 135), 690, 6, 16, 28, 1, NULL);
+ _item12.setDetails(1, 690, 10, -1, -1, 1);
+ _item13.setDetails(2, 690, 30, -1, -1, 1);
+ _item14.setDetails(3, 690, 31, -1, -1, 1);
+ _item15.setDetails(4, 690, 9, -1, -1, 1);
+ _item17.setDetails(Rect(143, 0, 182, 14), 690, 33, -1, -1, 1, NULL);
+}
+
+void Scene690::signal() {
+ switch (_sceneMode) {
+ case 6901:
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(710);
+ break;
+ case 6902:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 6903:
+ BF_GLOBALS._walkRegions.proc1(1);
+ BF_GLOBALS._walkRegions.proc1(6);
+ BF_GLOBALS._player.enableControl();
+ break;
+ default:
+ break;
+ }
+}
+
+
+} // End of namespace BlueForce
+
+} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_scenes6.h b/engines/tsage/blue_force/blueforce_scenes6.h
new file mode 100644
index 0000000000..7c35b75053
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_scenes6.h
@@ -0,0 +1,124 @@
+/* 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.
+ *
+ */
+
+#ifndef TSAGE_BLUEFORCE_SCENES6_H
+#define TSAGE_BLUEFORCE_SCENES6_H
+
+#include "common/scummsys.h"
+#include "tsage/blue_force/blueforce_logic.h"
+#include "tsage/blue_force/blueforce_speakers.h"
+#include "tsage/converse.h"
+#include "tsage/events.h"
+#include "tsage/core.h"
+#include "tsage/scenes.h"
+#include "tsage/globals.h"
+#include "tsage/sound.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+using namespace TsAGE;
+
+class Scene600 : public SceneExt {
+ /* Actions */
+ class Action1 : public Action {
+ public:
+ virtual void signal();
+ };
+public:
+ SequenceManager _sequenceManager;
+ Action1 _action1;
+ ASoundExt _sound1;
+ NamedObject _object1, _object2, _object3;
+ BackgroundSceneObject _object4, _object5;
+ BackgroundSceneObject _object6, _object7, _object8;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
+class Scene620 : public PalettedScene {
+public:
+ SequenceManager _sequenceManager;
+ Timer _timer1;
+ NamedObject _object1, _object2, _object3;
+ NamedObject _object4, _object5, _object6;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+
+class Scene666 : public SceneExt {
+ /* Actions */
+ class Action1 : public Action {
+ public:
+ virtual void signal();
+ };
+
+ /* Items */
+ class Item1: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ Action1 _action1;
+ SequenceManager _sequenceManager;
+ NamedObject _object1, _object2, _object3;
+ Item1 _item1;
+ SceneText _text;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+};
+
+
+class Scene690 : public SceneExt {
+ /* Objects */
+ class Object1: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object2: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+public:
+ SequenceManager _sequenceManager;
+ Object1 _object1;
+ Object2 _object2;
+ NamedObject _object3, _object4, _object5, _object6;
+ NamedHotspot _item1, _item2, _item3, _item4, _item5;
+ NamedHotspot _item6, _item7, _item8, _item9, _item10;
+ NamedHotspot _item11, _item12, _item13, _item14, _item15;
+ NamedHotspot _item16, _item17;
+ SpeakerJake _jakeSpeaker;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+};
+} // End of namespace BlueForce
+
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/blue_force/blueforce_scenes7.cpp b/engines/tsage/blue_force/blueforce_scenes7.cpp
new file mode 100644
index 0000000000..1d94211871
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_scenes7.cpp
@@ -0,0 +1,277 @@
+/* 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 "tsage/blue_force/blueforce_scenes7.h"
+#include "tsage/globals.h"
+#include "tsage/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/staticres.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+/*--------------------------------------------------------------------------
+ * Scene 710 -
+ *
+ *--------------------------------------------------------------------------*/
+void Scene710::Timer1::signal() {
+ PaletteRotation *rotation = BF_GLOBALS._scenePalette.addRotation(136, 138, -1);
+ rotation->setDelay(25);
+ rotation = BF_GLOBALS._scenePalette.addRotation(146, 148, -1);
+ rotation->setDelay(30);
+ rotation = BF_GLOBALS._scenePalette.addRotation(187, 191, -1);
+ rotation->setDelay(35);
+ rotation = BF_GLOBALS._scenePalette.addRotation(245, 246, -1);
+ rotation->setDelay(20);
+ remove();
+}
+
+void Scene710::Action1::signal() {
+ Scene710 *scene = (Scene710 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ _state = 7104;
+ if (BF_INVENTORY.getObjectScene(INV_CRATE1) == 1)
+ _state = 7105;
+ setDelay(3);
+ break;
+ case 1: {
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &scene->_laura._position, scene);
+ break;
+ }
+ case 2:
+ BF_GLOBALS._player._strip = 2;
+ scene->_stripManager.start(_state, this);
+ break;
+ case 3:
+ if (_state == 7105)
+ BF_GLOBALS._player.enableControl();
+ else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 7106;
+ scene->setAction(&scene->_sequenceManager1, scene, 7106, &BF_GLOBALS._player, &scene->_laura, &scene->_kid, &scene->_dog, NULL);
+ }
+ if (_state < 7104) {
+ _state++;
+ if ((_state != 7104) && (BF_INVENTORY.getObjectScene(INV_CRATE1) == 1))
+ _state = 7105;
+ }
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+// Laura
+bool Scene710::Object3::startAction(CursorType action, Event &event) {
+ Scene710 *scene = (Scene710 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_TALK) {
+ BF_GLOBALS._player.setAction(&scene->_action1);
+ return true;
+ } else
+ return NamedObject::startAction(action, event);
+}
+
+bool Scene710::Object4::startAction(CursorType action, Event &event) {
+ Scene710 *scene = (Scene710 *)BF_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_LOOK) && (scene->_kid._position.x < 0)) {
+ SceneItem::display(710, 13);
+ return true;
+ } else
+ return NamedObject::startAction(action, event);
+}
+
+//Stick
+bool Scene710::Object5::startAction(CursorType action, Event &event) {
+ Scene710 *scene = (Scene710 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ if (scene->_v1D64 <= 2)
+ return NamedObject::startAction(action, event);
+ else {
+ SceneItem::display(710, 3);
+ scene->_v1D66 = 1;
+ return true;
+ }
+ case CURSOR_USE:
+ if ((scene->_kid._position.x < 0) && (scene->_v1D62 == 1)) {
+ scene->_v1D64++;
+ if (scene->_v1D66 == 0) {
+ BF_GLOBALS._player.disableControl();
+ scene->_v1D62 = 0;
+ scene->_sceneMode = 7105;
+ scene->setAction(&scene->_sequenceManager1, scene, 7105, &BF_GLOBALS._player, &scene->_stick, &scene->_dog, NULL);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 7101;
+ scene->setAction(&scene->_sequenceManager1, scene, 7101, &BF_GLOBALS._player, &scene->_dog, &scene->_stick, NULL);
+ }
+ return true;
+ }
+ // No break on purpose
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+void Scene710::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(710);
+
+ _sceneBounds.moveTo(320, 0);
+ BF_GLOBALS._sound1.fadeSound(14);
+ _soundExt1.fadeSound(48);
+ _v51C34.set(40, 0, 280, 240);
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.hide();
+ BF_GLOBALS._player._moveDiff = Common::Point(4, 2);
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS._dayNumber == 0)
+ BF_GLOBALS._dayNumber = 1;
+ _stripManager.addSpeaker(&_jakeSpeaker);
+ _stripManager.addSpeaker(&_skipSpeaker);
+ _stripManager.addSpeaker(&_lauraSpeaker);
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+
+ _kid.postInit();
+ _kid._moveDiff = Common::Point(4, 2);
+ _laura.postInit();
+ _laura._moveDiff = Common::Point(4, 2);
+ _dog.postInit();
+ _dog._moveDiff = Common::Point(4, 2);
+ _stick.postInit();
+ _stick.setVisage(710);
+ _stick.setStrip(2);
+ _stick.animate(ANIM_MODE_2, NULL);
+ _stick.setPosition(Common::Point(650, 160));
+ _stick._moveDiff.x = 16;
+ _stick.setDetails(710, 4, -1, -1, 1, NULL);
+ _laura.setDetails(710, 2, -1, -1, 1, NULL);
+ _kid.setDetails(710, 6, -1, -1, 1, NULL);
+ _dog.setDetails(710, 0, -1, -1, 1, NULL);
+
+ _item1.setDetails(Rect(555, 68, 583, 101), 710, 7, 23, -1, 1, NULL);
+ _item2.setDetails(Rect(583, 46, 611, 78), 710, 7, 23, -1, 1, NULL);
+ _item3.setDetails(Rect(611, 24, 639, 56), 710, 7, 23, -1, 1, NULL);
+ _item6.setDetails(1, 710, 9, 1, -1, 1);
+ _item4.setDetails(2, 710, 8, 14, -1, 1);
+ _item5.setDetails(3, 710, 10, 16, -1, 1);
+ _item8.setDetails(Rect(222, 18, 249, 42), 710, 12, 18, -1, 1, NULL);
+ _item7.setDetails(Rect(0, 0, 640, 52), 710, 11, 17, -1, 1, NULL);
+ _item9.setDetails(Rect(0, 0, 640, 128), 710, 5, 15, -1, 1, NULL);
+
+ _v1D62 = _v1D64 = _v1D66 = _v1D68 = 0;
+ _action1._state = 7100;
+ _timer1.set(2, NULL);
+ _sceneMode = 7100;
+ setAction(&_sequenceManager1, this, 7100, &BF_GLOBALS._player, &_laura, &_kid, &_dog, NULL);
+}
+
+void Scene710::signal() {
+ switch (_sceneMode++) {
+ case 0:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 7100:
+ BF_GLOBALS._player.enableControl();
+ _sceneMode = 7102;
+ setAction(&_sequenceManager1, this, 7102, &_dog, NULL);
+ break;
+ case 7101:
+ BF_GLOBALS._player.enableControl();
+ BF_INVENTORY.setObjectScene(288, 36);
+ _stick.remove();
+ BF_GLOBALS._walkRegions.proc2(2);
+ break;
+ case 7102:
+ _stick.setPosition(Common::Point(100, 122));
+ _stick.animate(ANIM_MODE_NONE, NULL);
+ _stick._strip = 2;
+ if (_v1D64 <= 2)
+ _stick._frame = 2;
+ else {
+ if (_v1D64 == 3) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ _stripManager.start(7108, this);
+ }
+ _stick._frame = 1;
+ }
+ _v1D62 = 1;
+ BF_GLOBALS._walkRegions.proc1(2);
+ if ((_v1D68 != 0) && (_sceneMode != 0))
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 7103:
+ if (BF_GLOBALS._player._position.x > 179) {
+ _sceneMode = 7102;
+ setAction(&_sequenceManager1, this, 7102, &_dog, NULL);
+ } else {
+ _sceneMode = 7104;
+ setAction(&_sequenceManager3, this, 7104, &_kid, NULL);
+ }
+ break;
+ case 7105:
+ _v1D68 = 1;
+ // No break on purpose
+ case 7104:
+ _sceneMode = 7102;
+ setAction(&_sequenceManager1, this, 7102, &_dog, NULL);
+ BF_GLOBALS._walkRegions.proc2(2);
+ break;
+ case 7106:
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._sceneManager.changeScene(270);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene710::dispatch() {
+ if ((_kid._position.x > 0) && (_v1D62 == 1) && (_sceneMode != 7106)) {
+ _v1D62 = 0;
+ _sceneMode = 7103;
+ setAction(&_sequenceManager1, this, 7103, &_kid, &_stick, &_dog, NULL);
+ }
+ SceneExt::dispatch();
+}
+
+void Scene710::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_v1D62);
+ s.syncAsSint16LE(_v1D64);
+ s.syncAsSint16LE(_v1D66);
+ s.syncAsSint16LE(_v1D68);
+}
+
+
+} // End of namespace BlueForce
+} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_scenes7.h b/engines/tsage/blue_force/blueforce_scenes7.h
new file mode 100644
index 0000000000..9bb43453ef
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_scenes7.h
@@ -0,0 +1,103 @@
+/* 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.
+ *
+ */
+
+#ifndef TSAGE_BLUEFORCE_SCENES7_H
+#define TSAGE_BLUEFORCE_SCENES7_H
+
+#include "common/scummsys.h"
+#include "tsage/blue_force/blueforce_logic.h"
+#include "tsage/blue_force/blueforce_speakers.h"
+#include "tsage/converse.h"
+#include "tsage/events.h"
+#include "tsage/core.h"
+#include "tsage/scenes.h"
+#include "tsage/globals.h"
+#include "tsage/sound.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+using namespace TsAGE;
+
+class Scene710: public SceneExt {
+ // Actions
+ class Action1: public ActionExt {
+ public:
+ void signal();
+ };
+ // Timers
+ class Timer1: public Timer {
+ public:
+ void signal();
+ };
+ // Objects
+ class Object3: public NamedObject {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Object4: public NamedObject {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Object5: public NamedObject {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+
+public:
+ SequenceManager _sequenceManager1;
+ SequenceManager _sequenceManager2;
+ SequenceManager _sequenceManager3;
+ Timer1 _timer1;
+ SpeakerJake _jakeSpeaker;
+ SpeakerLaura _lauraSpeaker;
+ SpeakerSkip _skipSpeaker;
+ SpeakerGameText _gameTextSpeaker;
+ Action1 _action1;
+ NamedObject _object1;
+ NamedObject _kid;
+ Object3 _laura;
+ Object4 _dog;
+ Object5 _stick;
+ ASoundExt _soundExt1;
+ NamedHotspot _item1;
+ NamedHotspot _item2;
+ NamedHotspot _item3;
+ NamedHotspot _item4;
+ NamedHotspot _item5;
+ NamedHotspot _item6;
+ NamedHotspot _item7;
+ NamedHotspot _item8;
+ NamedHotspot _item9;
+ int _v1D62, _v1D64, _v1D66, _v1D68;
+
+ void postInit(SceneObjectList *OwnerList = NULL);
+ void signal();
+ void dispatch();
+ void synchronize(Serializer &s);
+};
+
+} // End of namespace BlueForce
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/blue_force/blueforce_scenes8.cpp b/engines/tsage/blue_force/blueforce_scenes8.cpp
new file mode 100644
index 0000000000..49de0be65c
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_scenes8.cpp
@@ -0,0 +1,1397 @@
+/* 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 "tsage/blue_force/blueforce_scenes8.h"
+#include "tsage/blue_force/blueforce_dialogs.h"
+#include "tsage/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/staticres.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+/*--------------------------------------------------------------------------
+ * Scene 800 - Jamison & Ryan
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene800::Item1::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_LOOK) {
+ SceneItem::display2(800, 11);
+ return true;
+ } else {
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene800::Item2::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_LOOK) {
+ SceneItem::display2(800, 1);
+ return true;
+ } else {
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene800::Doorway::startAction(CursorType action, Event &event) {
+ Scene800 *scene = (Scene800 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(800, 4);
+ return true;
+ case CURSOR_USE:
+ if (BF_GLOBALS._dayNumber == 5)
+ SceneItem::display2(800, 14);
+ else if (BF_GLOBALS._dayNumber < 2)
+ SceneItem::display2(800, BF_GLOBALS.getFlag(onDuty) ? 6 : 15);
+ else if (((BF_INVENTORY.getObjectScene(INV_SCHEDULE) == 1) && (BF_GLOBALS._dayNumber == 3)) ||
+ (BF_GLOBALS._bookmark == bDoneWithIsland))
+ SceneItem::display(800, 5);
+ else {
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ ADD_PLAYER_MOVER_NULL(scene->_lyle, 277, 145);
+ }
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8000;
+ setAction(&scene->_sequenceManager, scene, 8000, &BF_GLOBALS._player, this, NULL);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene800::Car1::startAction(CursorType action, Event &event) {
+ Scene800 *scene = (Scene800 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(800, 2);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(800, 3);
+ return true;
+ case INV_TICKET_BOOK:
+ if (BF_GLOBALS.getFlag(ticketVW))
+ SceneItem::display2(800, 12);
+ else if (!BF_GLOBALS.getFlag(onDuty))
+ SceneItem::display2(800, 13);
+ else {
+ BF_GLOBALS.setFlag(ticketVW);
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._uiElements.addScore(30);
+ scene->_sceneMode = 8005;
+ scene->setAction(&scene->_action1);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene800::Motorcycle::startAction(CursorType action, Event &event) {
+ Scene800 *scene = (Scene800 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(800, 0);
+ return true;
+ case CURSOR_USE:
+ if (BF_GLOBALS.getFlag(fWithLyle))
+ SceneItem::display2(800, 8);
+ else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8002;
+ setAction(&scene->_sequenceManager, scene, 8002, &BF_GLOBALS._player, this, NULL);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene800::Lyle::startAction(CursorType action, Event &event) {
+ Scene800 *scene = (Scene800 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(800, 7);
+ return true;
+ case CURSOR_TALK:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8001;
+ scene->_stripManager.start(8003, scene);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene800::Car2::startAction(CursorType action, Event &event) {
+ Scene800 *scene = (Scene800 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(800, 9);
+ return true;
+ case CURSOR_USE:
+ if (!BF_GLOBALS.getFlag(fWithLyle))
+ SceneItem::display2(800, 10);
+ else {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8003;
+ setAction(&scene->_sequenceManager, scene, 8003, &BF_GLOBALS._player, &scene->_lyle, NULL);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene800::Action1::signal() {
+ Scene800 *scene = (Scene800 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0: {
+ BF_GLOBALS._player.disableControl();
+ ADD_PLAYER_MOVER_THIS(BF_GLOBALS._player, 95, 153);
+ break;
+ }
+ case 1: {
+ ADD_MOVER(BF_GLOBALS._player, 70, 157);
+ break;
+ }
+ case 2:
+ BF_GLOBALS._player.setVisage(800);
+ BF_GLOBALS._player.setStrip(1);
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player.fixPriority(200);
+ BF_GLOBALS._player.animate(ANIM_MODE_4, 16, 1, this);
+ break;
+ case 3:
+ scene->_object6.postInit();
+ scene->_object6.setVisage(800);
+ scene->_object6.setStrip(2);
+ scene->_object6.setFrame(2);
+ scene->_object6.setPosition(Common::Point(58, 135));
+ scene->_object6.fixPriority(170);
+ BF_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 4:
+ BF_GLOBALS._player.setVisage(352);
+ BF_GLOBALS._player.setStrip(2);
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player.fixPriority(-1);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ ADD_MOVER(BF_GLOBALS._player, 89, 154);
+ break;
+ case 5:
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ }
+
+}
+
+/*--------------------------------------------------------------------------*/
+
+void Scene800::postInit(SceneObjectList *OwnerList) {
+ loadScene(800);
+ SceneExt::postInit();
+ setZoomPercents(130, 50, 155, 100);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ _stripManager.addSpeaker(&_lyleHatSpeaker);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(1358);
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.setPosition(Common::Point(319, 144));
+ BF_GLOBALS._player._moveDiff = Common::Point(3, 2);
+ BF_GLOBALS._player.changeZoom(-1);
+
+ _motorcycle.postInit();
+ _motorcycle.setVisage(301);
+ _motorcycle.setPosition(Common::Point(319, 162));
+
+ if ((BF_GLOBALS._dayNumber >= 2) && (BF_GLOBALS._dayNumber < 5)) {
+ _car2.postInit();
+ _car2.setVisage(444);
+ _car2.setStrip(3);
+ _car2.setFrame(2);
+ _car2.setPosition(Common::Point(237, 161));
+ _car2.changeZoom(110);
+ _car2.fixPriority(158);
+ BF_GLOBALS._sceneItems.push_back(&_car2);
+
+ BF_GLOBALS._walkRegions.proc1(8);
+ }
+
+ if ((BF_GLOBALS._dayNumber == 4) && (BF_GLOBALS._bookmark < bEndDayThree)) {
+ _car2.remove();
+ BF_GLOBALS._walkRegions.proc2(8);
+ }
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _lyle.postInit();
+ _lyle.setVisage(1359);
+ _lyle.setObjectWrapper(new SceneObjectWrapper());
+ _lyle.animate(ANIM_MODE_1, NULL);
+ _lyle.setPosition(Common::Point(210, 160));
+ _lyle.changeZoom(-1);
+ BF_GLOBALS._sceneItems.push_back(&_lyle);
+
+ _motorcycle.setVisage(580);
+ _motorcycle.setStrip(2);
+ _motorcycle.setFrame(2);
+ } else if (BF_GLOBALS.getFlag(onDuty)) {
+ BF_GLOBALS._player.setVisage(352);
+ } else {
+ _motorcycle.setVisage(580);
+ _motorcycle.setStrip(2);
+ _motorcycle.setFrame(2);
+ }
+ BF_GLOBALS._sceneItems.push_back(&_motorcycle);
+
+ _doorway.postInit();
+ _doorway.setVisage(800);
+ _doorway.setStrip(3);
+ _doorway.setPosition(Common::Point(287, 140));
+ BF_GLOBALS._sceneItems.push_back(&_doorway);
+
+ _car1.postInit();
+ _car1.setVisage(800);
+ _car1.setStrip(2);
+ _car1.setFrame(1);
+ _car1.setPosition(Common::Point(58, 163));
+ BF_GLOBALS._sceneItems.push_back(&_car1);
+
+ if (BF_GLOBALS._sceneManager._previousScene == 810) {
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ BF_GLOBALS._player.setPosition(Common::Point(271, 148));
+ BF_GLOBALS._player.enableControl();
+ } else {
+ BF_GLOBALS._player.changeZoom(75);
+ BF_GLOBALS._player.setPosition(Common::Point(275, 135));
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 8001;
+ setAction(&_sequenceManager, this, 8001, &BF_GLOBALS._player, &_doorway, NULL);
+ }
+ } else if ((BF_INVENTORY.getObjectScene(INV_SCHEDULE) == 1) && (BF_GLOBALS._bookmark == bFlashBackThree)) {
+ BF_GLOBALS._bookmark = bFlashBackThree;
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.setPosition(Common::Point(231, 150));
+ BF_GLOBALS._player.setStrip(3);
+
+ _lyle.setPosition(Common::Point(244, 162));
+ _lyle.setStrip(4);
+ _sceneMode = 8004;
+ setAction(&_sequenceManager, this, 8001, &_lyle, &_doorway, NULL);
+ } else {
+ BF_GLOBALS._player.updateAngle(_motorcycle._position);
+ BF_GLOBALS._player.enableControl();
+ }
+
+ _item2.setBounds(Rect(47, 26, 319, 143));
+ BF_GLOBALS._sceneItems.push_back(&_item2);
+ _item1.setBounds(Rect(0, 0, 320, 165));
+ BF_GLOBALS._sceneItems.push_back(&_item1);
+
+ BF_GLOBALS._sound1.fadeSound(33);
+}
+
+void Scene800::signal() {
+ switch (_sceneMode) {
+ case 8000:
+ BF_GLOBALS._sceneManager.changeScene(810);
+ break;
+ case 8001:
+ case 8005:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 8002:
+ case 8003:
+ BF_GLOBALS._sceneManager.changeScene(60);
+ break;
+ case 8004:
+ BF_GLOBALS.clearFlag(fWithLyle);
+ _lyle.remove();
+ }
+}
+
+void Scene800::dispatch() {
+ SceneExt::dispatch();
+ if (BF_GLOBALS._player.getRegionIndex() == 7) {
+ BF_GLOBALS._player.updateZoom();
+ } else {
+ BF_GLOBALS._player.changeZoom(-1);
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 830 - Outside Boat Rentals
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene830::Lyle::startAction(CursorType action, Event &event) {
+ Scene830 *scene = (Scene830 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ if (scene->_field18AA) {
+ scene->_stripManager.start(8304, &BF_GLOBALS._stripProxy);
+ } else {
+ scene->_stripManager.start(8303, &BF_GLOBALS._stripProxy);
+ ++scene->_field18AA;
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene830::Door::startAction(CursorType action, Event &event) {
+ Scene830 *scene = (Scene830 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ if (BF_GLOBALS._dayNumber == 2) {
+ scene->_sceneMode = 14;
+ Common::Point pt(186, 102);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, NULL);
+ return true;
+ }
+ break;
+ case CURSOR_USE:
+ if (BF_GLOBALS._dayNumber == 2) {
+ scene->_sceneMode = 14;
+ Common::Point pt(186, 102);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, NULL);
+ } else if (scene->_field18A4) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 832;
+
+ if (BF_GLOBALS.getFlag(onDuty)) {
+ scene->setAction(&scene->_sequenceManager, scene, 8302, &BF_GLOBALS._player, &scene->_door, NULL);
+ } else if (BF_GLOBALS.getFlag(fWithLyle)) {
+ scene->_sceneMode = 11;
+ scene->setAction(&scene->_sequenceManager, scene, 8308, &BF_GLOBALS._player, &scene->_door, &scene->_lyle, NULL);
+ } else {
+ scene->setAction(&scene->_sequenceManager, scene, 832, &BF_GLOBALS._player, &scene->_door, NULL);
+ }
+ } else {
+ scene->_stripManager.start(8305, &BF_GLOBALS._stripProxy);
+ ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 192, 145);
+ }
+ return true;
+ default:
+ break;
+ }
+
+ return NamedObject::startAction(action, event);
+}
+
+bool Scene830::Object4::startAction(CursorType action, Event &event) {
+ Scene830 *scene = (Scene830 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == INV_RENTAL_KEYS) {
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ scene->_sceneMode = 8300;
+ scene->setAction(&scene->_sequenceManager, scene, 8300, &BF_GLOBALS._player, &scene->_lyle, NULL);
+ } else {
+ scene->_sceneMode = 834;
+ scene->setAction(&scene->_sequenceManager, scene, 8300, &BF_GLOBALS._player, &scene->_object4, NULL);
+ }
+ return true;
+ } else {
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene830::Object5::startAction(CursorType action, Event &event) {
+ Scene830 *scene = (Scene830 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8307;
+ scene->setAction(&scene->_sequenceManager, scene, 8307, &BF_GLOBALS._player, &scene->_object5, NULL);
+ return true;
+ } else {
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene830::SouthEastExit::startAction(CursorType action, Event &event) {
+ ADD_PLAYER_MOVER(BF_GLOBALS._player._position.x + 80, BF_GLOBALS._player._position.y + 100);
+ return true;
+}
+
+bool Scene830::NoteBoard::startAction(CursorType action, Event &event) {
+ Scene830 *scene = (Scene830 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ if (BF_GLOBALS._sceneObjects->contains(&scene->_object6)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8309;
+ scene->setAction(&scene->_sequenceManager, scene, 8309, &BF_GLOBALS._player, NULL);
+ return true;
+ }
+ break;
+ case CURSOR_USE:
+ if (BF_GLOBALS._sceneObjects->contains(&scene->_object6)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8305;
+ scene->setAction(&scene->_sequenceManager, scene, 8305, &BF_GLOBALS._player, &scene->_object6, NULL);
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+
+ return NamedHotspot::startAction(action, event);
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene830::Scene830(): PalettedScene() {
+ _field18A4 = _field18A6 = _field18A8 = _field18AA = _field18AC = 0;
+}
+
+void Scene830::synchronize(Serializer &s) {
+ PalettedScene::synchronize(s);
+ s.syncAsByte(_field18A4);
+ s.syncAsByte(_field18A6);
+ s.syncAsByte(_field18A8);
+ s.syncAsByte(_field18AA);
+ s.syncAsByte(_field18AC);
+}
+
+void Scene830::postInit(SceneObjectList *OwnerList) {
+ PalettedScene::postInit();
+ loadScene(830);
+ _sound1.fadeSound(35);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ _stripManager.addSpeaker(&_lyleHatSpeaker);
+
+ if (BF_GLOBALS._dayNumber == 0) {
+ BF_GLOBALS._sceneManager._previousScene = 340;
+ BF_GLOBALS._dayNumber = 1;
+ BF_GLOBALS.setFlag(fWithLyle);
+ }
+
+ _field18A8 = (BF_GLOBALS._dayNumber <= 3) ? 0 : 1;
+ _field18AC = 0;
+ BF_GLOBALS.clearFlag(fCanDrawGun);
+
+ _seExit.setDetails(Rect(183, 161, 320, 167), 830, -1, -1, -1, 1, NULL);
+
+ PaletteRotation *rot = BF_GLOBALS._scenePalette.addRotation(184, 189, 1);
+ rot->setDelay(30);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.disableControl();
+
+ if (_field18A8) {
+ _object4.postInit();
+ _object4.setVisage(830);
+ _object4.setStrip(1);
+ _object4.setPosition(Common::Point(271, 146));
+ _object4.fixPriority(90);
+ _object4.setDetails(830, 0, 1, 2, 1, NULL);
+ }
+
+ _door.postInit();
+ _door.setVisage(830);
+ _door.setDetails(830, 3, 4, -1, 1, NULL);
+ _door.setStrip((BF_GLOBALS._dayNumber == 2) ? 4 : 3);
+ _door.setPosition(Common::Point(182, 97));
+
+ _field18A4 = 1;
+ _noteBoard.setDetails(1, 830, 30, 31, 32, 1);
+
+ switch (BF_GLOBALS._dayNumber) {
+ case 1:
+ if ((BF_GLOBALS._bookmark >= bEndOfWorkDayOne) && (BF_INVENTORY.getObjectScene(INV_CARTER_NOTE) != 1) &&
+ (BF_INVENTORY.getObjectScene(INV_CARTER_NOTE) != 3)) {
+ _object6.postInit();
+ _object6.setVisage(830);
+ _object6.setStrip(4);
+ _object6.setFrame(2);
+ _object6.setPosition(Common::Point(302, 124));
+ }
+ break;
+ case 4:
+ if (BF_INVENTORY.getObjectScene(INV_FISHING_NET) == 830) {
+ _object5.postInit();
+ _object5.setVisage(830);
+ _object5.setStrip(2);
+ _object5.setFrame(2);
+ _object5.setPosition(Common::Point(126, 133));
+ _object5.setDetails(830, 7, 8, -1, 1, NULL);
+ }
+ break;
+ case 5:
+ if ((BF_GLOBALS._sceneManager._previousScene == 840) && (BF_INVENTORY.getObjectScene(INV_RENTAL_KEYS) == 1) &&
+ !BF_GLOBALS.getFlag(fWithLyle)) {
+ _field18A4 = 0;
+
+ _lyle.postInit();
+ _lyle._flags = OBJFLAG_CHECK_REGION;
+ _lyle.setVisage(835);
+ _lyle.setObjectWrapper(new SceneObjectWrapper());
+ _lyle.animate(ANIM_MODE_1, NULL);
+ _lyle.setStrip(4);
+ _lyle.setPosition(Common::Point(180, 154));
+ _lyle._moveDiff = Common::Point(2, 0);
+ _lyle.setDetails(830, 28, -1, 29, 1, NULL);
+
+ _field18AC = 1;
+ }
+ break;
+ }
+
+ _item2.setDetails(7, 830, 9, 10, 11, 1);
+ _item4.setDetails(2, 830, 12, 13, 14, 1);
+ _item5.setDetails(3, 830, 15, 16, 17, 1);
+ _item6.setDetails(4, 830, 18, 19, 20, 1);
+ _item7.setDetails(5, 830, 21, 22, 23, 1);
+ _item8.setDetails(6, 830, 24, 25, 26, 1);
+
+ switch (BF_GLOBALS._sceneManager._previousScene) {
+ case 840:
+ _sceneMode = 833;
+ if (BF_GLOBALS.getFlag(onDuty)) {
+ setAction(&_sequenceManager, this, 8304, &BF_GLOBALS._player, &_door, NULL);
+ } else if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _lyle.postInit();
+ _lyle._moveDiff = Common::Point(2, 0);
+ _sceneMode = 837;
+ setAction(&_sequenceManager, this, 837, &_lyle, &_door, &BF_GLOBALS._player, NULL);
+ } else {
+ setAction(&_sequenceManager, this, 833, &BF_GLOBALS._player, &_door, NULL);
+ }
+ break;
+ case 850:
+ BF_GLOBALS._player.setVisage(831);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setStrip(3);
+ BF_GLOBALS._player._moveDiff = Common::Point(2, 0);
+ BF_GLOBALS._player.setPosition(Common::Point(220, 122));
+ BF_GLOBALS._player.enableControl();
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _lyle.postInit();
+ _lyle.setVisage(835);
+ _lyle.setObjectWrapper(new SceneObjectWrapper());
+ _lyle.animate(ANIM_MODE_1, NULL);
+ _lyle.setStrip(3);
+ _lyle._moveDiff = Common::Point(2, 0);
+ _lyle.setPosition(Common::Point(224, 126));
+ }
+
+ if ((BF_GLOBALS._bookmark == bEndDayThree) && (BF_INVENTORY.getObjectScene(INV_FISHING_NET) == 1)) {
+ BF_INVENTORY.setObjectScene(INV_FISHING_NET, 0);
+ BF_INVENTORY.setObjectScene(INV_HOOK, 0);
+ }
+ break;
+ case 340:
+ case 830:
+ default:
+ _sceneMode = 830;
+ setAction(&_sequenceManager, this, BF_GLOBALS.getFlag(onDuty) ? 8303 : 830, &BF_GLOBALS._player, NULL);
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _lyle.postInit();
+ _lyle.setVisage(835);
+ _lyle.setObjectWrapper(new SceneObjectWrapper());
+ _lyle.animate(ANIM_MODE_1, NULL);
+ _lyle.setPosition(Common::Point(SCREEN_WIDTH, SCREEN_HEIGHT));
+ _lyle._moveDiff = Common::Point(2, 0);
+ ADD_MOVER(_lyle, 280, 160);
+ }
+ break;
+ }
+
+ _field18A6 = 1;
+}
+
+void Scene830::remove() {
+ BF_GLOBALS._scenePalette.clearListeners();
+ PalettedScene::remove();
+}
+
+void Scene830::signal() {
+ static uint32 black = 0;
+
+ switch (_sceneMode) {
+ case 11:
+ _sceneMode = 832;
+ BF_GLOBALS._scenePalette.clearListeners();
+ addFader((const byte *)&black, 5, this);
+ BF_GLOBALS._v51C44 = 0;
+ break;
+ case 12:
+ _sceneMode = 831;
+ BF_GLOBALS._scenePalette.clearListeners();
+ addFader((const byte *)&black, 5, this);
+ BF_GLOBALS._v51C44 = 0;
+ break;
+ case 13:
+ BF_GLOBALS._sceneManager.changeScene(850);
+ break;
+ case 14:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 8312;
+
+ _object1.postInit();
+ setAction(&_sequenceManager, this, 8312, &_object1, NULL);
+ break;
+ case 830:
+ _field18A6 = 1;
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 831:
+ case 8306:
+ BF_GLOBALS._sceneManager.changeScene((BF_GLOBALS._bookmark < bStartOfGame) ||
+ (BF_GLOBALS._bookmark >= bCalledToDomesticViolence) ? 342 : 340);
+ break;
+ case 832:
+ BF_GLOBALS._sceneManager.changeScene(840);
+ break;
+ case 833:
+ if (_field18AC) {
+ BF_GLOBALS.setFlag(fWithLyle);
+ _sceneMode = 8311;
+ setAction(&_sequenceManager, this, 8311, &BF_GLOBALS._player, &_lyle, NULL);
+ } else {
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player._strip = 3;
+ BF_GLOBALS._player._frame = 1;
+ }
+ break;
+ case 834:
+ BF_GLOBALS._sceneManager.changeScene(850);
+ break;
+ case 837:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 8300:
+ _sceneMode = 13;
+ BF_GLOBALS._scenePalette.clearListeners();
+ addFader((const byte *)&black, 5, this);
+ break;
+ case 8305:
+ _object6.remove();
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player._strip = 7;
+
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_INVENTORY.setObjectScene(INV_CARTER_NOTE, 1);
+ break;
+ case 8307:
+ BF_GLOBALS._player.enableControl();
+ _object5.remove();
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_INVENTORY.setObjectScene(INV_FISHING_NET, 1);
+ break;
+ case 8309:
+ case 8311:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 8312:
+ _object1.remove();
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene830::process(Event &event) {
+ if (BF_GLOBALS._player._enabled && (event.eventType == EVENT_BUTTON_DOWN) &&
+ (BF_GLOBALS._events.getCursor() == CURSOR_WALK) && !_field18A4) {
+ _stripManager.start(8306, &BF_GLOBALS._stripProxy);
+ event.handled = true;
+ }
+
+ if (BF_GLOBALS._player._enabled && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ // Check if the cursor is on an exit
+ if (_seExit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_SE);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+}
+
+void Scene830::dispatch() {
+ SceneExt::dispatch();
+
+ if (!_action && _field18A6 && (BF_GLOBALS._player._position.y > 160)) {
+ if (!_field18A4) {
+ _stripManager.start(8305, &BF_GLOBALS._player);
+ ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 192, 145);
+ } else if ((BF_INVENTORY.getObjectScene(INV_RENTAL_KEYS) == 1) && (BF_GLOBALS._bookmark == bEndDayThree)) {
+ BF_GLOBALS._player.disableControl();
+ SceneItem::display2(830, 27);
+ _field18A6 = 0;
+ _sceneMode = 830;
+ ADD_PLAYER_MOVER(BF_GLOBALS._player._position.x - 10, BF_GLOBALS._player._position.y - 10);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ _field18A6 = 0;
+ _sceneMode = 831;
+ ADD_PLAYER_MOVER(BF_GLOBALS._player._position.x + 40, BF_GLOBALS._player._position.y + 40);
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ ADD_MOVER_NULL(_lyle, SCREEN_WIDTH, SCREEN_HEIGHT);
+ if (_lyle._position.y < 160)
+ _sceneMode = 12;
+ }
+ }
+ }
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 840 - Boat Rentals
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene840::Object2::postInit(SceneObjectList *OwnerList) {
+ FocusObject::postInit(OwnerList);
+
+ if (BF_INVENTORY.getObjectScene(INV_RENTAL_KEYS) != 1) {
+ _rentalKeys.postInit();
+ _rentalKeys.setVisage(840);
+ _rentalKeys.setStrip(2);
+ _rentalKeys.setFrame(3);
+ _rentalKeys.setPosition(Common::Point(120, 132));
+ _rentalKeys.fixPriority(255);
+ _rentalKeys.setDetails(840, 52, 8, -1, 2, NULL);
+ }
+
+ if (BF_INVENTORY.getObjectScene(INV_WAVE_KEYS) != 1) {
+ _waveKeys.postInit();
+ _waveKeys.setVisage(840);
+ _waveKeys.setStrip(2);
+ _waveKeys.setFrame(2);
+ _waveKeys.setPosition(Common::Point(201, 91));
+ _waveKeys.fixPriority(255);
+ _waveKeys.setDetails(840, 53, 8, -1, 2, NULL);
+ }
+
+ _v1B4 = _v1B6 = 0;
+}
+
+void Scene840::Object2::remove() {
+ Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene;
+
+ _rentalKeys.remove();
+ _waveKeys.remove();
+ BF_GLOBALS._player.disableControl();
+
+ scene->_sceneMode = 8412;
+ scene->setAction(&scene->_sequenceManager1, scene, 8412, &BF_GLOBALS._player, NULL);
+}
+
+void Scene840::Object2::process(Event &event) {
+ if (BF_GLOBALS._player._enabled) {
+ if (_bounds.contains(event.mousePos)) {
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (cursorId == CURSOR_WALK) && (event.btnState == 3)) {
+ BF_GLOBALS._events.setCursor(CURSOR_USE);
+ event.handled = true;
+ }
+ } else if (event.mousePos.y < 168) {
+ BF_GLOBALS._events.setCursor(_img);
+ if (event.eventType == EVENT_BUTTON_DOWN) {
+ event.handled = true;
+ remove();
+ }
+ }
+ }
+
+ FocusObject::process(event);
+}
+
+bool Scene840::Object2::startAction(CursorType action, Event &event) {
+ switch (action) {
+ case CURSOR_LOOK:
+ if ((event.mousePos.y > 43) && (event.mousePos.y < 92)) {
+ if (event.mousePos.x < 135) {
+ SceneItem::display2(840, 54);
+ return true;
+ } else if (event.mousePos.x < 183) {
+ SceneItem::display2(840, 57);
+ return true;
+ }
+ } else if ((event.mousePos.y > 91) && (event.mousePos.y < 132)) {
+ if (event.mousePos.x > 182) {
+ SceneItem::display2(840, 58);
+ return true;
+ } else if (event.mousePos.x > 134) {
+ SceneItem::display2(840, 57);
+ return true;
+ }
+ }
+ break;
+ case INV_WAVE_KEYS:
+ if ((BF_GLOBALS._dayNumber != 4) || (BF_GLOBALS._bookmark != bEndDayThree))
+ SceneItem::display(840, 47);
+ else {
+ BF_GLOBALS._uiElements.addScore(50);
+
+ if (BF_INVENTORY.getObjectScene(INV_RENTAL_KEYS) == 1) {
+ // Replace rental keys
+ _rentalKeys.postInit();
+ _rentalKeys.setVisage(840);
+ _rentalKeys.setStrip(2);
+ _rentalKeys.setFrame(3);
+ _rentalKeys.setPosition(Common::Point(120, 132));
+ _rentalKeys.fixPriority(255);
+ _rentalKeys.setDetails(840, 52, 8, -1, 2, NULL);
+ }
+
+ if (BF_INVENTORY.getObjectScene(INV_WAVE_KEYS) == 1) {
+ // Replace wave keys
+ _waveKeys.postInit();
+ _waveKeys.setVisage(840);
+ _waveKeys.setStrip(2);
+ _waveKeys.setFrame(2);
+ _waveKeys.setPosition(Common::Point(201, 91));
+ _waveKeys.fixPriority(255);
+ _waveKeys.setDetails(840, 53, 8, -1, 2, NULL);
+ }
+
+ BF_INVENTORY.setObjectScene(INV_WAVE_KEYS, 0);
+ BF_INVENTORY.setObjectScene(INV_RENTAL_KEYS, 0);
+ }
+ return true;
+ default:
+ break;
+ }
+
+ return FocusObject::startAction(action, event);
+}
+
+bool Scene840::Object2::RentalKeys::startAction(CursorType action, Event &event) {
+ Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if ((BF_GLOBALS._dayNumber == 4) && (BF_GLOBALS._bookmark >= bEndDayThree)) {
+ SceneItem::display2(840, 9);
+ } else {
+ SceneItem::display2(840, 55);
+ BF_INVENTORY.setObjectScene(INV_RENTAL_KEYS, 1);
+ BF_GLOBALS._uiElements.addScore(30);
+
+ scene->_object2._v1B4 = 1;
+ remove();
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene840::Object2::WaveKeys::startAction(CursorType action, Event &event) {
+ Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (scene->_field1AC2) {
+ SceneItem::display(840, 56);
+ BF_INVENTORY.setObjectScene(INV_WAVE_KEYS, 1);
+ BF_GLOBALS._uiElements.addScore(50);
+ scene->_object2._v1B6 = 1;
+ remove();
+ } else {
+ SceneItem::display2(840, 9);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene840::Object6::startAction(CursorType action, Event &event) {
+ Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ scene->_object1.postInit();
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8410;
+ scene->setAction(&scene->_sequenceManager1, scene, 8410, &scene->_object1, &BF_GLOBALS._player, NULL);
+ return true;
+ case CURSOR_USE:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8411;
+ scene->setAction(&scene->_sequenceManager1, scene, 8411, &BF_GLOBALS._player, NULL);
+ return true;
+ case INV_WAVE_KEYS:
+ case INV_RENTAL_KEYS:
+ if ((BF_GLOBALS._dayNumber == 4) && (BF_GLOBALS._bookmark == bEndDayThree)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8417;
+ scene->setAction(&scene->_sequenceManager1, scene, 8417, &BF_GLOBALS._player, NULL);
+ } else {
+ SceneItem::display2(840, 47);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene840::Carter::startAction(CursorType action, Event &event) {
+ Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_TALK:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1;
+
+ if ((BF_GLOBALS._player._position.x != 219) || (BF_GLOBALS._player._position.y != 129)) {
+ Common::Point pt(219, 129);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, scene);
+ } else {
+ scene->signal();
+ }
+ return true;
+ case INV_RENTAL_COUPON: {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 6;
+
+ Common::Point pt(219, 129);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, scene);
+ return true;
+ }
+ case INV_NICKEL:
+ ++BF_GLOBALS._v4CEB6;
+ BF_GLOBALS._player.disableControl();
+
+ if (BF_INVENTORY.getObjectScene(INV_WAVE_KEYS) == 1) {
+ if (!BF_GLOBALS.getFlag(fGotPointsForCombo)) {
+ BF_GLOBALS._uiElements.addScore(50);
+ BF_GLOBALS.setFlag(fGotPointsForCombo);
+ }
+ }
+
+ scene->_sceneMode = 8407;
+ scene->setAction(&scene->_sequenceManager1, scene, 8407, &BF_GLOBALS._player, NULL);
+ return true;
+ case INV_CARTER_NOTE:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8402;
+
+ if (!BF_GLOBALS._v4CEB6) {
+ scene->setAction(&scene->_sequenceManager1, scene, 8402, &BF_GLOBALS._player, &scene->_carter, NULL);
+ } else {
+ scene->setAction(&scene->_sequenceManager1, scene, 8414, &BF_GLOBALS._player, &scene->_carter, NULL);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+bool Scene840::Coins::startAction(CursorType action, Event &event) {
+ Scene840 *scene = (Scene840 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 8404;
+ scene->setAction(&scene->_sequenceManager1, scene, BF_GLOBALS.getFlag(onDuty) ? 8415 : 8404,
+ &BF_GLOBALS._player, NULL);
+ return true;
+ default:
+ return NamedHotspot::startAction(action, event);
+ }
+}
+
+bool Scene840::Exit::startAction(CursorType action, Event &event) {
+ ADD_PLAYER_MOVER_NULL(BF_GLOBALS._player, 315, 150);
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene840::Scene840(): PalettedScene() {
+ _field1ABC = 1;
+ _field1ABE = 0;
+ _field1AC0 = 0;
+ _field1AC2 = 0;
+ _field1AC4 = 0;
+ _field1AC6 = (BF_GLOBALS._dayNumber > 3) ? 1 : 0;
+}
+
+void Scene840::synchronize(Serializer &s) {
+ PalettedScene::synchronize(s);
+
+ s.syncAsSint16LE(_field1ABA);
+ s.syncAsSint16LE(_field1ABC);
+ s.syncAsSint16LE(_field1ABE);
+ s.syncAsSint16LE(_field1AC0);
+ s.syncAsSint16LE(_field1AC2);
+ s.syncAsSint16LE(_field1AC4);
+ s.syncAsSint16LE(_field1AC6);
+}
+
+void Scene840::postInit(SceneObjectList *OwnerList) {
+ PalettedScene::postInit(OwnerList);
+ BF_GLOBALS._sound1.changeSound(41);
+ loadScene(840);
+ _field1ABA = 0;
+
+ if (BF_GLOBALS._dayNumber == 0) {
+ // Debugging mode setup
+ BF_GLOBALS._dayNumber = 4;
+ BF_INVENTORY.setObjectScene(INV_NICKEL, 1);
+ BF_INVENTORY.setObjectScene(INV_RENTAL_COUPON, 1);
+ }
+
+ setZoomPercents(0, 90, 110, 100);
+ _exit.setDetails(Rect(310, 133, 320, 167), 840, -1, -1, -1, 1, NULL);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ _stripManager.addSpeaker(&_jakeUniformSpeaker);
+ _stripManager.addSpeaker(&_carterSpeaker);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player._moveDiff.x = BF_GLOBALS.getFlag(onDuty) ? 8 : 7;
+
+ _doors.postInit();
+ _doors.setVisage(840);
+ _doors.setStrip(3);
+ _doors.setPosition(Common::Point(157, 81));
+ _doors.setDetails(840, 0, 1, 2, 1, NULL);
+
+ _carter.postInit();
+ _carter.setVisage(843);
+ _carter.setStrip(6);
+ _carter.fixPriority(110);
+ _carter.setPosition(Common::Point(262, 128));
+ _carter.changeZoom(-1);
+
+ _item14.setDetails(1, 840, 29, 30, 31, 1);
+ _item2.setDetails(Rect(6, 5, 85, 31), 840, 16, 14, 12, 1, NULL);
+ _item3.setDetails(Rect(91, 7, 102, 26), 840, 17, 14, 12, 1, NULL);
+ _item4.setDetails(Rect(6, 49, 80, 67), 840, 18, 15, 13, 1, NULL);
+ _item5.setDetails(Rect(80, 29, 100, 65), 840, 19, 15, 13, 1, NULL);
+ _item6.setDetails(Rect(104, 32, 127, 78), 840, 20, 15, 13, 1, NULL);
+ _item7.setDetails(Rect(1, 106, 35, 166), 840, 21, 15, 13, 1, NULL);
+ _item9.setDetails(Rect(205, 17, 251, 60), 840, 23, 15, 13, 1, NULL);
+ _item10.setDetails(Rect(199, 56, 236, 80), 840, 24, 14, 12, 1, NULL);
+ _item11.setDetails(Rect(256, 94, 319, 118), 840, 25, 15, 13, 1, NULL);
+ _item18.setDetails(6, 840, 38, 39, 40, 1);
+ _carter.setDetails(840, 3, 4, 5, 1, NULL);
+ _item8.setDetails(Rect(259, 4, 319, 87), 840, 22, 15, 13, 1, NULL);
+ _item15.setDetails(2, 840, 32, 33, 34, 1);
+ _coins.setDetails(3, 840, -1, 6, 7, 1);
+ _item16.setDetails(4, 840, 44, 45, 46, 1);
+ _item17.setDetails(5, 840, 26, 27, 28, 1);
+ _item12.setDetails(7, 840, 35, 36, 37, 1);
+ _item13.setDetails(Rect(0, 0, SCREEN_WIDTH - 1, BF_INTERFACE_Y), 840, 41, 42, 43, 1, NULL);
+
+ if (BF_INVENTORY.getObjectScene(INV_RENTAL_KEYS) == 1) {
+ _object6.postInit();
+ _object6.setVisage(840);
+ _object6.setStrip(4);
+ _object6.setFrame(1);
+ _object6.setPosition(Common::Point(250, 83));
+ _object6.fixPriority(120);
+ _object6.setDetails(840, -1, 8, 9, 2, NULL);
+ _field1AC0 = 1;
+ }
+
+ _sceneMode = BF_GLOBALS.getFlag(onDuty) ? 8401 : 8400;
+ setAction(&_sequenceManager1, this, _sceneMode, &BF_GLOBALS._player, NULL);
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _lyle.postInit();
+ _lyle.setAction(&_sequenceManager2, NULL, 8405, &_lyle, NULL);
+ }
+}
+
+void Scene840::signal() {
+ switch (_sceneMode) {
+ case 1:
+ // Talking to Carter
+ BF_GLOBALS._player._strip = 7;
+ BF_GLOBALS._player._frame = 1;
+ _sceneMode = 3;
+
+ switch (BF_GLOBALS._dayNumber) {
+ case 1:
+ if (_field1ABA == 1) {
+ _stripManager.start(BF_GLOBALS.getFlag(onDuty) ? 8430 : 8406, this);
+ } else if (!BF_GLOBALS.getFlag(onDuty)) {
+ _stripManager.start(!BF_GLOBALS._v4CEB6 ? 8400 : 8406, this);
+ } else if (BF_GLOBALS._bookmark < bStartOfGame) {
+ _stripManager.start(!BF_GLOBALS._v4CEB6 ? 8429 : 8430, this);
+ } else if (BF_GLOBALS._bookmark < bCalledToDomesticViolence) {
+ _stripManager.start(!BF_GLOBALS._v4CEB6 ? 8402 : 8401, this);
+ } else {
+ _stripManager.start(!BF_GLOBALS._v4CEB6 ? 8404 : 8403, this);
+ }
+ break;
+ case 2:
+ _stripManager.start(!BF_GLOBALS._v4CEB6 ? 8405 : 8430, this);
+ break;
+ case 3:
+ if (!BF_GLOBALS._v4CEB6) {
+ _stripManager.start(BF_GLOBALS.getFlag(fWithLyle) ? 8409 : 8411, this);
+ } else if (_field1ABA == 1) {
+ _stripManager.start(8406, this);
+ } else if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _stripManager.start(BF_GLOBALS.getFlag(fCarterMetLyle) ? 8415 : 8414, this);
+ } else {
+ _stripManager.start(8413, this);
+ }
+
+ BF_GLOBALS.setFlag(fTalkedCarterDay3);
+ break;
+ case 4:
+ if (!BF_GLOBALS._v4CEB6) {
+ if (BF_GLOBALS.getFlag(fTalkedCarterDay3)) {
+ if (BF_GLOBALS.getFlag(fWithLyle))
+ _stripManager.start(BF_GLOBALS.getFlag(fCarterMetLyle) ? 8415 : 8414, this);
+ else
+ _stripManager.start(8413, this);
+ } else if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _stripManager.start(BF_GLOBALS.getFlag(fCarterMetLyle) ? 8431 : 8409, this);
+ } else {
+ _stripManager.start(8411, this);
+ }
+ } else if (_field1ABA == 1) {
+ _stripManager.start(8406, this);
+ } else if (!BF_GLOBALS.getFlag(fWithLyle)) {
+ _stripManager.start(8413, this);
+ } else {
+ _stripManager.start(BF_GLOBALS.getFlag(fCarterMetLyle) ? 8415 : 8414, this);
+ }
+ break;
+ case 5:
+ _stripManager.start((_field1ABA == 1) ? 8406 : 8413, this);
+ break;
+ default:
+ break;
+ }
+
+ _field1ABA = 1;
+ break;
+ case 2:
+ BF_GLOBALS._sceneManager.changeScene(830);
+ BF_GLOBALS._sound1.changeSound(10);
+ break;
+ case 3:
+ case 8404:
+ case 8416:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 4:
+ _sceneMode = 8403;
+ _object6.postInit();
+ _object6.setDetails(840, -1, 8, 9, 2, NULL);
+ setAction(&_sequenceManager1, this, 8403, &_carter, &_object6, NULL);
+ break;
+ case 5:
+ _sceneMode = 8408;
+ setAction(&_sequenceManager1, this, 8408, &BF_GLOBALS._player, &_carter, &_doors, NULL);
+ _field1AC2 = 1;
+ break;
+ case 6:
+ BF_GLOBALS._player._strip = 7;
+ BF_GLOBALS._player._frame = 1;
+
+ if ((BF_GLOBALS._dayNumber == 4) && (BF_GLOBALS._bookmark >= bEndDayThree)) {
+ _stripManager.start(8440, this);
+ _sceneMode = 3;
+ } else if (BF_GLOBALS._sceneObjects->contains(&_object6)) {
+ _stripManager.start(8442, this);
+ _sceneMode = 3;
+ } else if (_field1AC6) {
+ _sceneMode = 4;
+ _stripManager.start(BF_GLOBALS.getFlag(fWithLyle) ? 8424 : 8410, this);
+ } else {
+ _sceneMode = 3;
+ _stripManager.start(8436, this);
+ }
+ break;
+ case 8400:
+ case 8401:
+ BF_GLOBALS._player._strip = 7;
+ BF_GLOBALS._player._frame = 1;
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 8402:
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_INVENTORY.setObjectScene(INV_CARTER_NOTE, 3);
+ BF_INVENTORY.setObjectScene(INV_BASEBALL_CARD, 1);
+ BF_INVENTORY.setObjectScene(INV_RENTAL_COUPON, 1);
+ break;
+ case 8403:
+ BF_GLOBALS._uiElements.addScore(30);
+ _sceneMode = 3;
+ _field1AC0 = 1;
+ _stripManager.start(8441, this);
+ break;
+ case 8407:
+ if (((BF_GLOBALS._dayNumber == 4) && (BF_GLOBALS._bookmark >= bEndDayThree)) ||
+ (BF_INVENTORY.getObjectScene(INV_WAVE_KEYS) == 1)) {
+ _sceneMode = 8416;
+ setAction(&_sequenceManager1, this, 8416, &BF_GLOBALS._player, NULL);
+ } else {
+ _stripManager.start(_field1ABE + 8419, this);
+ _sceneMode = 5;
+
+ if (++_field1ABE == 4)
+ _field1ABE = 1;
+ }
+ break;
+ case 8408:
+ if (_field1AC0) {
+ BF_GLOBALS._player.enableControl();
+ } else {
+ _sceneMode = 8409;
+ setAction(&_sequenceManager1, this, 8409, &BF_GLOBALS._player, &_carter, &_doors, NULL);
+ }
+ break;
+ case 8409:
+ _field1AC2 = 0;
+ _sceneMode = 3;
+ _stripManager.start(8423, this);
+ break;
+ case 8410:
+ BF_GLOBALS._player.enableControl();
+ _object1.remove();
+ break;
+ case 8411:
+ BF_GLOBALS._player.enableControl();
+ _object2.postInit();
+ _object2.setVisage(840);
+ _object2.setStrip(2);
+ _object2.setPosition(Common::Point(160, 140));
+ _object2.fixPriority(254);
+ _object2.setDetails(840, 50, 8, 51);
+ break;
+ case 8412:
+ if (_object2._v1B6) {
+ _sceneMode = 8409;
+ setAction(&_sequenceManager1, this, 8409, &BF_GLOBALS._player, &_carter, &_doors, NULL);
+ } else if (!_object2._v1B4) {
+ BF_GLOBALS._player.enableControl();
+ } else {
+ _sceneMode = 3;
+ _field1AC0 = 1;
+
+ if (BF_GLOBALS._dayNumber == 5) {
+ _stripManager.start(8425, this);
+ } else {
+ _stripManager.start(BF_GLOBALS.getFlag(INV_NICKEL) ? 8417 : 8416, this);
+ }
+ }
+ break;
+ case 8413:
+ BF_GLOBALS._uiElements.addScore(50);
+ _sceneMode = 8409;
+ setAction(&_sequenceManager1, this, 8409, &BF_GLOBALS._player, &_carter, &_doors, NULL);
+ break;
+ case 8417:
+ _field1ABA = 1;
+ BF_GLOBALS._uiElements.addScore(50);
+ BF_INVENTORY.setObjectScene(INV_WAVE_KEYS, 0);
+ BF_INVENTORY.setObjectScene(INV_RENTAL_KEYS, 0);
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene840::process(Event &event) {
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (_exit.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_E);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ // In case an exit cursor was being shown, restore the previously selected cursor
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+}
+
+void Scene840::dispatch() {
+ SceneExt::dispatch();
+
+ if (_field1ABC && (BF_GLOBALS._player._position.x > 310) && !_action) {
+ _field1ABC = 0;
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 2;
+ ADD_PLAYER_MOVER(350, 150);
+
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _lyle.setAction(&_sequenceManager2, NULL, 8406, &_lyle, NULL);
+ }
+ }
+}
+
+} // End of namespace BlueForce
+
+} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_scenes8.h b/engines/tsage/blue_force/blueforce_scenes8.h
new file mode 100644
index 0000000000..84a11805a2
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_scenes8.h
@@ -0,0 +1,230 @@
+/* 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.
+ *
+ */
+
+#ifndef TSAGE_BLUEFORCE_SCENES8_H
+#define TSAGE_BLUEFORCE_SCENES8_H
+
+#include "common/scummsys.h"
+#include "tsage/blue_force/blueforce_logic.h"
+#include "tsage/blue_force/blueforce_speakers.h"
+#include "tsage/converse.h"
+#include "tsage/events.h"
+#include "tsage/core.h"
+#include "tsage/scenes.h"
+#include "tsage/globals.h"
+#include "tsage/sound.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+using namespace TsAGE;
+
+class Scene800: public SceneExt {
+ /* Actions */
+ class Action1 : public Action {
+ public:
+ virtual void signal();
+ };
+
+ /* Items */
+ class Item1: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Item2: public SceneHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Objects */
+ class Doorway: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Car1: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Motorcycle: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Lyle: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Car2: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+public:
+ Action1 _action1;
+ SequenceManager _sequenceManager;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerLyleHat _lyleHatSpeaker;
+ SpeakerGameText _gameTextSpeaker;
+ Doorway _doorway;
+ Car1 _car1;
+ Motorcycle _motorcycle;
+ Lyle _lyle;
+ Car2 _car2;
+ NamedObject _object6;
+ Item1 _item1;
+ Item2 _item2;
+ SceneText _text;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void dispatch();
+};
+
+class Scene830: public PalettedScene {
+ /* Items */
+ class SouthEastExit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class NoteBoard: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Objects */
+ class Lyle: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Door: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object4: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object5: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+public:
+ SequenceManager _sequenceManager;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerLyleHat _lyleHatSpeaker;
+ NamedObject _object1, _lyle, _object6;
+ Door _door;
+ Object4 _object4;
+ Object5 _object5;
+ SouthEastExit _seExit;
+ NoteBoard _noteBoard;
+ NamedHotspot _item2, _item4, _item5;
+ NamedHotspot _item6, _item7, _item8;
+ ASoundExt _sound1;
+ int _field18A4, _field18A6, _field18A8, _field18AA, _field18AC;
+
+ Scene830();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+class Scene840: public PalettedScene {
+ /* Items */
+ class Coins: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Exit: public NamedHotspot {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+ /* Objects */
+ class Object2: public FocusObject {
+ class RentalKeys: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class WaveKeys: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ public:
+ RentalKeys _rentalKeys;
+ WaveKeys _waveKeys;
+ int _v1B4, _v1B6;
+
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void remove();
+ virtual void process(Event &event);
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Object6: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+ class Carter: public NamedObject {
+ public:
+ virtual bool startAction(CursorType action, Event &event);
+ };
+
+public:
+ SequenceManager _sequenceManager1, _sequenceManager2;
+ NamedObject _object1;
+ Object2 _object2;
+ NamedObject _doors;
+ Object6 _object6;
+ Carter _carter;
+ NamedObject _lyle;
+ Coins _coins;
+ NamedHotspot _item2, _item3, _item4, _item5, _item6;
+ NamedHotspot _item7, _item8, _item9, _item10, _item11;
+ NamedHotspot _item12, _item13, _item14, _item15;
+ NamedHotspot _item16, _item17, _item18;
+ Exit _exit;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerJakeUniform _jakeUniformSpeaker;
+ SpeakerCarter _carterSpeaker;
+ int _field1ABA, _field1ABC, _field1ABE, _field1AC0;
+ int _field1AC2, _field1AC4, _field1AC6;
+
+ Scene840();
+ virtual void synchronize(Serializer &s);
+ virtual void postInit(SceneObjectList *OwnerList = NULL);
+ virtual void signal();
+ virtual void process(Event &event);
+ virtual void dispatch();
+};
+
+
+} // End of namespace BlueForce
+
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/blue_force/blueforce_scenes9.cpp b/engines/tsage/blue_force/blueforce_scenes9.cpp
new file mode 100644
index 0000000000..a449600b63
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_scenes9.cpp
@@ -0,0 +1,1677 @@
+/* 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 "tsage/blue_force/blueforce_scenes9.h"
+#include "tsage/globals.h"
+#include "tsage/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/staticres.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+/*--------------------------------------------------------------------------
+ * Scene 900 - Outside Warehouse
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene900::Item1::startAction(CursorType action, Event &event) {
+ if (action == CURSOR_LOOK) {
+ SceneItem::display2(900, 6);
+ return true;
+ } else {
+ return SceneHotspot::startAction(action, event);
+ }
+}
+
+bool Scene900::Item4::startAction(CursorType action, Event &event) {
+ Scene900 *scene = (Scene900 *)BF_GLOBALS._sceneManager._scene;
+
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9001;
+ Common::Point pt(0, 117);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, scene);
+
+ return true;
+}
+
+/*--------------------------------------------------------------------------*/
+bool Scene900::Object1::startAction(CursorType action, Event &event) {
+ Scene900 *scene = (Scene900 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (BF_GLOBALS._v4CEC0 == 0) {
+ return NamedObject::startAction(action, event);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS._v4CEC0 == 2) {
+ scene->_sceneMode = 9006;
+ BF_GLOBALS._v4CEC0 = 1;
+ scene->setAction(&scene->_sequenceManager1, scene, 9006, &BF_GLOBALS._player, this, NULL);
+ } else {
+ BF_GLOBALS._v4CEC0 = 2;
+ if (scene->_object3._flag == false) {
+ BF_GLOBALS._player.setAction(&scene->_action4);
+ } else {
+ scene->_sceneMode = 9005;
+ scene->setAction(&scene->_sequenceManager1, scene, 9005, &BF_GLOBALS._player, this, NULL);
+ BF_GLOBALS._walkRegions.proc2(24);
+ }
+ }
+ return true;
+ }
+ break;
+ case INV_WAREHOUSE_KEYS:
+ if (BF_GLOBALS._v4CEC0 == 2) {
+ SceneItem::display2(900, 14);
+ } else {
+ if (BF_GLOBALS._v4CEC0 == 0) {
+ if (!BF_GLOBALS.getFlag(fGotPointsForUnlockGate)) {
+ BF_GLOBALS.setFlag(fGotPointsForUnlockGate);
+ BF_GLOBALS._uiElements.addScore(30);
+ }
+ BF_GLOBALS._v4CEC0 = 1;
+ } else {
+ if (!BF_GLOBALS.getFlag(fGotPointsForLockGate)) {
+ if (BF_GLOBALS._bookmark == bEndDayThree) {
+ BF_GLOBALS.setFlag(fGotPointsForLockGate);
+ BF_GLOBALS._uiElements.addScore(30);
+ }
+ }
+ BF_GLOBALS._v4CEC0 = 0;
+ }
+ scene->_sceneMode = 9004;
+ BF_GLOBALS._player.disableControl();
+ scene->setAction(&scene->_sequenceManager1, scene, 9004, &BF_GLOBALS._player, NULL);
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene900::Object2::startAction(CursorType action, Event &event) {
+ Scene900 *scene = (Scene900 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_USE:
+ if (BF_GLOBALS._v4CEC0 == 2) {
+ if (_flag) {
+ SceneItem::display2(900, 1);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._walkRegions.proc2(26);
+ scene->_sceneMode = 9007;
+ scene->setAction(&scene->_sequenceManager1, scene, 9007, &BF_GLOBALS._player, &scene->_object2, this, NULL);
+ }
+ return true;
+ } else
+ return NamedObject::startAction(action, event);
+ break;
+ case INV_WAREHOUSE_KEYS:
+ if (BF_GLOBALS._v4CEC0 == 2) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9012;
+ scene->setAction(&scene->_sequenceManager1, scene, 9012, &BF_GLOBALS._player, &scene->_object2, NULL);
+ } else
+ SceneItem::display2(900, 5);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene900::Object3::startAction(CursorType action, Event &event) {
+ Scene900 *scene = (Scene900 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ SceneItem::display2(900, 8);
+ return true;
+ case CURSOR_USE:
+ SceneItem::display2(900, 9);
+ return true;
+ case INV_HOOK:
+ if (_flag) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9010;
+ scene->setAction(&scene->_sequenceManager1, scene, 9010, &BF_GLOBALS._player, &scene->_object5, this, NULL);
+ } else
+ SceneItem::display2(900, 23);
+ return true;
+ case INV_FISHING_NET:
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.setAction(&scene->_action2);
+ return true;
+ case INV_DOG_WHISTLE:
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.setAction(&scene->_action3);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ }
+}
+
+bool Scene900::Object6::startAction(CursorType action, Event &event) {
+ Scene900 *scene = (Scene900 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_TALK) {
+ if (BF_GLOBALS._sceneManager._sceneLoadCount == 0) {
+ if (!_action) {
+ if (scene->_object3._flag) {
+ if (BF_GLOBALS._v4CEC0 == 0)
+ scene->_stripManager.start(9004, &BF_GLOBALS._stripProxy);
+ else {
+ if (scene->_object2._flag == 1) {
+ if (BF_GLOBALS._v4CEC0 == 2)
+ scene->_stripManager.start(9005, &BF_GLOBALS._stripProxy);
+ else
+ scene->_stripManager.start(9001, &BF_GLOBALS._stripProxy);
+ } else
+ scene->_stripManager.start(9001, &BF_GLOBALS._stripProxy);
+ }
+ } else {
+ if (scene->_field1974)
+ scene->_stripManager.start(9003, &BF_GLOBALS._stripProxy);
+ else {
+ ++scene->_field1974;
+ scene->_stripManager.start(9002, &BF_GLOBALS._stripProxy);
+ }
+ }
+ }
+ }
+ return true;
+ } else
+ return NamedObject::startAction(action, event);
+}
+
+bool Scene900::Object7::startAction(CursorType action, Event &event) {
+ Scene900 *scene = (Scene900 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action == CURSOR_USE) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 9016;
+ scene->setAction(&scene->_sequenceManager1, scene, 9016, &BF_GLOBALS._player, NULL);
+ return true;
+ } else
+ return NamedObject::startAction(action, event);
+}
+
+/*--------------------------------------------------------------------------*/
+void Scene900::Action1::signal() {
+ Scene900 *scene = (Scene900 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ if (scene->_object3._flag == 0) {
+ scene->_object3.setStrip(3);
+ if ((BF_GLOBALS._randomSource.getRandomNumber(3) == 1) || (BF_GLOBALS._player._position.x > 790) || (scene->_field1976 != 0)) {
+ Common::Point pt(864, 130);
+ NpcMover *mover = new NpcMover();
+ scene->_object3.addMover(mover, &pt, this);
+ } else {
+ _actionIndex = 4;
+ Common::Point pt(775, 107);
+ NpcMover *mover = new NpcMover();
+ scene->_object3.addMover(mover, &pt, this);
+ }
+ }
+ break;
+ case 1:
+ scene->_object3.setPosition(Common::Point(864, 117));
+ scene->_object3.setStrip(7);
+ scene->_object3.setFrame(1);
+ scene->_object3.animate(ANIM_MODE_5, this);
+ if (BF_GLOBALS._randomSource.getRandomNumber(3) == 1)
+ scene->_sound1.play(92);
+ else
+ scene->_sound1.play(44);
+ if ((BF_GLOBALS._player._position.x > 750) || (scene->_field1976 != 0))
+ _actionIndex = 7;
+ break;
+ case 2:
+ scene->_object3.animate(ANIM_MODE_6, this);
+ break;
+ case 3: {
+ scene->_object3.setStrip(3);
+ scene->_object3.setPosition(Common::Point(864, 130));
+ scene->_object3.fixPriority(122);
+ scene->_object3.animate(ANIM_MODE_1, NULL);
+ Common::Point pt(775, 107);
+ NpcMover *mover = new NpcMover();
+ scene->_object3.addMover(mover, &pt, this);
+ break;
+ }
+ case 6:
+ _actionIndex = 0;
+ // No break on purpose
+ case 4:
+ setDelay(30);
+ break;
+ case 5: {
+ scene->_object3.setStrip(4);
+ Common::Point pt(940, 145);
+ NpcMover *mover = new NpcMover();
+ scene->_object3.addMover(mover, &pt, this);
+ break;
+ }
+ case 7:
+ _actionIndex = 7;
+ setDelay(5);
+ if (BF_GLOBALS._player._position.x < 790)
+ _actionIndex = 2;
+ if (scene->_field1976 != 0)
+ _actionIndex = 8;
+ break;
+ case 8:
+ scene->_object3.setStrip(1);
+ scene->_object3.setFrame(7);
+ scene->_object3.animate(ANIM_MODE_6, NULL);
+ break;
+ case 9:
+ scene->_field1976 = 0;
+ scene->_object3._flag = 0;
+ _actionIndex = 7;
+ scene->_object3.setStrip(1);
+ scene->_object3.setFrame(1);
+ scene->_object3.animate(ANIM_MODE_5, this);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene900::Action2::signal() {
+ Scene900 *scene = (Scene900 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->_field1976 = 1;
+ if (scene->_object3._action->getActionIndex() == 8)
+ _actionIndex = 0;
+ setDelay(5);
+ break;
+ case 1:
+ scene->_object5.postInit();
+ scene->_object5.setVisage(902);
+ scene->_object5.setStrip(2);
+ scene->_object5.setPosition(Common::Point(-20, -20));
+ scene->_object5._moveDiff.y = 10;
+ setAction(&scene->_sequenceManager1, this, 9009, &BF_GLOBALS._player, &scene->_object5, &scene->_object3, NULL);
+ BF_INVENTORY.setObjectScene(INV_FISHING_NET, 900);
+ break;
+ case 2:
+ BF_GLOBALS._player._strip = 7;
+ if (!BF_GLOBALS.getFlag(fGotPointsForTrapDog)) {
+ BF_GLOBALS.setFlag(fGotPointsForTrapDog);
+ BF_GLOBALS._uiElements.addScore(50);
+ }
+ SceneItem::display2(900, 10);
+ scene->_object3._flag = 1;
+ scene->_object3.fixPriority(130);
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene900::Action3::signal() {
+ Scene900 *scene = (Scene900 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ if ((BF_GLOBALS._player._position.x < 790) && (!BF_GLOBALS._player._mover)) {
+ Common::Point pt(821, 136);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, 0);
+ }
+ if (scene->_object3._action->getActionIndex() != 7) {
+ _actionIndex = 0;
+ }
+ setDelay(5);
+ break;
+ case 1:
+ if (scene->_object3._strip == 3) {
+ _actionIndex = 3;
+ Common::Point pt(775, 107);
+ NpcMover *mover = new NpcMover();
+ scene->_object3.addMover(mover, &pt, this);
+ } else
+ scene->_object3.animate(ANIM_MODE_6, this);
+ break;
+ case 2: {
+ scene->_object3.setStrip(3);
+ scene->_object3.setPosition(Common::Point(864, 130));
+ scene->_object3.fixPriority(122);
+ scene->_object3.animate(ANIM_MODE_1, NULL);
+ Common::Point pt(775, 107);
+ NpcMover *mover = new NpcMover();
+ scene->_object3.addMover(mover, &pt, this);
+ break;
+ }
+ case 3:
+ scene->_object3.remove();
+ scene->_object3._flag = 1;
+ SceneItem::display2(900, 24);
+ if (!BF_GLOBALS.getFlag(fGotPointsForLockWarehouse)) {
+ BF_GLOBALS.setFlag(fGotPointsForLockWarehouse);
+ BF_GLOBALS._uiElements.addScore(10);
+ }
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene900::Action4::signal() {
+ Scene900 *scene = (Scene900 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->_field1976 = 1;
+ if (scene->_object3._action->getActionIndex() != 8)
+ _actionIndex = 0;
+ setDelay(5);
+ break;
+ case 1:
+ scene->setAction(&scene->_sequenceManager1, scene, 9005, &BF_GLOBALS._player, &scene->_object1, NULL);
+ break;
+ case 2:
+ scene->setAction(&scene->_sequenceManager1, scene, 9008, &BF_GLOBALS._player, &scene->_object3, NULL);
+ break;
+ case 3:
+ BF_GLOBALS._deathReason = 5;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+Scene900::Scene900(): PalettedScene() {
+ _field1974 = _field1976 = 0;
+}
+
+void Scene900::postInit(SceneObjectList *OwnerList) {
+ PalettedScene::postInit();
+ loadScene(900);
+
+ if (BF_GLOBALS._sceneManager._previousScene == 910)
+ BF_GLOBALS._sound1.changeSound(91);
+ _field1974 = 0;
+ _field1976 = 0;
+ BF_GLOBALS._uiElements._active = true;
+ BF_GLOBALS.clearFlag(fCanDrawGun);
+ if (BF_GLOBALS._dayNumber == 0) {
+ BF_GLOBALS._dayNumber = 4;
+ BF_INVENTORY.setObjectScene(INV_FISHING_NET, 1);
+ BF_INVENTORY.setObjectScene(INV_HOOK, 1);
+ }
+ _object3._flag = 0;
+ if (BF_GLOBALS._bookmark >= bFinishedWGreen) {
+ _object7.postInit();
+ _object7.fixPriority(120);
+ _object7.setVisage(901);
+ _object7.setPosition(Common::Point(159,128));
+ _object7.setDetails(900, 15, 16, 17, ANIM_MODE_1, NULL);
+ }
+ if (BF_GLOBALS._sceneManager._previousScene == 910) {
+ _sceneBounds.moveTo(640, 0);
+ BF_GLOBALS._v4CEC0 = 2;
+ BF_INVENTORY.setObjectScene(INV_FISHING_NET, 900);
+ _object3._flag = 1;
+ }
+ if (BF_INVENTORY.getObjectScene(INV_FISHING_NET) == 900)
+ _object3._flag = 1;
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ _stripManager.addSpeaker(&_lyleHatSpeaker);
+
+ _item4.setDetails(Rect(0, 85, 20, 130), 900, -1, -1, -1, 1, 0);
+ BF_GLOBALS._player.postInit();
+
+ _object3.postInit();
+ _object3.setVisage(902);
+ _object3.setPosition(Common::Point(845, 135));
+ _object3.fixPriority(122);
+ _object3.setDetails(900, 8, -1, 9, 1, NULL);
+
+ if (_object3._flag == 0) {
+ _object3.animate(ANIM_MODE_1, NULL);
+ _object3.setAction(&_action1);
+ } else {
+ _object3.setAction(&_action1);
+ _object3.fixPriority(130);
+ if (BF_GLOBALS._dayNumber == 4) {
+ _object3.setPosition(Common::Point(879, 120));
+ _object3.setStrip(2);
+ } else {
+ _object3.setPosition(Common::Point(864, 117));
+ _object3.setStrip(6);
+ _object3.setFrame(6);
+ }
+ }
+
+ _object1.postInit();
+ _object1.setVisage(900);
+ _object1.setStrip(2);
+
+ if (BF_GLOBALS._v4CEC0 == 2)
+ _object1.setPosition(Common::Point(758, 127));
+ else {
+ BF_GLOBALS._walkRegions.proc1(24);
+ _object1.setPosition(Common::Point(804, 132));
+ }
+
+ if (BF_GLOBALS._dayNumber == 5)
+ BF_GLOBALS._v4CEC8 = 0;
+
+ if ((BF_GLOBALS._v4CEC8 == 0) && (BF_GLOBALS.getFlag(fWithLyle))) {
+ _object4.postInit();
+ _object4.setVisage(900);
+ _object4.setStrip(3);
+ _object4.fixPriority(1);
+ _object4.setPosition(Common::Point(866, 117));
+ }
+
+ _object2.postInit();
+ _object2.setVisage(900);
+
+ if (BF_GLOBALS._v4CEC8 == 0)
+ _object2.setStrip(4);
+ else
+ _object2.setStrip(1);
+
+ _object2.setPosition(Common::Point(847, 45));
+ _object2._flag = 1;
+
+ if ((BF_GLOBALS._sceneManager._previousScene == 880) || (BF_GLOBALS._sceneManager._previousScene != 910)) {
+ BF_GLOBALS._walkRegions.proc1(26);
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS._bookmark == bFinishedWGreen) {
+ _sceneMode = 9013;
+ _lyle.postInit();
+ _lyle._moveDiff.y = 7;
+ _lyle._flags |= 0x1000;
+ _lyle.setDetails(900, 19, 20, 21, ANIM_MODE_1, NULL);
+ _lyleHatSpeaker._xp = 210;
+ _jakeJacketSpeaker._xp = 75;
+ setAction(&_sequenceManager1, this, 9013, &BF_GLOBALS._player, &_lyle, NULL);
+ BF_GLOBALS._bookmark = bAmbushed;
+ BF_GLOBALS.setFlag(fWithLyle);
+ } else if (BF_GLOBALS._bookmark > bFinishedWGreen) {
+ _lyle.postInit();
+ _lyle.setVisage(811);
+ _lyle.setPosition(Common::Point(780, 153));
+ _lyle._moveDiff.y = 7;
+ _lyle._flags |= 0x1000;
+ _lyle.setDetails(900, 19, 20, 21, ANIM_MODE_1, NULL);
+ _lyle.animate(ANIM_MODE_1, NULL);
+ _lyle.setObjectWrapper(new SceneObjectWrapper());
+ } // no else on purpose
+ _sceneMode = 9000;
+ setAction(&_sequenceManager1, this, 9000, &BF_GLOBALS._player, NULL);
+ } else {
+ _object2._flag = 0;
+ _object2.setFrame(_object2.getFrameCount());
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 9002;
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ _lyle.postInit();
+ _lyle._flags |= 0x1000;
+ _lyle.setDetails(900, 19, 20, 21, ANIM_MODE_1, NULL);
+ setAction(&_sequenceManager1, this, 9014, &BF_GLOBALS._player, &_object2, &_lyle, NULL);
+ } else
+ setAction(&_sequenceManager1, this, 9002, &BF_GLOBALS._player, &_object2, NULL);
+ }
+
+ _object1.setDetails(900, 0, -1, 1, 1, 0);
+ _object2.setDetails(900, 2, -1, 5, 1, 0);
+ _item2.setDetails(Rect(0, 0, 225, 21), 666, 25, -1, -1, 1, NULL);
+ _item3.setDetails(Rect(37, 21, 324, 50), 666, 26, -1, -1, 1, NULL);
+ _item1.setDetails(Rect(0, 0, 960, 200), 900, 7, -1, -1, 1, NULL);
+}
+
+void Scene900::signal() {
+ static uint32 v50E8B = 0;
+
+ switch (_sceneMode++) {
+ case 1:
+ BF_GLOBALS._sceneManager.changeScene(910);
+ break;
+ case 3:
+ BF_GLOBALS._walkRegions.proc1(24);
+ _sceneMode = 9004;
+ setAction(&_sequenceManager1, this, 9006, &BF_GLOBALS._player, &_object1, NULL);
+ break;
+ case 9000:
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9001:
+ if ((BF_INVENTORY.getObjectScene(INV_FISHING_NET) == 900) || (BF_GLOBALS._v4CEC0 != 0) ||
+ (_object2._flag == 0))
+ BF_GLOBALS.setFlag(fLeftTraceIn900);
+ else
+ BF_GLOBALS.clearFlag(fLeftTraceIn900);
+
+ BF_GLOBALS._sceneManager.changeScene(880);
+ break;
+ case 9002:
+ BF_GLOBALS._walkRegions.proc1(26);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9004:
+ if (BF_GLOBALS._v4CEC0 == 0)
+ SceneItem::display2(900, 3);
+ else
+ SceneItem::display2(900, 4);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9005:
+ if (_object3._flag == 0)
+ BF_GLOBALS._player.setAction(&_action4);
+ else
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9006:
+ BF_GLOBALS._walkRegions.proc1(24);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9007:
+ if (BF_GLOBALS.getFlag(fWithLyle)) {
+ Common::Point pt(862, 119);
+ PlayerMover *mover = new PlayerMover();
+ _lyle.addMover(mover, &pt, NULL);
+ _sceneMode = 1;
+ addFader((const byte *)&v50E8B, 5, this);
+ } else
+ BF_GLOBALS._sceneManager.changeScene(910);
+ break;
+ case 9008:
+ BF_GLOBALS._deathReason = 5;
+ BF_GLOBALS._sceneManager.changeScene(666);
+ break;
+ case 9010:
+ _sound1.play(92);
+ if (BF_GLOBALS._v4CEC0 == 2) {
+ _sceneMode = 9008;
+ setAction(&_sequenceManager1, this, 9008, &BF_GLOBALS._player, &_object3, NULL);
+ } else {
+ BF_GLOBALS._player._strip = 7;
+ _action1.setActionIndex(9);
+ _object3.signal();
+ if ((!BF_GLOBALS.getFlag(fGotPointsForFreeDog)) && (BF_GLOBALS._bookmark == bEndDayThree)) {
+ BF_GLOBALS.setFlag(fGotPointsForFreeDog);
+ BF_GLOBALS._uiElements.addScore(50);
+ }
+ BF_INVENTORY.setObjectScene(INV_FISHING_NET, 1);
+ SceneItem::display2(900, 11);
+ BF_GLOBALS._player.enableControl();
+ }
+ break;
+ case 9012:
+ if (_object2._flag == 0) {
+ SceneItem::display2(900, 12);
+ _object2._flag = 1;
+ if ((!BF_GLOBALS.getFlag(fGotPointsForLockWarehouse)) && (BF_GLOBALS._bookmark == bEndDayThree)) {
+ BF_GLOBALS.setFlag(fGotPointsForLockWarehouse);
+ BF_GLOBALS._uiElements.addScore(30);
+ }
+ } else {
+ SceneItem::display2(900, 13);
+ _object2._flag = 0;
+ if (!BF_GLOBALS.getFlag(fGotPointsForUnlockWarehouse)) {
+ BF_GLOBALS.setFlag(fGotPointsForUnlockWarehouse);
+ BF_GLOBALS._uiElements.addScore(30);
+ }
+ }
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9013:
+ _lyleHatSpeaker._xp = 75;
+ _jakeJacketSpeaker._xp = 210;
+ _lyle.setAction(&_sequenceManager2, &_lyle, 9015, &_lyle, NULL);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9016:
+ if ((BF_GLOBALS._clip1Bullets == 0) && (BF_GLOBALS._clip2Bullets == 0)){
+ BF_GLOBALS._clip1Bullets = 8;
+ BF_GLOBALS._clip1Bullets = 8;
+ SceneItem::display2(900, 25);
+ } else if (BF_GLOBALS._clip1Bullets == 0) {
+ BF_GLOBALS._clip1Bullets = 8;
+ SceneItem::display2(900, 26);
+ } else if (BF_GLOBALS._clip2Bullets == 0) {
+ BF_GLOBALS._clip2Bullets = 8;
+ SceneItem::display2(900, 26);
+ } else
+ SceneItem::display2(900, 27);
+
+ BF_GLOBALS._player.enableControl();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene900::process(Event &event) {
+ SceneExt::process(event);
+
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (_item4.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_N);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+}
+
+void Scene900::dispatch() {
+ SceneExt::dispatch();
+
+ if (BF_GLOBALS.getFlag(fWithLyle) && _lyle.isNoMover()) {
+ _lyle.updateAngle(BF_GLOBALS._player._position);
+ }
+
+ if (!_action) {
+ if ((BF_GLOBALS._player._position.x <= 20) && (BF_GLOBALS._player._position.y < 130)) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 9001;
+ setAction(&_sequenceManager1, this, 9001, &BF_GLOBALS._player, NULL);
+ }
+ }
+}
+
+void Scene900::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_field1974);
+ s.syncAsSint16LE(_field1976);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 920 - Inside Warehouse: Secret Room
+ *
+ *--------------------------------------------------------------------------*/
+// Crate
+bool Scene920::Item1::startAction(CursorType action, Event &event) {
+ Scene920 *scene = (Scene920 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_LOOK:
+ if ((BF_GLOBALS.getFlag(fCrateOpen)) && (BF_GLOBALS._player._visage == 921)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_object2.postInit();
+ scene->_sceneMode = 9204;
+ if (!BF_GLOBALS.getFlag(fGotPointsForBoots)) {
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(fGotPointsForBoots);
+ }
+ scene->setAction(&scene->_sequenceManager1, scene, 9204, &BF_GLOBALS._player, &scene->_object2, NULL);
+ return true;
+ } else
+ return NamedHotspot::startAction(action, event);
+ break;
+ case CURSOR_USE:
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS.getFlag(fCrateOpen)) {
+ if (BF_GLOBALS._player._visage == 921) {
+ if ((BF_INVENTORY.getObjectScene(15) != 1) && (BF_GLOBALS.getFlag(fSawGuns))) {
+ scene->_sceneMode = 9207;
+ scene->setAction(&scene->_sequenceManager1, scene, 9207, &BF_GLOBALS._player, NULL);
+ } else {
+ scene->_sceneMode = 9203;
+ scene->setAction(&scene->_sequenceManager1, scene, 9203, &BF_GLOBALS._player, &scene->_object1, NULL);
+ BF_GLOBALS.clearFlag(fCrateOpen);
+ }
+ } else {
+ scene->_sceneMode = 9205;
+ scene->setAction(&scene->_sequenceManager1, scene, 9205, &BF_GLOBALS._player, NULL);
+ }
+ } else {
+ scene->_sceneMode = 9202;
+ scene->setAction(&scene->_sequenceManager1, scene, 9202, &BF_GLOBALS._player, &scene->_object1, NULL);
+ BF_GLOBALS.setFlag(fCrateOpen);
+ }
+ return true;
+ break;
+ default:
+ return NamedHotspot::startAction(action, event);
+ break;
+ }
+}
+
+// North Exit
+bool Scene920::Item8::startAction(CursorType action, Event &event) {
+ Scene920 *scene = (Scene920 *)BF_GLOBALS._sceneManager._scene;
+
+ BF_GLOBALS._player.disableControl();
+ if (BF_GLOBALS._player._visage == 921) {
+ scene->_sceneMode = 10;
+ scene->setAction(&scene->_sequenceManager1, scene, 9206, &BF_GLOBALS._player, NULL);
+ // TO BE CHECKED: Original code uses a variable to store the address of scene instance.
+ // As it's used later a coordinates to create a playermover, I don't understand.
+ // On the other hand, it's not really important as just after the hero leaves the scene
+ // so the variable is no longer used.
+ // scene->_oldCoord = &scene;
+ _field10 = 1;
+ } else {
+ scene->_sceneMode = 9201;
+ scene->setAction(&scene->_sequenceManager1, scene, 9201, &BF_GLOBALS._player, NULL);
+ }
+ return true;
+}
+
+void Scene920::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(920);
+
+ _stripManager.addSpeaker(&_gameTextSpeaker);
+ _stripManager.addSpeaker(&_jakeJacketSpeaker);
+ if (BF_GLOBALS._dayNumber == 0)
+ BF_GLOBALS._dayNumber = 4;
+ BF_GLOBALS._player.postInit();
+ if (BF_GLOBALS._v4CEC8 != 0) {
+ _object3.postInit();
+ _object3.setVisage(922);
+ _object3.setStrip(2);
+ _object3.fixPriority(1);
+ _object3.setPosition(Common::Point(145, 82));
+ }
+
+ _object1.postInit();
+ _object1.setVisage(922);
+ if (BF_GLOBALS.getFlag(fCrateOpen)) {
+ _object1.setStrip(3);
+ _object1.setFrame(5);
+ }
+
+ _object1.setPosition(Common::Point(158, 107));
+ _object1.setPriority(130);
+ _exitN.setDetails(Rect(116, 12, 165, 81), 920, -1, -1, -1, 1, NULL);
+ _item6.setDetails(6, 920, 15, 16, 17, 1);
+ _item4.setDetails(5, 920, 12, 13, 14, 1);
+ _item7.setDetails(4, 920, 9, 10, 11, 1);
+ _item5.setDetails(3, 920, 6, 7, 8, 1);
+ _crate.setDetails(2, 920, 3, 4, 5, 1);
+ _item3.setDetails(1, 920, 3, 4, 5, 1);
+ _item2.setDetails(Rect(0, 0, 320, 200), 920, 0, 1, 2, 1, NULL);
+
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 9200;
+ setAction(&_sequenceManager1, this, 9200, &BF_GLOBALS._player, NULL);
+}
+
+void Scene920::signal() {
+ switch (_sceneMode) {
+ case 10:
+ _sceneMode = 9201;
+ setAction(&_sequenceManager1, this, 9201, &BF_GLOBALS._player, NULL);
+ break;
+ case 9201:
+ if (BF_GLOBALS.getFlag(fCrateOpen))
+ BF_GLOBALS.setFlag(fLeftTraceIn920);
+ else
+ BF_GLOBALS.clearFlag(fLeftTraceIn920);
+ BF_GLOBALS._sceneManager.changeScene(910);
+ break;
+ case 9204:
+ _object2.remove();
+ BF_GLOBALS.setFlag(fSawGuns);
+ BF_GLOBALS._player.enableControl();
+ break;
+ case 9206: {
+ BF_GLOBALS._player.enableControl();
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &_oldCoord, NULL);
+ break;
+ }
+ case 9207:
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_INVENTORY.setObjectScene(15, 1);
+ BF_GLOBALS._bookmark = bEndDayThree;
+ break;
+ default:
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+void Scene920::process(Event &event) {
+ SceneExt::process(event);
+ if (BF_GLOBALS._player._enabled && !_focusObject && (event.mousePos.y < (BF_INTERFACE_Y - 1))) {
+ if (_exitN.contains(event.mousePos)) {
+ GfxSurface surface = _cursorVisage.getFrame(EXITFRAME_N);
+ BF_GLOBALS._events.setCursor(surface);
+ } else {
+ CursorType cursorId = BF_GLOBALS._events.getCursor();
+ BF_GLOBALS._events.setCursor(cursorId);
+ }
+ }
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (BF_GLOBALS._events.getCursor() == CURSOR_WALK) && (BF_GLOBALS._player._visage == 921)) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 9206;
+ setAction(&_sequenceManager1, this, 9206, &BF_GLOBALS._player, NULL);
+ _oldCoord = event.mousePos;
+ event.handled = true;
+ }
+}
+
+void Scene920::dispatch() {
+ SceneExt::dispatch();
+ if ((_action == 0) && (BF_GLOBALS._player._position.y < 75)) {
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._sceneManager.changeScene(910);
+ }
+}
+
+void Scene920::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_oldCoord.x);
+ s.syncAsSint16LE(_oldCoord.y);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 930 - Inside the caravan
+ *
+ *--------------------------------------------------------------------------*/
+/* Objects */
+bool Scene930::Object1::startAction(CursorType action, Event &event) {
+// Small box
+ Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
+ bool result;
+
+ if ((action == CURSOR_USE) && (!BF_GLOBALS.getFlag(93))) {
+ scene->setAction(&scene->_action2);
+ result = true;
+ } else
+ result = NamedObject::startAction(action, event);
+
+ return result;
+}
+
+bool Scene930::Object2::startAction(CursorType action, Event &event) {
+ Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action != CURSOR_USE)
+ return NamedObject::startAction(action, event);
+
+ NamedObject::startAction(action, event);
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_INVENTORY.setObjectScene(54, 1);
+ BF_GLOBALS.setFlag(93);
+ remove();
+ scene->_box.remove();
+ return true;
+}
+
+bool Scene930::Object3::startAction(CursorType action, Event &event) {
+// Boots
+ Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
+
+ if (action != CURSOR_USE)
+ return NamedObject::startAction(action, event);
+
+ if (scene->_v141C == 0)
+ scene->setAction(&scene->_action1);
+ return true;
+}
+
+bool Scene930::Object4::startAction(CursorType action, Event &event) {
+// Boot window
+ Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_WALK:
+ return true;
+ case CURSOR_LOOK:
+ if (BF_GLOBALS._bookmark >= bFlashBackTwo) {
+ _lookLineNum = 94;
+ return NamedObject::startAction(action, event);
+ } else {
+ BF_GLOBALS._player.disableControl();
+ NamedObject::startAction(action, event);
+ BF_GLOBALS._bookmark = bFlashBackTwo;
+ scene->_sceneMode = 2;
+ scene->signal();
+ return true;
+ }
+ break;
+ case CURSOR_USE:
+ if (BF_GLOBALS._bookmark >= bFlashBackTwo) {
+ _lookLineNum = 71;
+ NamedObject::startAction(action, event);
+ scene->subF3D6F();
+ remove();
+ } else
+ NamedObject::startAction(action, event);
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ break;
+ }
+}
+
+bool Scene930::Object5::startAction(CursorType action, Event &event) {
+ Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (action) {
+ case CURSOR_WALK:
+ return true;
+ case CURSOR_USE:
+ if (BF_INVENTORY.getObjectScene(55) == 1)
+ return NamedObject::startAction(action, event);
+ if (scene->_v141A == 0) {
+ animate(ANIM_MODE_4, getFrameCount() - 1, 1, NULL);
+ scene->_v141A = 1;
+ _lookLineNum = 76;
+ _useLineNum = 78;
+ } else {
+ BF_GLOBALS._uiElements.addScore(50);
+ BF_INVENTORY.setObjectScene(55, 1);
+ setFrame2(getFrameCount());
+ _lookLineNum = 92;
+ _useLineNum = -1;
+ }
+ return true;
+ default:
+ return NamedObject::startAction(action, event);
+ break;
+ }
+}
+/* Items */
+bool Scene930::Item1::startAction(CursorType action, Event &event) {
+ Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
+
+ if ((action == CURSOR_WALK) || (action == CURSOR_USE)) {
+ BF_GLOBALS._player.disableControl();
+ scene->_sceneMode = 1;
+ scene->setAction(&scene->_sequenceManager1, scene, 9301, &BF_GLOBALS._player, NULL);
+ return true;
+ } else
+ return NamedHotspot::startAction(action, event);
+}
+
+/* Actions */
+void Scene930::Action1::signal() {
+ Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(10);
+ BF_GLOBALS._player.disableControl();
+ scene->_v141C = 1;
+ break;
+ case 1: {
+ Common::Point pt(50, 142);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, this);
+ break;
+ }
+ case 2:
+ BF_GLOBALS._player.changeAngle(270);
+ setDelay(10);
+ break;
+ case 3:
+ BF_GLOBALS._player.changeZoom(110);
+ BF_GLOBALS._player.setVisage(931);
+ BF_GLOBALS._player.setStrip(1);
+ BF_GLOBALS._player.setFrame(1);
+ BF_GLOBALS._player.animate(ANIM_MODE_4, 4, 1, this);
+ break;
+ case 4:
+ scene->_boots.setFrame(2);
+ BF_GLOBALS._player.animate(ANIM_MODE_5, this);
+ break;
+ case 5:
+ scene->showBootWindow();
+ if (!BF_GLOBALS.getFlag(72)) {
+ BF_GLOBALS._uiElements.addScore(30);
+ BF_GLOBALS.setFlag(72);
+ }
+ SceneItem::display(0, 312);
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+void Scene930::Action2::signal() {
+ Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(10);
+ BF_GLOBALS._player.disableControl();
+ break;
+ case 1: {
+ Common::Point pt(176, 137);
+ PlayerMover *mover = new PlayerMover();
+ BF_GLOBALS._player.addMover(mover, &pt, this);
+ break;
+ }
+ case 2:
+ setDelay(10);
+ break;
+ case 3:
+ SceneItem::display(930, scene->_box._useLineNum, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + BF_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ scene->subF3C07();
+ BF_GLOBALS._player.enableControl();
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene930::Action3::signal() {
+ Scene930 *scene = (Scene930 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex++) {
+ case 0:
+ BF_GLOBALS._player.disableControl();
+ BF_GLOBALS._player.animate(ANIM_MODE_4, 4, -1, this);
+ break;
+ case 1:
+ scene->_boots.setFrame(1);
+ BF_GLOBALS._player.animate(ANIM_MODE_6, this);
+ break;
+ case 2:
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.setVisage(368);
+ BF_GLOBALS._player.setStrip(6);
+ BF_GLOBALS._player.setFrame(1);
+ scene->_v141C = 0;
+ remove();
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.enableControl();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene930::postInit(SceneObjectList *OwnerList) {
+ PalettedScene::postInit();
+ loadScene(930);
+
+ BF_GLOBALS._sound1.changeSound(85);
+ if (BF_GLOBALS._dayNumber == 0)
+ BF_GLOBALS._dayNumber = 1;
+ setZoomPercents(83, 75, 140, 100);
+ _v141A = 0;
+ _v141C = 0;
+ if (BF_INVENTORY.getObjectScene(54) != 1) {
+ _box.postInit();
+ _box.setVisage(930);
+ _box.setStrip(1);
+ _box.setPosition(Common::Point(223, 21));
+ _box.setDetails(930, 66, 67, 68, 1, NULL);
+ }
+ _boots.postInit();
+ _boots.setVisage(930);
+ _boots.setStrip(2);
+ _boots.setPosition(Common::Point(9, 161));
+ _boots.fixPriority(120);
+ _boots.setDetails(930, 62, 63, 64, 1, NULL);
+
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(368);
+ BF_GLOBALS._player.setObjectWrapper(new SceneObjectWrapper());
+ BF_GLOBALS._player.animate(ANIM_MODE_1, NULL);
+ BF_GLOBALS._player.setPosition(Common::Point(170, 92));
+ BF_GLOBALS._player.fixPriority(80);
+ BF_GLOBALS._player.changeZoom(-1);
+ BF_GLOBALS._player.enableControl();
+
+ _item1.setDetails( 1, 930, 0, 1, 2, 1);
+ _item2.setDetails( 2, 930, 4, 5, 6, 1);
+ _item3.setDetails( 3, 930, 8, 9, 10, 1);
+ _item4.setDetails( 4, 930, 12, 13, 14, 1);
+ _item5.setDetails( 5, 930, 16, 17, 18, 1);
+ _item6.setDetails( 20, 930, 20, 21, 22, 1);
+ _item7.setDetails( 6, 930, 23, 24, 25, 1);
+ _item8.setDetails( 7, 930, 26, 27, 28, 1);
+ _item21.setDetails( 8, 930, 89, 90, 91, 1);
+ _item9.setDetails( 9, 930, 29, 30, 31, 1);
+ _item20.setDetails(10, 930, 86, 87, 88, 1);
+ _item10.setDetails(11, 930, 33, 34, 35, 1);
+ _item11.setDetails(12, 930, 37, 38, 39, 1);
+ _item13.setDetails(13, 930, 40, 41, 42, 1);
+ _item14.setDetails(14, 930, 44, 45, 46, 1);
+ _item15.setDetails(15, 930, 48, 49, 50, 1);
+ _item16.setDetails(16, 930, 52, 53, 54, 1);
+ _item17.setDetails(17, 930, 56, 57, 58, 1);
+ _item12.setDetails(18, 930, 59, 60, 61, 1);
+ _item18.setDetails(19, 930, 80, 81, 82, 1);
+ _item19.setDetails(21, 930, 83, 84, 85, 1);
+
+ if (BF_GLOBALS._sceneManager._previousScene != 935) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager1, this, 9300, &BF_GLOBALS._player, NULL);
+ } else {
+ _v141C = 1;
+ BF_GLOBALS._player.animate(ANIM_MODE_NONE);
+ BF_GLOBALS._player.setPosition(Common::Point(50, 142));
+ BF_GLOBALS._player.setVisage(931);
+ BF_GLOBALS._player.setStrip(1);
+ BF_GLOBALS._player.setFrame(9);
+ BF_GLOBALS._player.fixPriority(-1);
+ BF_GLOBALS._player.enableControl();
+ BF_GLOBALS._player.changeZoom(110);
+ _boots.setFrame(2);
+ showBootWindow();
+ }
+
+}
+
+void Scene930::signal() {
+ static uint32 v50EC4 = 0;
+
+ switch (_sceneMode++) {
+ case 1:
+ BF_GLOBALS._sceneManager.changeScene(550);
+ break;
+ case 2:
+ _sceneMode = 3;
+ SceneItem::display(930, 95, SET_WIDTH, 312,
+ SET_X, GLOBALS._sceneManager._scene->_sceneBounds.left + 4,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + BF_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+ signal();
+ break;
+ case 3:
+ _sceneMode = 4;
+ addFader((const byte *)&v50EC4, 5, this);
+ break;
+ case 4:
+ BF_GLOBALS._sceneManager.changeScene(935);
+ break;
+ default:
+ BF_GLOBALS._player.enableControl();
+ break;
+ }
+}
+
+void Scene930::dispatch() {
+ SceneExt::dispatch();
+}
+
+void Scene930::showBootWindow() {
+ _bootsWindow.postInit();
+ _bootsWindow.setVisage(930);
+ _bootsWindow.setStrip(3);
+ _bootsWindow.setFrame2(1);
+ _bootsWindow.fixPriority(260);
+ _bootsWindow.setPosition(Common::Point(147, 128));
+ _bootsWindow.setDetails(930, 69, 70, 93);
+}
+
+void Scene930::subF3C07() {
+ _object2.postInit();
+ _object2.setVisage(930);
+ _object2.setStrip(1);
+ _object2.setFrame2(2);
+ _object2.fixPriority(260);
+ _object2.setPosition(Common::Point(147, 128));
+ _object2.setDetails(930, 73, 74, 75);
+}
+
+void Scene930::subF3D6F() {
+ _object5.postInit();
+ _object5.setVisage(930);
+ _object5.setStrip(3);
+ if (BF_INVENTORY.getObjectScene(55) == 1) {
+ _object5.setFrame(_object5.getFrameCount());
+ _object5.setDetails(930, 92, 77, -1);
+ } else if (_v141A == 0) {
+ _object5.setFrame(2);
+ _object5.setDetails(930, 93, 77, -1);
+ } else {
+ _object5.setFrame(_object5.getFrameCount());
+ _object5.setDetails(930, 76, 77, 78);
+ }
+
+ _object5.fixPriority(260);
+ _object5.setPosition(Common::Point(147, 128));
+}
+
+void Scene930::synchronize(Serializer &s) {
+ SceneExt::synchronize(s);
+ s.syncAsSint16LE(_v141A);
+ s.syncAsSint16LE(_v141C);
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 935 - Hidden in the wardrobe
+ *
+ *--------------------------------------------------------------------------*/
+
+void Scene935::Action1::signal() {
+ Scene935 *scene = (Scene935 *)BF_GLOBALS._sceneManager._scene;
+ static uint32 v50ECC = 0, v50EEA = 0, v50EEE = 0, v50F26 = 0, v50F2A = 0, v50F62 = 0, v50F66 = 0, v50F6A = 0;
+
+ switch (_actionIndex++) {
+ case 0:
+ scene->addFader((const byte *)&v50ECC, 100, this);
+ break;
+ case 1:
+ scene->_visualSpeaker.setText("Jake! Hide in the closet!");
+ for (int i = 1; i < 21; i++)
+ scene->sub15E4F((const byte *)&v50EEA, 5 * i, 935, NULL, 0, 255, 249, 255, 1);
+ setDelay(3);
+ break;
+ case 2:
+ scene->addFader((const byte *)&v50EEE, 5, this);
+ break;
+ case 3:
+ scene->_visualSpeaker.removeText();
+ scene->_visualSpeaker._textPos.y = scene->_sceneBounds.top + 80;
+ scene->_visualSpeaker._color1 = 252;
+ scene->_visualSpeaker._color1 = 251;
+ scene->_visualSpeaker.setText("Jake! Hide in the closet!");
+ setDelay(3);
+ break;
+ case 4:
+ scene->_visualSpeaker.setText("Jake! Hide in the closet!");
+ for (int i = 1; i < 21; i++)
+ scene->sub15E4F((const byte *)&v50F26, 5 * i, 935, NULL, 0, 255, 249, 255, 1);
+ setDelay(3);
+ break;
+ case 5:
+ scene->addFader((const byte *)&v50F2A, 5, this);
+ break;
+ case 6:
+ scene->_visualSpeaker.removeText();
+ scene->_visualSpeaker._textPos.y = scene->_sceneBounds.top + 150;
+ scene->_visualSpeaker._color1 = 250;
+ scene->_visualSpeaker._color1 = 249;
+ scene->_visualSpeaker.setText("Jake! Hide in the closet!");
+ setDelay(3);
+ break;
+ case 7:
+ scene->_visualSpeaker.setText("Jake! Hide in the closet!");
+ for (int i = 1; i < 21; i++)
+ scene->sub15E4F((const byte *)&v50F62, 5 * i, 935, NULL, 0, 255, 249, 255, 1);
+ setDelay(3);
+ break;
+ case 8:
+ scene->addFader((const byte *)&v50F66, 5, this);
+ break;
+ case 9:
+ scene->_visualSpeaker.removeText();
+ setDelay(3);
+ break;
+ case 10:
+ scene->_sceneMode = 1;
+ scene->add2Faders((const byte *)&v50F6A, 5, 935, scene);
+ remove();
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene935::postInit(SceneObjectList *OwnerList) {
+ PalettedScene::postInit();
+ loadScene(935);
+
+ BF_GLOBALS._interfaceY = 200;
+ BF_GLOBALS._player.disableControl();
+ _visualSpeaker._textMode = ALIGN_CENTER;
+ _visualSpeaker._hideObjects = false;
+ _visualSpeaker._color1 = 254;
+ _visualSpeaker._color2 = 253;
+ _visualSpeaker._textPos.y = _sceneBounds.top + 18;
+ _visualSpeaker._textWidth = 300;
+ _visualSpeaker._textPos.x = _sceneBounds.left + 10;
+ setAction(&_action1);
+ BF_GLOBALS._sound1.fadeSound(67);
+}
+
+void Scene935::remove() {
+ BF_GLOBALS._sound1.fadeOut2(NULL);
+ BF_GLOBALS._scrollFollower = &BF_GLOBALS._player;
+ PalettedScene::remove();
+}
+
+void Scene935::signal() {
+ static uint32 v50EC8 = 0;
+
+ switch (_sceneMode) {
+ case 1:
+ _object1.postInit();
+ if (BF_GLOBALS._sceneManager._previousScene == 810) {
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 9352;
+ setAction(&_sequenceManager, this, 9350, &_object1, NULL);
+ } else if (BF_GLOBALS._sceneManager._previousScene == 930) {
+ _object3.postInit();
+ _object3.setVisage(938);
+ _object3.fixPriority(255);
+ _object3.setPosition(Common::Point(260, -4));
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 0;
+ setAction(&_sequenceManager, this, 9354, &_object1, &_object3, NULL);
+ } else {
+ _sceneMode = 9351;
+ setAction(&_sequenceManager, this, 9350, &_object1, NULL);
+ }
+ break;
+ case 2:
+ BF_GLOBALS._sound1.play(68);
+ _sceneMode = 0;
+ addFader((const byte *)&v50EC8, 5, this);
+ break;
+ case 3:
+ _sceneMode = 2;
+ _object1.animate(ANIM_MODE_6, NULL);
+ signal();
+ break;
+ case 9351:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 2;
+ setAction(&_sequenceManager, this, 9351, &_object1, NULL);
+ if (BF_GLOBALS._sceneManager._previousScene == 910)
+ _sceneMode = 9353;
+ break;
+ case 9352:
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 2;
+ setAction(&_sequenceManager, this, 9352, &_object1, NULL);
+ break;
+ case 9353:
+ _object2.postInit();
+ BF_GLOBALS._player.disableControl();
+ _sceneMode = 3;
+ setAction(&_sequenceManager, this, 9353, &_object1, &_object2, NULL);
+ break;
+ default:
+ BF_GLOBALS._sceneManager.changeScene(BF_GLOBALS._sceneManager._previousScene);
+ break;
+ }
+}
+
+void Scene935::dispatch() {
+ SceneExt::dispatch();
+}
+
+/*--------------------------------------------------------------------------
+ * Scene 940 - ?
+ *
+ *--------------------------------------------------------------------------*/
+
+bool Scene940::Item1::startAction(CursorType action, Event &event) {
+ return true;
+}
+
+void Scene940::Action1::signal() {
+ Scene940 *scene = (Scene940 *)BF_GLOBALS._sceneManager._scene;
+
+ switch (_actionIndex) {
+ case 0:
+ _actionIndex = 2;
+ setDelay(60);
+ break;
+ case 2:
+ _actionIndex = 941;
+ if (BF_GLOBALS.getFlag(fBackupAt340))
+ scene->_stripManager.start(9408, this);
+ else
+ scene->_stripManager.start(9400, this);
+ break;
+ case 5:
+ setActionIndex(948);
+ setDelay(90);
+ scene->_object2.remove();
+ scene->_object3.remove();
+ scene->_object4.remove();
+ scene->_object5.remove();
+ scene->_object6.remove();
+ scene->_object7.remove();
+ scene->_object8.remove();
+ scene->_object9.remove();
+ scene->_object10.remove();
+ break;
+ case 99:
+ BF_GLOBALS._sound1.play(117);
+ BF_GLOBALS._sceneManager.changeScene(100);
+ remove();
+ break;
+ case 941:
+ scene->_gameTextSpeaker1._textWidth = 312;
+ _actionIndex = 944;
+ setAction(&scene->_sequenceManager1, this, 941, &BF_GLOBALS._player, NULL);
+ break;
+ case 942:
+ _actionIndex = 955;
+ setAction(&scene->_sequenceManager1, this, 942, &scene->_object2, NULL);
+ break;
+ case 943:
+ _actionIndex = 946;
+ setAction(&scene->_sequenceManager1, this, 943, &scene->_object3, NULL);
+ break;
+ case 944:
+ scene->_object4.setAction(&scene->_sequenceManager2, NULL, 944, &scene->_object4, &scene->_object5);
+ _actionIndex = 945;
+ setDelay(3);
+ break;
+ case 945:
+ scene->_object6.setAction(&scene->_sequenceManager3, NULL, 945, &scene->_object6, &scene->_object10, NULL);
+ _actionIndex = 943;
+ setDelay(3);
+ break;
+ case 946:
+ _actionIndex = 942;
+ setAction(&scene->_sequenceManager1, this, 946, &scene->_object7, &scene->_object8, NULL);
+ break;
+ case 947:
+ _actionIndex = 5;
+ setAction(&scene->_sequenceManager1, this, 947, &scene->_object1, &scene->_object11, &scene->_object12, &scene->_object13, NULL);
+ break;
+ case 948:
+ scene->_gameTextSpeaker1._textPos.x = scene->_sceneBounds.left + 10;
+ scene->_object17.postInit();
+ scene->_object17.hide();
+ scene->_object18.postInit();
+ scene->_object18.hide();
+ _actionIndex = 960;
+ setAction(&scene->_sequenceManager1, this, 948, &scene->_object11, &scene->_object12, &scene->_object13, &scene->_object1, &scene->_object14, NULL);
+ break;
+ case 949:
+ _actionIndex = 950;
+ setAction(&scene->_sequenceManager1, this, 949, &scene->_object17, &scene->_object18, &scene->_object1, &scene->_object12, &scene->_object13, &scene->_object15, NULL);
+ scene->_object11.setAction(&scene->_sequenceManager2, NULL, 952, &scene->_object11, NULL);
+ break;
+ case 950:
+ _actionIndex = 951;
+ setAction(&scene->_sequenceManager1, this, 950, &scene->_object17, &scene->_object18, &scene->_object1, &scene->_object13, &scene->_object16, NULL);
+ scene->_object12.setAction(&scene->_sequenceManager3, NULL, 953, &scene->_object12, NULL);
+ break;
+ case 951:
+ scene->_object13.setAction(&scene->_sequenceManager4, NULL, 954, &scene->_object13, NULL);
+ scene->_object11.setAction(&scene->_sequenceManager2, NULL, 952, &scene->_object11, NULL);
+ scene->_stripManager.start(9407, this);
+ setActionIndex(99);
+ break;
+ case 955:
+ scene->_object2.remove();
+ _actionIndex = 956;
+ setAction(&scene->_sequenceManager1, this, 955, &BF_GLOBALS._player, NULL);
+ break;
+ case 956:
+ _actionIndex = 947;
+ setAction(&scene->_sequenceManager1, this, 956, &scene->_object3, NULL);
+ scene->_object11.postInit();
+ scene->_object11.setVisage(943);
+ scene->_object11.setStrip(1);
+ scene->_object11.setPosition(Common::Point(-8, 178));
+ scene->_object12.postInit();
+ scene->_object12.setVisage(942);
+ scene->_object12.setStrip(1);
+ scene->_object12.setPosition(Common::Point(-41, 181));
+ scene->_object13.postInit();
+ scene->_object13.setVisage(944);
+ scene->_object13.setStrip(2);
+ scene->_object13.setPosition(Common::Point(-74, 179));
+ scene->_object1.postInit();
+ scene->_object1.setVisage(948);
+ scene->_object1.setStrip(2);
+ scene->_object1.setPosition(Common::Point(-107, 180));
+ scene->_object14.postInit();
+ scene->_object14.setVisage(949);
+ scene->_object14.setStrip(1);
+ scene->_object14.setFrame(3);
+ scene->_object14.setPosition(Common::Point(234, 75));
+ scene->_object15.postInit();
+ scene->_object15.setVisage(949);
+ scene->_object15.setStrip(1);
+ scene->_object15.setFrame(2);
+ scene->_object15.setPosition(Common::Point(144, 76));
+ scene->_object16.postInit();
+ scene->_object16.setVisage(949);
+ scene->_object16.setStrip(1);
+ scene->_object16.setFrame(1);
+ scene->_object16.setPosition(Common::Point(45, 77));
+ break;
+ case 960:
+ _actionIndex = 949;
+ setAction(&scene->_sequenceManager1, this, 960, &scene->_object11, &scene->_object17, &scene->_object18, &scene->_object1, &scene->_object14, NULL);
+ break;
+ default:
+ break;
+ }
+}
+
+void Scene940::postInit(SceneObjectList *OwnerList) {
+ SceneExt::postInit();
+ loadScene(940);
+
+ BF_GLOBALS._sound1.play(115);
+ BF_GLOBALS._dayNumber = 6;
+ BF_GLOBALS._interfaceY = 200;
+ BF_GLOBALS._uiElements._active = false;
+
+ _gameTextSpeaker2._speakerName = "SENTTEXT";
+ _gameTextSpeaker2._color1 = 104;
+ _gameTextSpeaker2._textMode = ALIGN_CENTER;
+ _stripManager.addSpeaker(&_gameTextSpeaker1);
+ _stripManager.addSpeaker(&_gameTextSpeaker2);
+ BF_GLOBALS._player.postInit();
+ BF_GLOBALS._player.setVisage(941);
+ BF_GLOBALS._player.setStrip(1);
+ BF_GLOBALS._player.setFrame(7);
+ BF_GLOBALS._player.setPosition(Common::Point(563, 80));
+ BF_GLOBALS._player.disableControl();
+ _object3.postInit();
+ _object3.setVisage(944);
+ _object3.setStrip(3);
+ _object3.setFrame(3);
+ _object3.setPosition(Common::Point(626, 78));
+ _object3.fixPriority(0);
+ _object2.postInit();
+ _object2.setVisage(944);
+ _object2.setStrip(3);
+ _object2.setFrame(6);
+ _object2.setPosition(Common::Point(378, 136));
+ _object2.setZoom(80);
+ _object2.fixPriority(0);
+ _object4.postInit();
+ _object4.setVisage(945);
+ _object4.setStrip(6);
+ _object4.setPosition(Common::Point(361, 70));
+ _object4.setZoom(80);
+ _object4.fixPriority(0);
+ _object5.postInit();
+ _object5.setVisage(945);
+ _object5.setStrip(7);
+ _object5.setPosition(Common::Point(366, 39));
+ _object5.setZoom(80);
+ _object5.fixPriority(3);
+ _object6.postInit();
+ _object6.setVisage(945);
+ _object6.setStrip(4);
+ _object6.setPosition(Common::Point(432, 70));
+ _object6.setZoom(65);
+ _object6.fixPriority(0);
+ _object7.postInit();
+ _object7.setVisage(945);
+ _object7.setStrip(1);
+ _object7.setPosition(Common::Point(423, 131));
+ _object7.setZoom(65);
+ _object7.fixPriority(0);
+ _object8.postInit();
+ _object8.setVisage(945);
+ _object8.setStrip(2);
+ _object8.setPosition(Common::Point(420, 99));
+ _object8.setZoom(65);
+ _object8.fixPriority(3);
+ _object9.postInit();
+ _object9.setVisage(945);
+ _object9.setStrip(3);
+ _object9.setPosition(Common::Point(458, 65));
+ _object9.setZoom(55);
+ _object9.fixPriority(0);
+ _object10.postInit();
+ _object10.setVisage(945);
+ _object10.setStrip(3);
+ _object10.setFrame(2);
+ _object10.setPosition(Common::Point(465, 118));
+ _object10.setZoom(55);
+ _object10.fixPriority(0);
+ _item1.setBounds(Rect(0, 0, 320, 200));
+ BF_GLOBALS._sceneItems.push_back(&_item1);
+ _sceneBounds.moveTo(320, 0);
+ _gameTextSpeaker1._textPos.x = _sceneBounds.left + 10;
+ _gameTextSpeaker1._color1 = 16;
+ _gameTextSpeaker1._textWidth = 265;
+ setAction(&_action1);
+}
+
+void Scene940::remove() {
+ // clearScren();
+ BF_GLOBALS._scrollFollower = &BF_GLOBALS._player;
+ SceneExt::remove();
+ BF_GLOBALS._uiElements._active = true;
+}
+
+} // End of namespace BlueForce
+} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_scenes9.h b/engines/tsage/blue_force/blueforce_scenes9.h
new file mode 100644
index 0000000000..f4f2c6e779
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_scenes9.h
@@ -0,0 +1,318 @@
+/* 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.
+ *
+ */
+
+#ifndef TSAGE_BLUEFORCE_SCENES9_H
+#define TSAGE_BLUEFORCE_SCENES9_H
+
+#include "common/scummsys.h"
+#include "tsage/blue_force/blueforce_logic.h"
+#include "tsage/blue_force/blueforce_speakers.h"
+#include "tsage/converse.h"
+#include "tsage/events.h"
+#include "tsage/core.h"
+#include "tsage/scenes.h"
+#include "tsage/globals.h"
+#include "tsage/sound.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+using namespace TsAGE;
+
+class Scene900: public PalettedScene {
+ /* Items */
+ class Item1: public NamedHotspot {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Item4: public NamedHotspot {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ /* Objects */
+ class Object1: public NamedObject {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Object2: public NamedObjectExt {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Object3: public NamedObjectExt {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Object6: public NamedObject {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Object7: public NamedObject {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+
+ /* Actions */
+ class Action1 : public Action {
+ public:
+ void signal();
+ };
+ class Action2 : public Action {
+ public:
+ void signal();
+ };
+ class Action3 : public Action {
+ public:
+ void signal();
+ };
+ class Action4 : public Action {
+ public:
+ void signal();
+ };
+
+public:
+ SequenceManager _sequenceManager1, _sequenceManager2;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+ SpeakerLyleHat _lyleHatSpeaker;
+ Item1 _item1;
+ Object1 _object1;
+ Object2 _object2;
+ Object3 _object3;
+ NamedHotspot _item2;
+ NamedHotspot _item3;
+ NamedObject _object4;
+ NamedObject _object5;
+ Object6 _lyle;
+ Object7 _object7;
+ Item4 _item4;
+ ASoundExt _sound1;
+ Action1 _action1;
+ Action2 _action2;
+ Action3 _action3;
+ Action4 _action4;
+ int _field1974;
+ int _field1976;
+
+ Scene900();
+ void postInit(SceneObjectList *OwnerList = NULL);
+ void signal();
+ void process(Event &event);
+ void dispatch();
+ void synchronize(Serializer &s);
+};
+
+class Scene920: public SceneExt {
+ /* Items */
+ class Item1: public NamedHotspot {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Item8: public NamedHotspot {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+
+public:
+ SequenceManager _sequenceManager1;
+ SpeakerGameText _gameTextSpeaker;
+ SpeakerJakeJacket _jakeJacketSpeaker;
+
+ Item1 _crate;
+ NamedHotspot _item2;
+ NamedHotspot _item3;
+ NamedHotspot _item4;
+ NamedHotspot _item5;
+ NamedHotspot _item6;
+ NamedHotspot _item7;
+ NamedObject _object1;
+ NamedObject _object2;
+ NamedObject _object3;
+ Item8 _exitN;
+ Common::Point _oldCoord;
+
+ void postInit(SceneObjectList *OwnerList = NULL);
+ void signal();
+ void process(Event &event);
+ void dispatch();
+ void synchronize(Serializer &s);
+};
+
+class Scene930: public PalettedScene {
+ /* Objects */
+ class Object1: public NamedObject {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Object2: public FocusObject {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Object3: public NamedObject {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Object4: public FocusObject {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ class Object5: public FocusObject {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ /* Items */
+ class Item1: public NamedHotspot {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ /* Actions */
+ class Action1 : public Action {
+ public:
+ void signal();
+ };
+ class Action2 : public Action {
+ public:
+ void signal();
+ };
+ class Action3 : public Action {
+ public:
+ void signal();
+ };
+
+ void showBootWindow();
+ void subF3C07();
+ void subF3D6F();
+public:
+ SequenceManager _sequenceManager1;
+ Object1 _box;
+ Object2 _object2;
+ Object3 _boots;
+ Object4 _bootsWindow;
+ Object5 _object5;
+
+ Item1 _item1;
+ NamedHotspot _item2;
+ NamedHotspot _item3;
+ NamedHotspot _item4;
+ NamedHotspot _item5;
+ NamedHotspot _item6;
+ NamedHotspot _item7;
+ NamedHotspot _item8;
+ NamedHotspot _item9;
+ NamedHotspot _item10;
+ NamedHotspot _item11;
+ NamedHotspot _item12;
+ NamedHotspot _item13;
+ NamedHotspot _item14;
+ NamedHotspot _item15;
+ NamedHotspot _item16;
+ NamedHotspot _item17;
+ NamedHotspot _item18;
+ NamedHotspot _item19;
+ NamedHotspot _item20;
+ NamedHotspot _item21;
+
+ Action1 _action1;
+ Action2 _action2;
+ Action3 _action3;
+
+ SpeakerGameText gameTextSpeaker;
+
+ int _v141A;
+ int _v141C;
+
+ void postInit(SceneObjectList *OwnerList = NULL);
+ void signal();
+ void dispatch();
+ void synchronize(Serializer &s);
+};
+
+class Scene935: public PalettedScene {
+ /* Actions */
+ class Action1 : public Action {
+ public:
+ void signal();
+ };
+
+public:
+ SequenceManager _sequenceManager;
+ NamedObject _object1;
+ NamedObject _object2;
+ NamedObject _object3;
+ Action1 _action1;
+ VisualSpeaker _visualSpeaker;
+
+ void postInit(SceneObjectList *OwnerList = NULL);
+ void remove();
+ void signal();
+ void dispatch();
+};
+
+class Scene940: public SceneExt {
+ /* Items */
+ class Item1: public NamedHotspot {
+ public:
+ bool startAction(CursorType action, Event &event);
+ };
+ /* Actions */
+ class Action1 : public Action {
+ public:
+ void signal();
+ };
+
+public:
+ SequenceManager _sequenceManager1;
+ SequenceManager _sequenceManager2;
+ SequenceManager _sequenceManager3;
+ SequenceManager _sequenceManager4;
+ NamedObject _object1;
+ NamedObject _object2;
+ NamedObject _object3;
+ NamedObject _object4;
+ NamedObject _object5;
+ NamedObject _object6;
+ NamedObject _object7;
+ NamedObject _object8;
+ NamedObject _object9;
+ NamedObject _object10;
+ NamedObject _object11;
+ NamedObject _object12;
+ NamedObject _object13;
+ NamedObject _object14;
+ NamedObject _object15;
+ NamedObject _object16;
+ NamedObject _object17;
+ NamedObject _object18;
+ Item1 _item1;
+ Action1 _action1;
+
+ SpeakerGameText _gameTextSpeaker1;
+ SpeakerGameText _gameTextSpeaker2;
+
+ void postInit(SceneObjectList *OwnerList = NULL);
+ void remove();
+};
+
+} // End of namespace BlueForce
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/blue_force/blueforce_speakers.cpp b/engines/tsage/blue_force/blueforce_speakers.cpp
new file mode 100644
index 0000000000..0f506c7122
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_speakers.cpp
@@ -0,0 +1,970 @@
+/* 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 "tsage/blue_force/blueforce_speakers.h"
+#include "tsage/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/graphics.h"
+#include "tsage/staticres.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+VisualSpeaker::VisualSpeaker(): Speaker() {
+ _textWidth = 312;
+ _color1 = 19;
+ _hideObjects = false;
+ _removeObject1 = false;
+ _removeObject2 = false;
+ _xp = 160;
+ _fontNumber = 4;
+ _color2 = 82;
+ _offsetPos = Common::Point(4, 170);
+ _numFrames = 0;
+}
+
+void VisualSpeaker::remove() {
+ if (_removeObject2)
+ _object2.remove();
+ if (_removeObject1)
+ _object1.remove();
+
+ Speaker::remove();
+}
+
+void VisualSpeaker::synchronize(Serializer &s) {
+ Speaker::synchronize(s);
+
+ s.syncAsByte(_removeObject1);
+ s.syncAsByte(_removeObject2);
+ s.syncAsSint16LE(_xp);
+ s.syncAsSint16LE(_numFrames);
+ s.syncAsSint16LE(_offsetPos.x);
+ s.syncAsSint16LE(_offsetPos.y);
+}
+
+void VisualSpeaker::proc12(Action *action) {
+ Speaker::proc12(action);
+ _textPos = Common::Point(_offsetPos.x + BF_GLOBALS._sceneManager._scene->_sceneBounds.left,
+ _offsetPos.y + BF_GLOBALS._sceneManager._scene->_sceneBounds.top);
+ _numFrames = 0;
+}
+
+void VisualSpeaker::setText(const Common::String &msg) {
+ _objectList.draw();
+ BF_GLOBALS._sceneObjects->draw();
+
+ _sceneText._color1 = _color1;
+ _sceneText._color2 = _color2;
+ _sceneText._color3 = _color3;
+ _sceneText._width = _textWidth;
+ _sceneText._fontNumber = _fontNumber;
+ _sceneText._textMode = _textMode;
+ _sceneText.setup(msg);
+
+ // Get the string bounds
+ GfxFont f;
+ f.setFontNumber(_fontNumber);
+ Rect bounds;
+ f.getStringBounds(msg.c_str(), bounds, _textWidth);
+
+ // Set the position for the text
+ switch (_textMode) {
+ case ALIGN_LEFT:
+ case ALIGN_JUSTIFIED:
+ _sceneText.setPosition(_textPos);
+ break;
+ case ALIGN_CENTER:
+ _sceneText.setPosition(Common::Point(_textPos.x + (_textWidth - bounds.width()) / 2, _textPos.y));
+ break;
+ case ALIGN_RIGHT:
+ _sceneText.setPosition(Common::Point(_textPos.x + _textWidth - bounds.width(), _textPos.y));
+ break;
+ default:
+ break;
+ }
+
+ // Ensure the text is in the foreground
+ _sceneText.fixPriority(256);
+
+ // Count the number of words (by spaces) in the string
+ const char *s = msg.c_str();
+ int spaceCount = 0;
+ while (*s) {
+ if (*s++ == ' ')
+ ++spaceCount;
+ }
+
+ _numFrames = spaceCount * 3 + 2;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerGameText::SpeakerGameText(): VisualSpeaker() {
+ _speakerName = "GAMETEXT";
+ _color1 = 8;
+ _color2 = 19;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerSutter::SpeakerSutter() {
+ _speakerName = "SUTTER";
+ _color1 = 20;
+ _color2 = 22;
+ _textMode = ALIGN_CENTER;
+}
+
+void SpeakerSutter::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(329);
+ _object1.setStrip2(2);
+ _object1.fixPriority(254);
+ _object1.changeZoom(100);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 45,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(329);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 45,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerDoug::SpeakerDoug(): VisualSpeaker() {
+ _color1 = 32;
+ _speakerName = "DOUG";
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerJakeNoHead::SpeakerJakeNoHead(): VisualSpeaker() {
+ _color1 = 13;
+ _speakerName = "JAKE_NO_HEAD";
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerHarrison::SpeakerHarrison(): VisualSpeaker() {
+ _color1 = 32;
+ _speakerName = "HARRISON";
+}
+
+void SpeakerHarrison::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(325);
+ _object1.setStrip2(7);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 277,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.fixPriority(255);
+ _object2.setVisage(325);
+ _object2.setStrip2(6);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 277,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerJake::SpeakerJake(): VisualSpeaker() {
+ _color1 = 13;
+ _color2 = 7;
+ _speakerName = "JAKE";
+}
+
+void SpeakerJake::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(1001);
+ _object1.setStrip2(2);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 38,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(1001);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 38,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerJakeJacket::SpeakerJakeJacket(): VisualSpeaker() {
+ _color1 = 13;
+ _color2 = 7;
+ _speakerName = "JAKEJACKET";
+}
+
+void SpeakerJakeJacket::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(1001);
+ _object1.setStrip2(4);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + _xp,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(1001);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + _xp,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerJakeUniform::SpeakerJakeUniform(): VisualSpeaker() {
+ _color1 = 13;
+ _color2 = 7;
+ _speakerName = "JAKEUNIFORM";
+}
+
+void SpeakerJakeUniform::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(1001);
+ _object1.setStrip2(3);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 45,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(1001);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 45,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerJailer::SpeakerJailer(): VisualSpeaker() {
+ _color1 = 13;
+ _color2 = 7;
+ _speakerName = "JAILER";
+}
+
+void SpeakerJailer::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(395);
+ _object1.setStrip(6);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(395);
+ _object2.setStrip(5);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerGreen::SpeakerGreen(): VisualSpeaker() {
+ _color1 = 96;
+ _color2 = 99;
+ _speakerName = "GREEN";
+}
+
+void SpeakerGreen::setText(const Common::String &msg) {
+ _removeObject2 = true;
+
+ _object2.postInit();
+ _object2.setVisage(373);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerPSutter::SpeakerPSutter(): VisualSpeaker() {
+ _color1 = 20;
+ _color2 = 22;
+ _speakerName = "PSUTTER";
+}
+
+void SpeakerPSutter::setText(const Common::String &msg) {
+ _removeObject2 = true;
+
+ _object2.postInit();
+ _object2.setVisage(335);
+ _object2.setStrip2(3);
+ _object2.fixPriority(200);
+ _object2.setPosition(Common::Point(202, 48));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerJakeRadio::SpeakerJakeRadio(): VisualSpeaker() {
+ _color1 = 13;
+ _color2 = 7;
+ _speakerName = "JAKE_RADIO";
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerLyleHat::SpeakerLyleHat(): VisualSpeaker() {
+ _color1 = 29;
+ _color2 = 89;
+ _xp = 75;
+ _speakerName = "LYLEHAT";
+}
+
+void SpeakerLyleHat::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(278);
+ _object1.setStrip2(4);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + _xp,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(278);
+ _object2.setStrip2(2);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + _xp,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerJordan::SpeakerJordan(): VisualSpeaker() {
+ _color1 = 96;
+ _color2 = 93;
+ _speakerName = "JORDAN";
+}
+
+void SpeakerJordan::setText(const Common::String &msg) {
+ _removeObject2 = true;
+
+ _object2.postInit();
+ _object2.setVisage(344);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 78));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerSkip::SpeakerSkip(): VisualSpeaker() {
+ _color1 = 80;
+ _color2 = 82;
+ _speakerName = "SKIP";
+}
+
+void SpeakerSkip::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(345);
+ _object1.setStrip2(4);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 282,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(345);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 282,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerSkipB::SpeakerSkipB(): VisualSpeaker() {
+ _color1 = 80;
+ _color2 = 82;
+ _speakerName = "SKIPB";
+}
+
+void SpeakerSkipB::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(347);
+ _object1.setStrip2(2);
+ _object1.setFrame2(3);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 37,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(347);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 37,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerCarter::SpeakerCarter(): VisualSpeaker() {
+ _color1 = 89;
+ _color2 = 95;
+ _speakerName = "CARTER";
+}
+
+void SpeakerCarter::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(844);
+ _object1.setStrip2(8);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(78, 166));
+
+ _object2.postInit();
+ _object2.setVisage(844);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(78, 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerDriver::SpeakerDriver(): VisualSpeaker() {
+ _color1 = 43;
+ _color2 = 70;
+ _speakerName = "DRIVER";
+}
+
+void SpeakerDriver::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(416);
+ _object1.setStrip2(8);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 263,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(416);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 263,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerShooter::SpeakerShooter(): VisualSpeaker() {
+ _color1 = 43;
+ _color2 = 70;
+ _speakerName = "SHOOTER";
+}
+
+void SpeakerShooter::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(418);
+ _object1.setStrip2(7);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 268,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(418);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 268,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerJim::SpeakerJim(): VisualSpeaker() {
+ _color1 = 32;
+ _speakerName = "JIM";
+}
+
+void SpeakerJim::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(385);
+ _object1.setStrip(7);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(262, 166));
+
+ _object2.postInit();
+ _object2.setVisage(385);
+ _object2.setStrip2(6);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(262, 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerDezi::SpeakerDezi(): VisualSpeaker() {
+ _color1 = 21;
+ _speakerName = "DEZI";
+}
+
+void SpeakerDezi::setText(const Common::String &msg) {
+ _removeObject2 = true;
+
+ _object2.postInit();
+ _object2.setVisage(385);
+ _object2.setStrip2(5);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(252, 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerJake385::SpeakerJake385(): VisualSpeaker() {
+ _color1 = 13;
+ _speakerName = "JAKE_385";
+}
+
+void SpeakerJake385::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(1001);
+ _object1.setStrip2(BF_GLOBALS.getFlag(onDuty) ? 3 : 4);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(42, 166));
+
+ _object2.postInit();
+ _object2.setVisage(1001);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(42, 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerLaura::SpeakerLaura(): VisualSpeaker() {
+ _color1 = 97;
+ _color2 = 105;
+ _speakerName = "LAURA";
+}
+
+void SpeakerLaura::setText(const Common::String &msg) {
+ _removeObject2 = true;
+
+ _object2.postInit();
+ _object2.setVisage(345);
+ _object2.setStrip2(2);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 38,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerLauraHeld::SpeakerLauraHeld(): VisualSpeaker() {
+ _color1 = 97;
+ _color2 = 105;
+ _speakerName = "LAURAHELD";
+}
+
+void SpeakerLauraHeld::setText(const Common::String &msg) {
+ _removeObject2 = true;
+
+ _object2.postInit();
+ _object2.setVisage(374);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 120,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 120));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerEugene::SpeakerEugene(): VisualSpeaker() {
+ _color1 = 20;
+ _color2 = 22;
+ _speakerName = "EUGENE";
+}
+
+void SpeakerEugene::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(465);
+ _object1.setStrip2(3);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(465);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerWeasel::SpeakerWeasel(): VisualSpeaker() {
+ _color1 = 8;
+ _color2 = 5;
+ _speakerName = "WEASEL";
+}
+
+void SpeakerWeasel::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(464);
+ _object1.setStrip2(3);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(464);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerBilly::SpeakerBilly(): VisualSpeaker() {
+ _color1 = 20;
+ _color2 = 22;
+ _speakerName = "BILLY";
+}
+
+void SpeakerBilly::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(463);
+ _object1.setStrip2(7);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(463);
+ _object2.setStrip2(6);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 40,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 167));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerDrunk::SpeakerDrunk(): VisualSpeaker() {
+ _color1 = 21;
+ _speakerName = "DRUNK";
+}
+
+void SpeakerDrunk::setText(const Common::String &msg) {
+ _removeObject2 = true;
+
+ _object2.postInit();
+ _object2.setVisage(556);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 52,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerGiggles::SpeakerGiggles(): VisualSpeaker() {
+ _color1 = 32;
+
+ _speakerName = "GIGGLES";
+}
+
+void SpeakerGiggles::setText(const Common::String &msg) {
+ _removeObject2 = true;
+
+ _object2.postInit();
+ _object2.setVisage(557);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 262,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerFBI::SpeakerFBI(): VisualSpeaker() {
+ _color1 = 27;
+ _color2 = 89;
+
+ _speakerName = "FBI";
+}
+
+void SpeakerFBI::setText(const Common::String &msg) {
+ _removeObject2 = true;
+
+ _object2.postInit();
+ _object2.setVisage(837);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 267,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerNico::SpeakerNico(): VisualSpeaker() {
+ _color1 = 105;
+ _color2 = 102;
+
+ _speakerName = "NICO";
+}
+
+void SpeakerNico::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(905);
+ _object1.setStrip2(2);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 262,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(905);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 262,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerDA::SpeakerDA(): VisualSpeaker() {
+ _color1 = 82;
+ _color2 = 80;
+
+ _speakerName = "DA";
+}
+
+void SpeakerDA::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(915);
+ _object1.setStrip2(8);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 84,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(915);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 84,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerGrandma::SpeakerGrandma(): VisualSpeaker() {
+ _color1 = 20;
+ _color2 = 23;
+
+ _speakerName = "GRANDMA";
+}
+
+void SpeakerGrandma::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(274);
+ _object1.setStrip2(4);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 43,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(274);
+ _object2.setStrip2(3);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 43,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerLyle::SpeakerLyle(): VisualSpeaker() {
+ _color1 = 29;
+ _color2 = 89;
+
+ _speakerName = "LYLE";
+}
+
+void SpeakerLyle::setText(const Common::String &msg) {
+ _removeObject1 = _removeObject2 = true;
+
+ _object1.postInit();
+ _object1.setVisage(278);
+ _object1.setStrip2(3);
+ _object1.fixPriority(254);
+ _object1.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 75,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ _object2.postInit();
+ _object2.setVisage(278);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(BF_GLOBALS._sceneManager._scene->_sceneBounds.left + 75,
+ BF_GLOBALS._sceneManager._scene->_sceneBounds.top + 166));
+
+ VisualSpeaker::setText(msg);
+ _object2.fixCountdown(8, _numFrames);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerGranText::SpeakerGranText(): VisualSpeaker() {
+ _color1 = 20;
+ _color2 = 23;
+
+ _speakerName = "GRANTEXT";
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerLyleText::SpeakerLyleText(): VisualSpeaker() {
+ _color1 = 29;
+ _color2 = 89;
+
+ _speakerName = "LYLETEXT";
+}
+
+} // End of namespace BlueForce
+
+} // End of namespace TsAGE
diff --git a/engines/tsage/blue_force/blueforce_speakers.h b/engines/tsage/blue_force/blueforce_speakers.h
new file mode 100644
index 0000000000..932c3c311f
--- /dev/null
+++ b/engines/tsage/blue_force/blueforce_speakers.h
@@ -0,0 +1,344 @@
+/* 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.
+ *
+ */
+
+#ifndef TSAGE_BLUEFORCE_SPEAKERS_H
+#define TSAGE_BLUEFORCE_SPEAKERS_H
+
+#include "common/scummsys.h"
+#include "tsage/converse.h"
+#include "tsage/events.h"
+#include "tsage/core.h"
+#include "tsage/scenes.h"
+#include "tsage/globals.h"
+#include "tsage/blue_force/blueforce_logic.h"
+
+namespace TsAGE {
+
+namespace BlueForce {
+
+using namespace TsAGE;
+
+class VisualSpeaker: public Speaker {
+public:
+ NamedObject _object1;
+ CountdownObject _object2;
+ bool _removeObject1, _removeObject2;
+ int _xp;
+ int _numFrames;
+ Common::Point _offsetPos;
+public:
+ VisualSpeaker();
+
+ virtual Common::String getClassName() { return "VisualSpeaker"; }
+ virtual void synchronize(Serializer &s);
+ virtual void remove();
+ virtual void proc12(Action *action);
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerGameText: public VisualSpeaker {
+public:
+ SpeakerGameText();
+
+ virtual Common::String getClassName() { return "SpeakerGameText"; }
+};
+
+class SpeakerSutter: public VisualSpeaker {
+public:
+ SpeakerSutter();
+
+ virtual Common::String getClassName() { return "SpeakerSutter"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerDoug: public VisualSpeaker {
+public:
+ SpeakerDoug();
+
+ virtual Common::String getClassName() { return "SpeakerDoug"; }
+};
+
+class SpeakerJakeNoHead: public VisualSpeaker {
+public:
+ SpeakerJakeNoHead();
+
+ virtual Common::String getClassName() { return "SpeakerJakeNoHead"; }
+};
+
+class SpeakerHarrison: public VisualSpeaker {
+public:
+ SpeakerHarrison();
+
+ virtual Common::String getClassName() { return "SpeakerHarrison"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerJake: public VisualSpeaker {
+public:
+ SpeakerJake();
+
+ virtual Common::String getClassName() { return "SpeakerJake"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerJakeJacket: public VisualSpeaker {
+public:
+ SpeakerJakeJacket();
+
+ virtual Common::String getClassName() { return "SpeakerJakeJacket"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerJakeUniform: public VisualSpeaker {
+public:
+ SpeakerJakeUniform();
+
+ virtual Common::String getClassName() { return "SpeakerJakeUniform"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerJailer: public VisualSpeaker {
+public:
+ SpeakerJailer();
+
+ virtual Common::String getClassName() { return "SpeakerJailer"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerGreen: public VisualSpeaker {
+public:
+ SpeakerGreen();
+
+ virtual Common::String getClassName() { return "SpeakerGreen"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerPSutter: public VisualSpeaker {
+public:
+ SpeakerPSutter();
+
+ virtual Common::String getClassName() { return "SpeakerPSutter"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerJakeRadio: public VisualSpeaker {
+public:
+ SpeakerJakeRadio();
+
+ virtual Common::String getClassName() { return "SpeakerJakeRadio"; }
+};
+
+class SpeakerLyleHat: public VisualSpeaker {
+public:
+ SpeakerLyleHat();
+
+ virtual Common::String getClassName() { return "SpeakerLyleHat"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerJordan: public VisualSpeaker {
+public:
+ SpeakerJordan();
+
+ virtual Common::String getClassName() { return "SpeakerJordan"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerSkip: public VisualSpeaker {
+public:
+ SpeakerSkip();
+
+ virtual Common::String getClassName() { return "SpeakerSkip"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerSkipB: public VisualSpeaker {
+public:
+ SpeakerSkipB();
+
+ virtual Common::String getClassName() { return "SpeakerSkipB"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerCarter: public VisualSpeaker {
+public:
+ SpeakerCarter();
+
+ virtual Common::String getClassName() { return "SpeakerCarter"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerDriver: public VisualSpeaker {
+public:
+ SpeakerDriver();
+
+ virtual Common::String getClassName() { return "SpeakerDriver"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerShooter: public VisualSpeaker {
+public:
+ SpeakerShooter();
+
+ virtual Common::String getClassName() { return "SpeakerShooter"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerJim: public VisualSpeaker {
+public:
+ SpeakerJim();
+
+ virtual Common::String getClassName() { return "SpeakerJim"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerDezi: public VisualSpeaker {
+public:
+ SpeakerDezi();
+
+ virtual Common::String getClassName() { return "SpeakerDezi"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerJake385: public VisualSpeaker {
+public:
+ SpeakerJake385();
+
+ virtual Common::String getClassName() { return "SpeakerJake385"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerLaura: public VisualSpeaker {
+public:
+ SpeakerLaura();
+
+ virtual Common::String getClassName() { return "SpeakerLaura"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerLauraHeld: public VisualSpeaker {
+public:
+ SpeakerLauraHeld();
+
+ virtual Common::String getClassName() { return "SpeakerLaura"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerEugene: public VisualSpeaker {
+public:
+ SpeakerEugene();
+
+ virtual Common::String getClassName() { return "SpeakerEugene"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerWeasel: public VisualSpeaker {
+public:
+ SpeakerWeasel();
+
+ virtual Common::String getClassName() { return "SpeakerWeasel"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerBilly: public VisualSpeaker {
+public:
+ SpeakerBilly();
+
+ virtual Common::String getClassName() { return "SpeakerBilly"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerDrunk: public VisualSpeaker {
+public:
+ SpeakerDrunk();
+
+ virtual Common::String getClassName() { return "SpeakerDrunk"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerGiggles: public VisualSpeaker {
+public:
+ SpeakerGiggles();
+
+ virtual Common::String getClassName() { return "SpeakerGiggles"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerFBI: public VisualSpeaker {
+public:
+ SpeakerFBI();
+
+ virtual Common::String getClassName() { return "FBI"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerNico: public VisualSpeaker {
+public:
+ SpeakerNico();
+
+ virtual Common::String getClassName() { return "NICO"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerDA: public VisualSpeaker {
+public:
+ SpeakerDA();
+
+ virtual Common::String getClassName() { return "DA"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerGrandma: public VisualSpeaker {
+public:
+ SpeakerGrandma();
+
+ virtual Common::String getClassName() { return "SpeakerGrandma"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerLyle: public VisualSpeaker {
+public:
+ SpeakerLyle();
+
+ virtual Common::String getClassName() { return "SpeakerLyle"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerGranText: public VisualSpeaker {
+public:
+ SpeakerGranText();
+
+ virtual Common::String getClassName() { return "SpeakerGranText"; }
+};
+
+class SpeakerLyleText: public VisualSpeaker {
+public:
+ SpeakerLyleText();
+
+ virtual Common::String getClassName() { return "SpeakerLyleText"; }
+};
+
+} // End of namespace BlueForce
+
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/blue_force/blueforce_ui.cpp b/engines/tsage/blue_force/blueforce_ui.cpp
index e27c744486..fb4008d2c1 100644
--- a/engines/tsage/blue_force/blueforce_ui.cpp
+++ b/engines/tsage/blue_force/blueforce_ui.cpp
@@ -21,6 +21,7 @@
*/
#include "tsage/blue_force/blueforce_ui.h"
+#include "tsage/blue_force/blueforce_dialogs.h"
#include "tsage/blue_force/blueforce_logic.h"
#include "tsage/tsage.h"
#include "tsage/core.h"
@@ -29,8 +30,15 @@ namespace TsAGE {
namespace BlueForce {
+void StripProxy::process(Event &event) {
+ if (_action)
+ _action->process(event);
+}
+
+/*--------------------------------------------------------------------------*/
+
void UIElement::synchronize(Serializer &s) {
- AltSceneObject::synchronize(s);
+ BackgroundSceneObject::synchronize(s);
s.syncAsSint16LE(_field88);
s.syncAsSint16LE(_enabled);
s.syncAsSint16LE(_frameNum);
@@ -55,7 +63,7 @@ void UIElement::setEnabled(bool flag) {
void UIQuestion::process(Event &event) {
if (event.eventType == EVENT_BUTTON_DOWN) {
- int currentCursor = GLOBALS._events.getCursor();
+ CursorType currentCursor = GLOBALS._events.getCursor();
GLOBALS._events.hideCursor();
showDescription(currentCursor);
@@ -63,12 +71,13 @@ void UIQuestion::process(Event &event) {
}
}
-void UIQuestion::showDescription(int lineNum) {
- if (lineNum == 8) {
- // Unknown object description
+void UIQuestion::showDescription(CursorType cursor) {
+ if (cursor == INV_FOREST_RAP) {
+ // Forest rap item has a graphical display
+ showItem(5, 1, 1);
} else {
// Display object description
- SceneItem::display2(9001, lineNum);
+ SceneItem::display2(9001, (int)cursor);
}
}
@@ -79,17 +88,44 @@ void UIQuestion::setEnabled(bool flag) {
}
}
+void UIQuestion::showItem(int resNum, int rlbNum, int frameNum) {
+ GfxDialog::setPalette();
+
+ // Get the item to display
+ GfxSurface objImage = surfaceFromRes(resNum, rlbNum, frameNum);
+ Rect imgRect;
+ imgRect.resize(objImage, 0, 0, 100);
+ imgRect.center(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);
+
+ // Save the area behind where the image will be displayed
+ GfxSurface *savedArea = Surface_getArea(BF_GLOBALS.gfxManager().getSurface(), imgRect);
+
+ // Draw the image
+ BF_GLOBALS.gfxManager().copyFrom(objImage, imgRect);
+
+ // Wait for a press
+ BF_GLOBALS._events.waitForPress();
+
+ // Restore the old area
+ BF_GLOBALS.gfxManager().copyFrom(*savedArea, imgRect);
+ delete savedArea;
+}
+
/*--------------------------------------------------------------------------*/
void UIScore::postInit(SceneObjectList *OwnerList) {
int xp = 266;
- _digit3.setup(1, 6, 1, 266, 180, 255);
+ _digit3.setup(1, 6, 1, xp, 180, 255);
+ _digit3.reposition();
xp += 7;
- _digit2.setup(1, 6, 1, 266, 180, 255);
+ _digit2.setup(1, 6, 1, xp, 180, 255);
+ _digit2.reposition();
xp += 7;
- _digit1.setup(1, 6, 1, 266, 180, 255);
+ _digit1.setup(1, 6, 1, xp, 180, 255);
+ _digit1.reposition();
xp += 7;
- _digit0.setup(1, 6, 1, 266, 180, 255);
+ _digit0.setup(1, 6, 1, xp, 180, 255);
+ _digit0.reposition();
}
void UIScore::draw() {
@@ -101,37 +137,46 @@ void UIScore::draw() {
void UIScore::updateScore() {
int score = BF_GLOBALS._uiElements._scoreValue;
-
- _digit3.setFrame(score / 1000); score %= 1000;
- _digit2.setFrame(score / 100); score %= 100;
- _digit1.setFrame(score / 10); score %= 10;
- _digit0.setFrame(score);
+
+ _digit3.setFrame(score / 1000 + 1); score %= 1000;
+ _digit2.setFrame(score / 100 + 1); score %= 100;
+ _digit1.setFrame(score / 10 + 1); score %= 10;
+ _digit0.setFrame(score + 1);
}
/*--------------------------------------------------------------------------*/
UIInventorySlot::UIInventorySlot(): UIElement() {
_objIndex = 0;
+ _object = NULL;
}
void UIInventorySlot::synchronize(Serializer &s) {
UIElement::synchronize(s);
s.syncAsSint16LE(_objIndex);
+ SYNC_POINTER(_object);
}
void UIInventorySlot::process(Event &event) {
if (event.eventType == EVENT_BUTTON_DOWN) {
event.handled = true;
- if (_objIndex == 66) {
- // Handle showing gun and ammo
- warning("TODO: show gun");
- } else if (_objIndex != 0) {
- GLOBALS._events.setCursor((CursorType)_objIndex);
+ if (_objIndex == INV_AMMO_BELT) {
+ // Handle showing ammo belt
+ showAmmoBelt();
+
+ } else if (_objIndex != INV_NONE) {
+ _object->setCursor();
}
}
}
+void UIInventorySlot::showAmmoBelt() {
+ AmmoBeltDialog *dlg = new AmmoBeltDialog();
+ dlg->execute();
+ delete dlg;
+}
+
/*--------------------------------------------------------------------------*/
UIInventoryScroll::UIInventoryScroll() {
@@ -144,9 +189,30 @@ void UIInventoryScroll::synchronize(Serializer &s) {
}
void UIInventoryScroll::process(Event &event) {
- if (event.eventType == EVENT_BUTTON_DOWN) {
- warning("TODO: UIInventoryScroll::process");
+ switch (event.eventType) {
+ case EVENT_BUTTON_DOWN:
+ // Draw the button as selected
+ toggle(true);
+
event.handled = true;
+ break;
+ case EVENT_BUTTON_UP:
+ // Restore unselected version
+ toggle(false);
+
+ // Scroll the inventory as necessary
+ BF_GLOBALS._uiElements.scrollInventory(_isLeft);
+ event.handled = true;
+ break;
+ default:
+ break;
+ }
+}
+
+void UIInventoryScroll::toggle(bool pressed) {
+ if (_enabled) {
+ setFrame(pressed ? (_frameNum + 1) : _frameNum);
+ BF_GLOBALS._uiElements.draw();
}
}
@@ -155,7 +221,7 @@ void UIInventoryScroll::process(Event &event) {
UICollection::UICollection(): EventHandler() {
_clearScreen = false;
_visible = false;
- _field4E = 0;
+ _cursorChanged = false;
}
void UICollection::setup(const Common::Point &pt) {
@@ -169,10 +235,16 @@ void UICollection::hide() {
_visible = false;
}
+void UICollection::show() {
+ _visible = true;
+ draw();
+}
+
void UICollection::erase() {
if (_clearScreen) {
Rect tempRect(0, BF_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT);
- GLOBALS._screenSurface.fillRect(tempRect, 0);
+ BF_GLOBALS._screenSurface.fillRect(tempRect, 0);
+ BF_GLOBALS._sceneManager._scene->_backSurface.fillRect(tempRect, 0);
_clearScreen = false;
}
}
@@ -183,30 +255,89 @@ void UICollection::resetClear() {
void UICollection::draw() {
if (_visible) {
- // Draw the elements
+ // Draw the elements onto the background
for (uint idx = 0; idx < _objList.size(); ++idx)
_objList[idx]->draw();
- // Update the screen
- g_system->updateScreen();
+ // Draw the resulting UI onto the screen
+ BF_GLOBALS._screenSurface.copyFrom(BF_GLOBALS._sceneManager._scene->_backSurface,
+ Rect(0, BF_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT),
+ Rect(0, BF_INTERFACE_Y, SCREEN_WIDTH, SCREEN_HEIGHT));
+
_clearScreen = 1;
}
}
/*--------------------------------------------------------------------------*/
+UIElements::UIElements(): UICollection() {
+ _cursorVisage.setVisage(1, 5);
+ g_saver->addLoadNotifier(&UIElements::loadNotifierProc);
+}
+
+void UIElements::synchronize(Serializer &s) {
+ UICollection::synchronize(s);
+
+ s.syncAsSint16LE(_slotStart);
+ s.syncAsSint16LE(_scoreValue);
+ s.syncAsByte(_active);
+
+ int count = _itemList.size();
+ s.syncAsSint16LE(count);
+ if (s.isLoading()) {
+ // Load in item list
+ _itemList.clear();
+
+ for (int idx = 0; idx < count; ++idx) {
+ int itemId;
+ s.syncAsSint16LE(itemId);
+ _itemList.push_back(itemId);
+ }
+ } else {
+ // Save item list
+ for (int idx = 0; idx < count; ++idx) {
+ int itemId = _itemList[idx];
+ s.syncAsSint16LE(itemId);
+ }
+ }
+}
+
void UIElements::process(Event &event) {
- if (_clearScreen && BF_GLOBALS._player._field8E && (BF_GLOBALS._sceneManager._sceneNumber != 50)) {
+ if (_clearScreen && BF_GLOBALS._player._enabled && (BF_GLOBALS._sceneManager._sceneNumber != 50)) {
if (_bounds.contains(event.mousePos)) {
+ // Cursor inside UI area
+ if (!_cursorChanged) {
+ if (BF_GLOBALS._events.isInventoryIcon()) {
+ // Inventory icon being displayed, so leave alone
+ } else {
+ // Change to the inventory use cursor
+ GfxSurface surface = _cursorVisage.getFrame(6);
+ BF_GLOBALS._events.setCursor(surface);
+ }
+ _cursorChanged = true;
+ }
+
+ // Pass event to any element that the cursor falls on
+ for (int idx = (int)_objList.size() - 1; idx >= 0; --idx) {
+ if (_objList[idx]->_bounds.contains(event.mousePos) && _objList[idx]->_enabled) {
+ _objList[idx]->process(event);
+ if (event.handled)
+ break;
+ }
+ }
- } else if (_field4E) {
- BF_GLOBALS._events.hideCursor();
- BF_GLOBALS._events.setCursor((CursorType)1);
- _field4E = 0;
+ if (event.eventType == EVENT_BUTTON_DOWN)
+ event.handled = true;
+
+ } else if (_cursorChanged) {
+ // Cursor outside UI area, so reset as necessary
+ BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor());
+ _cursorChanged = false;
SceneExt *scene = (SceneExt *)BF_GLOBALS._sceneManager._scene;
- if (scene->_eventHandler) {
- error("TODO: UIElements::process _eventHandler");
+ if (scene->_focusObject) {
+ GfxSurface surface = _cursorVisage.getFrame(7);
+ BF_GLOBALS._events.setCursor(surface);
}
}
}
@@ -216,7 +347,7 @@ void UIElements::setup(const Common::Point &pt) {
_slotStart = 0;
_itemList.clear();
_scoreValue = 0;
- _field820 = 1;
+ _active = true;
UICollection::setup(pt);
hide();
@@ -224,6 +355,7 @@ void UIElements::setup(const Common::Point &pt) {
add(&_object1);
// Set up the inventory slots
+ int xp = 0;
for (int idx = 0; idx < 4; ++idx) {
UIElement *item = NULL;
switch (idx) {
@@ -241,14 +373,16 @@ void UIElements::setup(const Common::Point &pt) {
break;
}
- item->setup(9, 1, idx, idx * 63 + 2, 4, 255);
+ xp = idx * 63 + 2;
+ item->setup(9, 1, idx, xp, 4, 255);
add(item);
}
// Setup bottom-right hand buttons
- int xp = 62;
+ xp += 62;
_question.setup(1, 4, 7, xp, 16, 255);
_question.setEnabled(false);
+ add(&_question);
xp += 21;
_scrollLeft.setup(1, 4, 1, xp, 16, 255);
@@ -271,11 +405,13 @@ void UIElements::setup(const Common::Point &pt) {
}
void UIElements::add(UIElement *obj) {
- // Add object
+ // Add object
assert(_objList.size() < 12);
_objList.push_back(obj);
- obj->setPosition(Common::Point(_bounds.left + obj->_bounds.left, _bounds.top + obj->_bounds.top));
+ obj->setPosition(Common::Point(_bounds.left + obj->_position.x, _bounds.top + obj->_position.y));
+ obj->reposition();
+
GfxSurface s = obj->getFrame();
s.draw(obj->_position);
}
@@ -285,10 +421,10 @@ void UIElements::add(UIElement *obj) {
*/
void UIElements::updateInventory() {
_score.updateScore();
- updateInvList();
+ updateInvList();
// Enable scroll buttons if the player has more than four items
- if (_itemCount > 4) {
+ if (_itemList.size() > 4) {
_scrollLeft.setEnabled(true);
_scrollRight.setEnabled(true);
} else {
@@ -297,28 +433,31 @@ void UIElements::updateInventory() {
}
// Handle cropping the slots start within inventory
- int last = (_itemList.size() - 1) / 4 + 1;
+ int lastPage = (_itemList.size() - 1) / 4 + 1;
if (_slotStart < 0)
- _slotStart = last - 1;
- else if (_slotStart > (last - 1))
+ _slotStart = lastPage - 1;
+ else if (_slotStart > (lastPage - 1))
_slotStart = 0;
// Handle refreshing slot graphics
UIInventorySlot *slotList[4] = { &_slot1, &_slot2, &_slot3, &_slot4 };
-
+
+ // Loop through the inventory objects
SynchronizedList<InvObject *>::iterator i;
int objIndex = 0;
- for (i = BLUE_INVENTORY._itemList.begin(); i != BLUE_INVENTORY._itemList.end(); ++i, ++objIndex) {
+ for (i = BF_INVENTORY._itemList.begin(); i != BF_INVENTORY._itemList.end(); ++i, ++objIndex) {
InvObject *obj = *i;
+ // Check whether the object is in any of the four inventory slots
for (int slotIndex = 0; slotIndex < 4; ++slotIndex) {
- int idx = _slotStart + slotIndex;
+ int idx = _slotStart * 4 + slotIndex;
int objectIdx = (idx < (int)_itemList.size()) ? _itemList[idx] : 0;
if (objectIdx == objIndex) {
UIInventorySlot *slot = slotList[slotIndex];
slot->_objIndex = objIndex;
+ slot->_object = obj;
slot->setVisage(obj->_visage);
slot->setStrip(obj->_strip);
slot->setFrame(obj->_frame);
@@ -326,7 +465,8 @@ void UIElements::updateInventory() {
}
}
- if (_field820)
+ // Refresh the display if necessary
+ if (_active)
draw();
}
@@ -347,19 +487,30 @@ void UIElements::updateInvList() {
}
/**
- * Updates an inventory slot with the item to be displayed
-
-void UIElements::updateInvSlot(UIInventorySlot *slot, int objIndex) {
- slot->_objIndex = objIndex;
- int itemId = (objIndex < (int)_itemList.size()) ? _itemList[objIndex] : 0;
- InvObject *obj = BF_GLOBALS._inventory->_itemList[itemId + 2];
-
- // TODO: Validate usage of fields
- slot->setVisage(obj._displayResNum);
- slot->setStrip(obj._rlbNum);
- slot->setFrame(obj._cursorNum);
-}
-*/
+ * Set the game score
+ */
+void UIElements::addScore(int amount) {
+ _scoreValue += amount;
+ BF_GLOBALS._sound2.play(0);
+ updateInventory();
+}
+
+/*
+ * Scroll the inventory slots
+ */
+void UIElements::scrollInventory(bool isLeft) {
+ if (isLeft)
+ --_slotStart;
+ else
+ ++_slotStart;
+
+ updateInventory();
+}
+
+void UIElements::loadNotifierProc(bool postFlag) {
+ if (postFlag && BF_GLOBALS._uiElements._active)
+ BF_GLOBALS._uiElements.show();
+}
} // End of namespace BlueForce
diff --git a/engines/tsage/blue_force/blueforce_ui.h b/engines/tsage/blue_force/blueforce_ui.h
index 15e7a760d9..601b97a9fe 100644
--- a/engines/tsage/blue_force/blueforce_ui.h
+++ b/engines/tsage/blue_force/blueforce_ui.h
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
#include "tsage/core.h"
+#include "tsage/graphics.h"
#include "tsage/sound.h"
namespace TsAGE {
@@ -33,7 +34,12 @@ namespace BlueForce {
using namespace TsAGE;
-class UIElement: public AltSceneObject {
+class StripProxy: public EventHandler {
+public:
+ virtual void process(Event &event);
+};
+
+class UIElement: public BackgroundSceneObject {
public:
int _field88;
bool _enabled;
@@ -49,7 +55,8 @@ public:
// This class implements the Question mark button
class UIQuestion: public UIElement {
private:
- void showDescription(int lineNum);
+ void showDescription(CursorType item);
+ void showItem(int resNum, int rlbNum, int frameNum);
public:
virtual void process(Event &event);
void setEnabled(bool flag);
@@ -64,13 +71,16 @@ public:
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void draw();
-
+
void updateScore();
};
class UIInventorySlot: public UIElement {
+private:
+ void showAmmoBelt();
public:
int _objIndex;
+ InvObject *_object;
UIInventorySlot();
virtual Common::String getClassName() { return "UIInventorySlot"; }
@@ -79,6 +89,8 @@ public:
};
class UIInventoryScroll: public UIElement {
+private:
+ void toggle(bool pressed);
public:
bool _isLeft;
@@ -96,12 +108,13 @@ public:
Rect _bounds;
bool _visible;
bool _clearScreen;
- int _field4E;
+ bool _cursorChanged;
Common::Array<UIElement *> _objList;
UICollection();
void setup(const Common::Point &pt);
void hide();
+ void show();
void resetClear();
void draw();
};
@@ -109,7 +122,6 @@ public:
class UIElements: public UICollection {
private:
void add(UIElement *obj);
- void updateInventory();
void updateInvList();
public:
UIElement _object1;
@@ -118,14 +130,23 @@ public:
UIInventorySlot _slot1, _slot2, _slot3, _slot4;
UIInventoryScroll _scrollLeft, _scrollRight;
ASound _sound;
- int _itemCount, _slotStart, _scoreValue;
- bool _field820;
+ int _slotStart, _scoreValue;
+ bool _active;
Common::Array<int> _itemList;
+ Visage _cursorVisage;
+ UIElements();
+ virtual Common::String getClassName() { return "UIElements"; }
+ virtual void synchronize(Serializer &s);
virtual void postInit(SceneObjectList *OwnerList = NULL) { error("Wrong init() called"); }
virtual void process(Event &event);
void setup(const Common::Point &pt);
+ void updateInventory();
+ void addScore(int amount);
+ void scrollInventory(bool isLeft);
+
+ static void loadNotifierProc(bool postFlag);
};
} // End of namespace BlueForce
diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp
index 615b1c36fd..d86548bd4b 100644
--- a/engines/tsage/converse.cpp
+++ b/engines/tsage/converse.cpp
@@ -40,6 +40,7 @@ SequenceManager::SequenceManager() : Action() {
_field26 = 0;
_objectIndex = 0;
_keepActive = false;
+ _onCallback = NULL;
setup();
}
@@ -77,7 +78,7 @@ void SequenceManager::remove() {
_sequenceData.clear();
}
- if (_globals->_sceneObjects->contains(&_sceneText))
+ if (g_globals->_sceneObjects->contains(&_sceneText))
_sceneText.remove();
Common::set_to(&_objectList[0], &_objectList[6], (SceneObject *)NULL);
@@ -85,7 +86,7 @@ void SequenceManager::remove() {
}
void SequenceManager::signal() {
- if (_globals->_sceneObjects->contains(&_sceneText))
+ if (g_globals->_sceneObjects->contains(&_sceneText))
_sceneText.hide();
bool continueFlag = true;
@@ -98,8 +99,6 @@ void SequenceManager::signal() {
}
uint16 idx = static_cast<uint16>(getNextValue() - 32000);
- if (idx > 34)
- continue;
int16 v1, v2, v3;
switch (idx) {
@@ -144,8 +143,8 @@ void SequenceManager::signal() {
v1 = getNextValue();
v3 = getNextValue();
v2 = getNextValue();
- _globals->_sceneManager._scene->_sceneBounds.moveTo(v3, v2);
- _globals->_sceneManager._scene->loadScene(v1);
+ g_globals->_sceneManager._scene->_sceneBounds.moveTo(v3, v2);
+ g_globals->_sceneManager._scene->loadScene(v1);
break;
case 10: {
int resNum= getNextValue();
@@ -225,7 +224,7 @@ void SequenceManager::signal() {
int minPercent = getNextValue();
int yEnd = getNextValue();
int maxPercent = getNextValue();
- _globals->_sceneManager._scene->setZoomPercents(yStart, minPercent, yEnd, maxPercent);
+ g_globals->_sceneManager._scene->setZoomPercents(yStart, minPercent, yEnd, maxPercent);
break;
}
case 26:
@@ -253,7 +252,7 @@ void SequenceManager::signal() {
break;
case 30:
v1 = getNextValue();
- _globals->_scrollFollower = (v1 == -1) ? NULL : _objectList[v1];
+ g_globals->_scrollFollower = (v1 == -1) ? NULL : _objectList[v1];
break;
case 31:
_sceneObject->setObjectWrapper(new SceneObjectWrapper());
@@ -267,7 +266,7 @@ void SequenceManager::signal() {
setDelay(1);
else {
_sceneText.remove();
- _globals->_sceneManager._scene->_stripManager.start(v1, this);
+ g_globals->_sceneManager._scene->_stripManager.start(v1, this);
}
break;
case 34: {
@@ -287,7 +286,7 @@ void SequenceManager::signal() {
/* Following indexes were introduced for Blue Force */
case 35:
v1 = getNextValue();
- _sceneObject->updateAngle(_objectList[v1]);
+ _sceneObject->updateAngle(_objectList[v1]->_position);
break;
case 36:
_sceneObject->animate(ANIM_MODE_9, NULL);
@@ -295,7 +294,8 @@ void SequenceManager::signal() {
case 37:
v1 = getNextValue();
v2 = getNextValue();
- warning("TODO: dword_53030(%d,%d)", v1, v2);
+ if (_onCallback)
+ _onCallback(v1, v2);
break;
case 38: {
int resNum = getNextValue();
@@ -319,7 +319,7 @@ void SequenceManager::signal() {
void SequenceManager::process(Event &event) {
if (((event.eventType == EVENT_BUTTON_DOWN) || (event.eventType == EVENT_KEYPRESS)) &&
- !event.handled && _globals->_sceneObjects->contains(&_sceneText)) {
+ !event.handled && g_globals->_sceneObjects->contains(&_sceneText)) {
// Remove the text item
_sceneText.remove();
setDelay(2);
@@ -334,8 +334,8 @@ void SequenceManager::attached(EventHandler *newOwner, EventHandler *endHandler,
// Get the sequence number to use
_resNum = va_arg(va, int);
- byte *seqData = _resourceManager->getResource(RES_SEQUENCE, _resNum, 0);
- uint seqSize = _vm->_memoryManager.getSize(seqData);
+ byte *seqData = g_resourceManager->getResource(RES_SEQUENCE, _resNum, 0);
+ uint seqSize = g_vm->_memoryManager.getSize(seqData);
_sequenceData.resize(seqSize);
Common::copy(seqData, seqData + seqSize, &_sequenceData[0]);
@@ -375,14 +375,14 @@ void SequenceManager::setMessage(int resNum, int lineNum, int fontNum, int color
_sceneText._width = width;
// Get the display message
- Common::String msg = _resourceManager->getMessage(resNum, lineNum);
+ Common::String msg = g_resourceManager->getMessage(resNum, lineNum);
// Set the text message
_sceneText.setup(msg);
// Move the text to the correct position
Rect textRect = _sceneText._bounds;
- Rect sceneBounds = _globals->_sceneManager._scene->_sceneBounds;
+ Rect sceneBounds = g_globals->_sceneManager._scene->_sceneBounds;
sceneBounds.collapse(4, 2);
textRect.moveTo(pt);
textRect.contain(sceneBounds);
@@ -405,14 +405,14 @@ void SequenceManager::setMessage(int resNum, int lineNum, int fontNum, int color
}
SequenceManager *SequenceManager::globalManager() {
- return &_globals->_sequenceManager;
+ return &g_globals->_sequenceManager;
}
/*--------------------------------------------------------------------------*/
ConversationChoiceDialog::ConversationChoiceDialog() {
_stdColor = 23;
- _highlightColor = _globals->_scenePalette._colors.background;
+ _highlightColor = g_globals->_scenePalette._colors.background;
_fontNumber = 1;
}
@@ -443,17 +443,17 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) {
// Draw the dialog
draw();
- _globals->_events.showCursor();
+ g_globals->_events.showCursor();
// Event handling loop
Event event;
- while (!_vm->shouldQuit()) {
- while (!_globals->_events.getEvent(event, EVENT_KEYPRESS | EVENT_BUTTON_DOWN | EVENT_MOUSE_MOVE) &&
- !_vm->shouldQuit()) {
+ while (!g_vm->shouldQuit()) {
+ while (!g_globals->_events.getEvent(event, EVENT_KEYPRESS | EVENT_BUTTON_DOWN | EVENT_MOUSE_MOVE) &&
+ !g_vm->shouldQuit()) {
g_system->delayMillis(10);
g_system->updateScreen();
}
- if (_vm->shouldQuit())
+ if (g_vm->shouldQuit())
break;
if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode >= Common::KEYCODE_1) &&
@@ -504,7 +504,7 @@ void ConversationChoiceDialog::draw() {
// Make a backup copy of the area the dialog will occupy
Rect tempRect = _bounds;
tempRect.collapse(-10, -10);
- _savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), tempRect);
+ _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), tempRect);
// Fill in the contents of the entire dialog
_gfxManager._bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -558,6 +558,8 @@ void Obj44::synchronize(Serializer &s) {
StripManager::StripManager() {
_callbackObject = NULL;
_activeSpeaker = NULL;
+ _onBegin = NULL;
+ _onEnd = NULL;
reset();
}
@@ -565,12 +567,14 @@ StripManager::~StripManager() {
}
void StripManager::start(int stripNum, EventHandler *owner, StripCallback *callback) {
+ if (_onBegin)
+ _onBegin();
reset();
_stripNum = stripNum;
_callbackObject = callback;
- _sceneNumber = _globals->_sceneManager._scene->_screenNumber;
- _sceneBounds = _globals->_sceneManager._scene->_sceneBounds;
+ _sceneNumber = g_globals->_sceneManager._scene->_screenNumber;
+ _sceneBounds = g_globals->_sceneManager._scene->_sceneBounds;
_script.clear();
assert(owner);
@@ -599,8 +603,8 @@ void StripManager::reset() {
void StripManager::load() {
// Get the script
- byte *script = _resourceManager->getResource(RES_STRIP, _stripNum, 2);
- uint scriptSize = _vm->_memoryManager.getSize(script);
+ byte *script = g_resourceManager->getResource(RES_STRIP, _stripNum, 2);
+ uint scriptSize = g_vm->_memoryManager.getSize(script);
_script.resize(scriptSize);
Common::copy(script, script + scriptSize, &_script[0]);
@@ -608,8 +612,8 @@ void StripManager::load() {
DEALLOCATE(script);
// Get the object list
- byte *obj44List = _resourceManager->getResource(RES_STRIP, _stripNum, 1);
- int dataSize = _vm->_memoryManager.getSize(obj44List);
+ byte *obj44List = g_resourceManager->getResource(RES_STRIP, _stripNum, 1);
+ int dataSize = g_vm->_memoryManager.getSize(obj44List);
assert((dataSize % 0x44) == 0);
byte *dataP = obj44List;
@@ -673,11 +677,14 @@ void StripManager::remove() {
if (_activeSpeaker)
_activeSpeaker->remove();
- if (_sceneNumber != _globals->_sceneManager._scene->_screenNumber) {
- _globals->_sceneManager._scene->_sceneBounds = _sceneBounds;
- _globals->_sceneManager._scene->loadScene(_sceneNumber);
+ if (_sceneNumber != g_globals->_sceneManager._scene->_screenNumber) {
+ g_globals->_sceneManager._scene->_sceneBounds = _sceneBounds;
+ g_globals->_sceneManager._scene->loadScene(_sceneNumber);
}
+ if (_onEnd)
+ _onEnd();
+
Action::remove();
}
@@ -737,9 +744,9 @@ void StripManager::signal() {
_activeSpeaker->remove();
_activeSpeaker = speakerP;
- if ((_activeSpeaker->_newSceneNumber == -1) && (_globals->_sceneManager._scene->_screenNumber != _sceneNumber)) {
- _globals->_sceneManager._scene->_sceneBounds = _sceneBounds;
- _globals->_sceneManager._scene->loadScene(_sceneNumber);
+ if ((_activeSpeaker->_newSceneNumber == -1) && (g_globals->_sceneManager._scene->_screenNumber != _sceneNumber)) {
+ g_globals->_sceneManager._scene->_sceneBounds = _sceneBounds;
+ g_globals->_sceneManager._scene->loadScene(_sceneNumber);
}
_activeSpeaker->proc12(this);
@@ -832,7 +839,7 @@ Speaker::Speaker() : EventHandler() {
_textPos = Common::Point(10, 20);
_fontNumber = 2;
_textMode = ALIGN_LEFT;
- _color1 = _color2 = _color3 = _globals->_scenePalette._colors.foreground;
+ _color1 = _color2 = _color3 = g_globals->_scenePalette._colors.foreground;
_action = NULL;
_speakerName = "SPEAKER";
}
@@ -865,9 +872,9 @@ void Speaker::remove() {
void Speaker::proc12(Action *action) {
_action = action;
if (_newSceneNumber != -1) {
- _oldSceneNumber = _globals->_sceneManager._sceneNumber;
- _sceneBounds = _globals->_sceneManager._scene->_sceneBounds;
- _globals->_sceneManager._scene->loadScene(_newSceneNumber);
+ _oldSceneNumber = g_globals->_sceneManager._sceneNumber;
+ _sceneBounds = g_globals->_sceneManager._scene->_sceneBounds;
+ g_globals->_sceneManager._scene->loadScene(_newSceneNumber);
}
if (_hideObjects)
@@ -875,14 +882,14 @@ void Speaker::proc12(Action *action) {
_objectList.activate();
// Draw the speaker objects without any fading
- FadeMode fadeMode = _globals->_sceneManager._fadeMode;
- _globals->_sceneManager._fadeMode = FADEMODE_IMMEDIATE;
- _globals->_sceneObjects->draw();
- _globals->_sceneManager._fadeMode = fadeMode;
+ FadeMode fadeMode = g_globals->_sceneManager._fadeMode;
+ g_globals->_sceneManager._fadeMode = FADEMODE_IMMEDIATE;
+ g_globals->_sceneObjects->draw();
+ g_globals->_sceneManager._fadeMode = fadeMode;
}
void Speaker::setText(const Common::String &msg) {
- _globals->_sceneObjects->draw();
+ g_globals->_sceneObjects->draw();
_sceneText._color1 = _color1;
_sceneText._color2 = _color2;
@@ -935,16 +942,16 @@ void ScreenSpeaker::setText(const Common::String &msg) {
gfxMan._font.setFontNumber(_fontNumber);
Rect textRect;
- _globals->gfxManager().getStringBounds(msg.c_str(), textRect, _textWidth);
+ g_globals->gfxManager().getStringBounds(msg.c_str(), textRect, _textWidth);
if (_npc) {
textRect.center(_npc->_position.x, _npc->_bounds.top - (textRect.height() / 2 + 10));
} else {
- textRect.center(_globals->_sceneManager._scene->_sceneBounds.left +
- (_globals->_sceneManager._scene->_sceneBounds.width() / 2),
- _globals->_sceneManager._scene->_sceneBounds.top);
+ textRect.center(g_globals->_sceneManager._scene->_sceneBounds.left +
+ (g_globals->_sceneManager._scene->_sceneBounds.width() / 2),
+ g_globals->_sceneManager._scene->_sceneBounds.top);
}
- Rect rect2 = _globals->_sceneManager._scene->_sceneBounds;
+ Rect rect2 = g_globals->_sceneManager._scene->_sceneBounds;
rect2.collapse(10, 6);
textRect.contain(rect2);
@@ -960,14 +967,14 @@ void ScreenSpeaker::setText(const Common::String &msg) {
void SpeakerAction::signal() {
switch (_actionIndex++) {
case 0:
- setDelay(_globals->_randomSource.getRandomNumber(60) + 60);
+ setDelay(g_globals->_randomSource.getRandomNumber(60) + 60);
break;
case 1:
static_cast<SceneObject *>(_owner)->setFrame(1);
static_cast<SceneObject *>(_owner)->animate(ANIM_MODE_5, this, NULL);
break;
case 2:
- setDelay(_globals->_randomSource.getRandomNumber(10));
+ setDelay(g_globals->_randomSource.getRandomNumber(10));
_actionIndex = 0;
break;
default:
diff --git a/engines/tsage/converse.h b/engines/tsage/converse.h
index e263a12d12..f82c07a7dd 100644
--- a/engines/tsage/converse.h
+++ b/engines/tsage/converse.h
@@ -34,6 +34,8 @@ public:
virtual void stripCallback(int v) = 0;
};
+typedef void (*SequenceCallback)(int v1, int v2);
+
class SequenceManager : public Action {
private:
void setup();
@@ -54,6 +56,7 @@ public:
SceneObject *_sceneObject;
SceneObject *_objectList[6];
ASound _soundHandler;
+ SequenceCallback _onCallback;
public:
SequenceManager();
@@ -187,6 +190,8 @@ public:
virtual void synchronize(Serializer &s);
};
+typedef void (*StripProc)();
+
class StripManager : public Action {
private:
void reset();
@@ -208,6 +213,8 @@ public:
int _field2E8;
Common::Array<Obj44> _obj44List;
Common::Array<byte> _script;
+ StripProc _onBegin;
+ StripProc _onEnd;
public:
StripManager();
virtual ~StripManager();
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index 3a489e0024..c237548547 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -22,6 +22,7 @@
#include "common/system.h"
#include "common/config-manager.h"
+#include "common/util.h"
#include "engines/engine.h"
#include "graphics/palette.h"
#include "tsage/tsage.h"
@@ -32,6 +33,7 @@
#include "tsage/staticres.h"
#include "tsage/globals.h"
#include "tsage/sound.h"
+#include "tsage/blue_force/blueforce_logic.h"
namespace TsAGE {
@@ -48,28 +50,37 @@ InvObject::InvObject(int sceneNumber, int rlbNum, int cursorNum, CursorType curs
// Decode the image for the inventory item to get it's display bounds
uint size;
- byte *imgData = _resourceManager->getSubResource(_displayResNum, _rlbNum, _cursorNum, &size);
+ byte *imgData = g_resourceManager->getSubResource(_displayResNum, _rlbNum, _cursorNum, &size);
GfxSurface s = surfaceFromRes(imgData);
_bounds = s.getBounds();
DEALLOCATE(imgData);
}
-InvObject::InvObject(int visage, int strip, int frame, int sceneNumber) {
+InvObject::InvObject(int visage, int strip, int frame) {
+ assert(g_vm->getGameID() == GType_BlueForce);
_visage = visage;
_strip = strip;
_frame = frame;
- _sceneNumber = sceneNumber;
+ _sceneNumber = 0;
+ _iconResNum = 10;
}
void InvObject::setCursor() {
- _globals->_events._currentCursor = _cursorId;
+ if (g_vm->getGameID() == GType_BlueForce) {
+ // Blue Force cursor handling
+ _cursorId = (CursorType)BF_GLOBALS._inventory->indexOf(this);
+ g_globals->_events.setCursor(_cursorId);
+ } else {
+ // Ringworld cursor handling
+ g_globals->_events._currentCursor = _cursorId;
- if (_iconResNum != -1) {
- GfxSurface s = surfaceFromRes(_iconResNum, _rlbNum, _cursorNum);
+ if (_iconResNum != -1) {
+ GfxSurface s = surfaceFromRes(_iconResNum, _rlbNum, _cursorNum);
- Graphics::Surface src = s.lockSurface();
- _globals->_events.setCursor(src, s._transColor, s._centroid, _cursorId);
+ Graphics::Surface src = s.lockSurface();
+ g_globals->_events.setCursor(src, s._transColor, s._centroid, _cursorId);
+ }
}
}
@@ -84,6 +95,31 @@ void InvObjectList::synchronize(Serializer &s) {
SYNC_POINTER(_selectedItem);
}
+int InvObjectList::indexOf(InvObject *obj) const {
+ int idx = 0;
+ SynchronizedList<InvObject *>::const_iterator i;
+
+ for (i = _itemList.begin(); i != _itemList.end(); ++i, ++idx) {
+ if ((*i) == obj)
+ return idx;
+ }
+
+ return -1;
+}
+
+InvObject *InvObjectList::getItem(int objectNum) {
+ SynchronizedList<InvObject *>::const_iterator i = _itemList.begin();
+ while (objectNum-- > 0)
+ ++i;
+
+ return *i;
+}
+
+int InvObjectList::getObjectScene(int objectNum) {
+ InvObject *obj = getItem(objectNum);
+ return obj->_sceneNumber;
+}
+
/*--------------------------------------------------------------------------*/
void EventHandler::dispatch() {
@@ -135,7 +171,7 @@ void Action::remove() {
_owner->_action = NULL;
_owner = NULL;
} else {
- _globals->_sceneManager.removeAction(this);
+ g_globals->_sceneManager.removeAction(this);
}
_attached = false;
@@ -153,7 +189,7 @@ void Action::dispatch() {
_action->dispatch();
if (_delayFrames) {
- uint32 frameNumber = _globals->_events.getFrameNumber();
+ uint32 frameNumber = g_globals->_events.getFrameNumber();
if (frameNumber >= _startFrame) {
_delayFrames -= frameNumber - _startFrame;
@@ -169,7 +205,7 @@ void Action::dispatch() {
void Action::attached(EventHandler *newOwner, EventHandler *endHandler, va_list va) {
_actionIndex = 0;
_delayFrames = 0;
- _startFrame = _globals->_events.getFrameNumber();
+ _startFrame = g_globals->_events.getFrameNumber();
_owner = newOwner;
_endHandler = endHandler;
_attached = true;
@@ -178,7 +214,7 @@ void Action::attached(EventHandler *newOwner, EventHandler *endHandler, va_list
void Action::setDelay(int numFrames) {
_delayFrames = numFrames;
- _startFrame = _globals->_events.getFrameNumber();
+ _startFrame = g_globals->_events.getFrameNumber();
}
/*--------------------------------------------------------------------------*/
@@ -286,8 +322,12 @@ void ObjectMover::dispatch() {
void ObjectMover::setup(const Common::Point &destPos) {
_sceneObject->calcAngle(destPos);
- if ((_sceneObject->_objectWrapper) && !(_sceneObject->_flags & OBJFLAG_SUPPRESS_DISPATCH))
- _sceneObject->_objectWrapper->dispatch();
+ if ((_sceneObject->_objectWrapper) && !(_sceneObject->_flags & OBJFLAG_SUPPRESS_DISPATCH)) {
+ if (g_vm->getGameID() == GType_Ringworld)
+ _sceneObject->_objectWrapper->dispatch();
+ else
+ _sceneObject->updateAngle(destPos);
+ }
// Get the difference
int diffX = destPos.x - _sceneObject->_position.x;
@@ -446,8 +486,8 @@ void PlayerMover::endMove() {
}
// Set up the new interim destination along the route
- _globals->_walkRegions._routeEnds.moveSrc = _globals->_walkRegions._routeEnds.moveDest;
- _globals->_walkRegions._routeEnds.moveDest = _routeList[_routeIndex];
+ g_globals->_walkRegions._routeEnds.moveSrc = g_globals->_walkRegions._routeEnds.moveDest;
+ g_globals->_walkRegions._routeEnds.moveDest = _routeList[_routeIndex];
setup(_routeList[_routeIndex]);
dispatch();
}
@@ -455,18 +495,18 @@ void PlayerMover::endMove() {
void PlayerMover::setDest(const Common::Point &destPos) {
_routeList[0] = _sceneObject->_position;
- if (_globals->_walkRegions._resNum == -1) {
+ if (g_globals->_walkRegions._resNum == -1) {
// Scene has no walk regions defined, so player can walk anywhere directly
_routeList[0] = destPos;
_routeList[1] = Common::Point(ROUTE_END_VAL, ROUTE_END_VAL);
} else {
// Figure out a path to the destination (or as close as possible to it)
- pathfind(_routeList, _sceneObject->_position, destPos, _globals->_walkRegions._routeEnds);
+ pathfind(_routeList, _sceneObject->_position, destPos, g_globals->_walkRegions._routeEnds);
}
_routeIndex = 0;
- _globals->_walkRegions._routeEnds.moveSrc = _sceneObject->_position;
- _globals->_walkRegions._routeEnds.moveDest = _routeList[0];
+ g_globals->_walkRegions._routeEnds.moveSrc = _sceneObject->_position;
+ g_globals->_walkRegions._routeEnds.moveDest = _routeList[0];
setup(_routeList[0]);
}
@@ -479,7 +519,7 @@ void PlayerMover::pathfind(Common::Point *routeList, Common::Point srcPos, Commo
Common::Point objPos;
// Get the region the source is in
- int srcRegion = _globals->_walkRegions.indexOf(srcPos);
+ int srcRegion = g_globals->_walkRegions.indexOf(srcPos);
if (srcRegion == -1) {
srcRegion = findClosestRegion(srcPos, regionIndexes);
}
@@ -488,7 +528,7 @@ void PlayerMover::pathfind(Common::Point *routeList, Common::Point srcPos, Commo
routeRegions[0] = 0;
while (!routeRegions[0]) {
// Check the destination region
- int destRegion = _globals->_walkRegions.indexOf(destPos, &regionIndexes);
+ int destRegion = g_globals->_walkRegions.indexOf(destPos, &regionIndexes);
if ((srcRegion == -1) && (destRegion == -1)) {
// Both source and destination are outside walkable areas
@@ -499,14 +539,14 @@ void PlayerMover::pathfind(Common::Point *routeList, Common::Point srcPos, Commo
Common::Point newPos;
findLinePoint(&tempRouteEnds, &objPos, 1, &newPos);
- int srcId = _globals->_walkRegions.indexOf(newPos);
+ int srcId = g_globals->_walkRegions.indexOf(newPos);
if (srcId == -1) {
tempRouteEnds.moveDest = tempRouteEnds.moveSrc;
tempRouteEnds.moveSrc = routeEnds.moveDest;
findLinePoint(&tempRouteEnds, &objPos, 1, &newPos);
- srcRegion = _globals->_walkRegions.indexOf(newPos);
+ srcRegion = g_globals->_walkRegions.indexOf(newPos);
if (srcRegion == -1)
srcRegion = checkMover(srcPos, destPos);
@@ -539,8 +579,8 @@ void PlayerMover::pathfind(Common::Point *routeList, Common::Point srcPos, Commo
}
// field 0 holds the start, and field 1 holds the destination
- WRField18 &currSrcField = _globals->_walkRegions._field18[0];
- WRField18 &currDestField = _globals->_walkRegions._field18[1];
+ WRField18 &currSrcField = g_globals->_walkRegions._field18[0];
+ WRField18 &currDestField = g_globals->_walkRegions._field18[1];
currSrcField._pt1 = srcPos;
currSrcField._pt2 = srcPos;
@@ -558,11 +598,11 @@ void PlayerMover::pathfind(Common::Point *routeList, Common::Point srcPos, Commo
int breakEntry2 = routeRegions[idx + 1];
int listIndex = 0;
- while (_globals->_walkRegions._idxList[_globals->_walkRegions[breakEntry]._idxListIndex + listIndex] !=
+ while (g_globals->_walkRegions._idxList[g_globals->_walkRegions[breakEntry]._idxListIndex + listIndex] !=
breakEntry2)
++listIndex;
- tempList[idx] = _globals->_walkRegions._idxList2[_globals->_walkRegions[breakEntry]._idxList2Index
+ tempList[idx] = g_globals->_walkRegions._idxList2[g_globals->_walkRegions[breakEntry]._idxList2Index
+ listIndex];
++endIndex;
@@ -573,8 +613,8 @@ void PlayerMover::pathfind(Common::Point *routeList, Common::Point srcPos, Commo
int thisIdx = tempList[listIndex];
int nextIdx = tempList[listIndex + 1];
- WRField18 &thisField = _globals->_walkRegions._field18[thisIdx];
- WRField18 &nextField = _globals->_walkRegions._field18[nextIdx];
+ WRField18 &thisField = g_globals->_walkRegions._field18[thisIdx];
+ WRField18 &nextField = g_globals->_walkRegions._field18[nextIdx];
if (sub_F8E5_calculatePoint(currSrcField._pt1, nextField._pt1,
thisField._pt1, thisField._pt2) &&
@@ -623,8 +663,8 @@ void PlayerMover::pathfind(Common::Point *routeList, Common::Point srcPos, Commo
}
int PlayerMover::regionIndexOf(const Common::Point &pt) {
- for (uint idx = 0; idx < _globals->_walkRegions._regionList.size(); ++idx) {
- if (_globals->_walkRegions._regionList[idx].contains(pt))
+ for (uint idx = 0; idx < g_globals->_walkRegions._regionList.size(); ++idx) {
+ if (g_globals->_walkRegions._regionList[idx].contains(pt))
return idx + 1;
}
@@ -744,14 +784,14 @@ int PlayerMover::checkMover(Common::Point &srcPos, const Common::Point &destPos)
_sceneObject->_mover->dispatch();
// Scan walk regions for point
- for (uint idx = 0; idx < _globals->_walkRegions._regionList.size(); ++idx) {
- if (_globals->_walkRegions[idx].contains(_sceneObject->_position)) {
+ for (uint idx = 0; idx < g_globals->_walkRegions._regionList.size(); ++idx) {
+ if (g_globals->_walkRegions[idx].contains(_sceneObject->_position)) {
regionIndex = idx + 1;
srcPos = _sceneObject->_position;
break;
}
}
- } while ((regionIndex == 0) && (_sceneObject->_mover) && !_vm->shouldQuit());
+ } while ((regionIndex == 0) && (_sceneObject->_mover) && !g_vm->shouldQuit());
_sceneObject->_position = objPos;
_sceneObject->_regionBitList = regionBitList;
@@ -806,14 +846,14 @@ int PlayerMover::calculateRestOfRoute(int *routeList, int srcRegion, int destReg
return 32000;
}
- WalkRegion &srcWalkRegion = _globals->_walkRegions[srcRegion];
+ WalkRegion &srcWalkRegion = g_globals->_walkRegions[srcRegion];
int distance;
if (!routeList[0]) {
// The route is empty (new route).
distance = 0;
} else {
// Find the distance from the last region in the route.
- WalkRegion &region = _globals->_walkRegions[routeList[*routeList]];
+ WalkRegion &region = g_globals->_walkRegions[routeList[*routeList]];
distance = findDistance(srcWalkRegion._pt, region._pt);
}
@@ -834,7 +874,7 @@ int PlayerMover::calculateRestOfRoute(int *routeList, int srcRegion, int destReg
int foundIndex = 0;
int idx = 0;
int currDest;
- while ((currDest = _globals->_walkRegions._idxList[srcWalkRegion._idxListIndex + idx]) != 0) {
+ while ((currDest = g_globals->_walkRegions._idxList[srcWalkRegion._idxListIndex + idx]) != 0) {
if (currDest == destRegion) {
foundIndex = idx;
break;
@@ -845,7 +885,7 @@ int PlayerMover::calculateRestOfRoute(int *routeList, int srcRegion, int destReg
// Check every connected region until we find a route to the destination (or we have no more to check).
int bestDistance = 31990;
- while (((currDest = _globals->_walkRegions._idxList[srcWalkRegion._idxListIndex + foundIndex]) != 0) && (!foundRoute)) {
+ while (((currDest = g_globals->_walkRegions._idxList[srcWalkRegion._idxListIndex + foundIndex]) != 0) && (!foundRoute)) {
int newDistance = calculateRestOfRoute(tempList, currDest, destRegion, foundRoute);
if ((newDistance <= bestDistance) || foundRoute) {
@@ -1006,7 +1046,7 @@ void PaletteModifierCached::synchronize(Serializer &s) {
PaletteRotation::PaletteRotation() : PaletteModifierCached() {
_percent = 0;
_delayCtr = 0;
- _frameNumber = _globals->_events.getFrameNumber();
+ _frameNumber = g_globals->_events.getFrameNumber();
}
void PaletteRotation::synchronize(Serializer &s) {
@@ -1024,7 +1064,7 @@ void PaletteRotation::synchronize(Serializer &s) {
void PaletteRotation::signal() {
if (_delayCtr) {
- uint32 frameNumber = _globals->_events.getFrameNumber();
+ uint32 frameNumber = g_globals->_events.getFrameNumber();
if (frameNumber >= _frameNumber) {
_delayCtr = frameNumber - _frameNumber;
@@ -1205,7 +1245,7 @@ ScenePalette::ScenePalette(int paletteNum) {
}
bool ScenePalette::loadPalette(int paletteNum) {
- byte *palData = _resourceManager->getResource(RES_PALETTE, paletteNum, 0, true);
+ byte *palData = g_resourceManager->getResource(RES_PALETTE, paletteNum, 0, true);
if (!palData)
return false;
@@ -1245,6 +1285,15 @@ void ScenePalette::setPalette(int index, int count) {
}
/**
+ * Set a palette entry
+ */
+void ScenePalette::setEntry(int index, uint r, uint g, uint b) {
+ _palette[index * 3] = r;
+ _palette[index * 3 + 1] = g;
+ _palette[index * 3 + 2] = b;
+}
+
+/**
* Returns the palette index with the closest matching color to that specified
* @param r R component
* @param g G component
@@ -1348,7 +1397,7 @@ PaletteFader *ScenePalette::addFader(const byte *arrBufferRGB, int palSize, int
}
fader->setPalette(this, step);
- _globals->_scenePalette._listeners.push_back(fader);
+ g_globals->_scenePalette._listeners.push_back(fader);
return fader;
}
@@ -1356,7 +1405,7 @@ PaletteFader *ScenePalette::addFader(const byte *arrBufferRGB, int palSize, int
void ScenePalette::changeBackground(const Rect &bounds, FadeMode fadeMode) {
ScenePalette tempPalette;
- if (_globals->_sceneManager._hasPalette) {
+ if (g_globals->_sceneManager._hasPalette) {
if ((fadeMode == FADEMODE_GRADUAL) || (fadeMode == FADEMODE_IMMEDIATE)) {
// Fade out any active palette
tempPalette.getPalette();
@@ -1369,13 +1418,17 @@ void ScenePalette::changeBackground(const Rect &bounds, FadeMode fadeMode) {
g_system->delayMillis(10);
}
} else {
- _globals->_scenePalette.refresh();
- _globals->_sceneManager._hasPalette = false;
+ g_globals->_scenePalette.refresh();
+ g_globals->_sceneManager._hasPalette = false;
}
}
- _globals->_screenSurface.copyFrom(_globals->_sceneManager._scene->_backSurface,
- bounds, Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), NULL);
+ Rect tempRect = bounds;
+ if (g_vm->getGameID() == GType_BlueForce)
+ tempRect.setHeight(BF_GLOBALS._interfaceY);
+
+ g_globals->_screenSurface.copyFrom(g_globals->_sceneManager._scene->_backSurface,
+ tempRect, Rect(0, 0, tempRect.width(), tempRect.height()), NULL);
for (SynchronizedList<PaletteModifier *>::iterator i = tempPalette._listeners.begin(); i != tempPalette._listeners.end(); ++i)
delete *i;
@@ -1416,7 +1469,20 @@ void SceneItem::synchronize(Serializer &s) {
}
void SceneItem::remove() {
- _globals->_sceneItems.remove(this);
+ g_globals->_sceneItems.remove(this);
+}
+
+bool SceneItem::startAction(CursorType action, Event &event) {
+ if (g_vm->getGameID() == GType_Ringworld) {
+ doAction(action);
+ return true;
+ } else if ((action == CURSOR_LOOK) || (action == CURSOR_USE) || (action == CURSOR_TALK) ||
+ (action < CURSOR_LOOK)) {
+ doAction(action);
+ return true;
+ } else {
+ return false;
+ }
}
void SceneItem::doAction(int action) {
@@ -1444,21 +1510,25 @@ void SceneItem::doAction(int action) {
}
bool SceneItem::contains(const Common::Point &pt) {
- const Rect &sceneBounds = _globals->_sceneManager._scene->_sceneBounds;
+ const Rect &sceneBounds = g_globals->_sceneManager._scene->_sceneBounds;
if (_sceneRegionId == 0)
return _bounds.contains(pt.x + sceneBounds.left, pt.y + sceneBounds.top);
else
- return _globals->_sceneRegions.indexOf(Common::Point(pt.x + sceneBounds.left,
+ return g_globals->_sceneRegions.indexOf(Common::Point(pt.x + sceneBounds.left,
pt.y + sceneBounds.top)) == _sceneRegionId;
}
void SceneItem::display(int resNum, int lineNum, ...) {
- Common::String msg = !resNum ? Common::String() : _resourceManager->getMessage(resNum, lineNum);
+ Common::String msg = (!resNum || (resNum == -1)) ? Common::String() :
+ g_resourceManager->getMessage(resNum, lineNum);
+
+ if ((g_vm->getGameID() == GType_BlueForce) && BF_GLOBALS._uiElements._active)
+ BF_GLOBALS._uiElements.hide();
- if (_globals->_sceneObjects->contains(&_globals->_sceneText)) {
- _globals->_sceneText.remove();
- _globals->_sceneObjects->draw();
+ if (g_globals->_sceneObjects->contains(&g_globals->_sceneText)) {
+ g_globals->_sceneText.remove();
+ g_globals->_sceneObjects->draw();
}
GfxFontBackup font;
@@ -1466,12 +1536,15 @@ void SceneItem::display(int resNum, int lineNum, ...) {
Rect textRect;
int maxWidth = 120;
bool keepOnscreen = false;
- bool centerText = true;
+ bool centerText = g_vm->getGameID() == GType_Ringworld;
- if (resNum) {
+ if (resNum != 0) {
va_list va;
va_start(va, lineNum);
+ if (resNum == -1)
+ msg = Common::String(va_arg(va, const char *));
+
int mode;
do {
// Get next instruction
@@ -1481,7 +1554,7 @@ void SceneItem::display(int resNum, int lineNum, ...) {
case SET_WIDTH:
// Set width
maxWidth = va_arg(va, int);
- _globals->_sceneText._width = maxWidth;
+ g_globals->_sceneText._width = maxWidth;
break;
case SET_X:
// Set the X Position
@@ -1493,21 +1566,21 @@ void SceneItem::display(int resNum, int lineNum, ...) {
break;
case SET_FONT:
// Set the font number
- _globals->_sceneText._fontNumber = va_arg(va, int);
- _globals->gfxManager()._font.setFontNumber(_globals->_sceneText._fontNumber);
+ g_globals->_sceneText._fontNumber = va_arg(va, int);
+ g_globals->gfxManager()._font.setFontNumber(g_globals->_sceneText._fontNumber);
break;
case SET_BG_COLOR: {
// Set the background color
int bgColor = va_arg(va, int);
- _globals->gfxManager()._font._colors.background = bgColor;
+ g_globals->gfxManager()._font._colors.background = bgColor;
if (!bgColor)
- _globals->gfxManager().setFillFlag(false);
+ g_globals->gfxManager().setFillFlag(false);
break;
}
case SET_FG_COLOR:
// Set the foreground color
- _globals->_sceneText._color1 = va_arg(va, int);
- _globals->gfxManager()._font._colors.foreground = _globals->_sceneText._color1;
+ g_globals->_sceneText._color1 = va_arg(va, int);
+ g_globals->gfxManager()._font._colors.foreground = g_globals->_sceneText._color1;
break;
case SET_KEEP_ONSCREEN:
// Suppresses immediate display
@@ -1516,15 +1589,15 @@ void SceneItem::display(int resNum, int lineNum, ...) {
case SET_EXT_BGCOLOR: {
// Set secondary bg color
int v = va_arg(va, int);
- _globals->_sceneText._color2 = v;
- _globals->gfxManager()._font._colors2.background = v;
+ g_globals->_sceneText._color2 = v;
+ g_globals->gfxManager()._font._colors2.background = v;
break;
}
case SET_EXT_FGCOLOR: {
// Set secondary fg color
int v = va_arg(va, int);
- _globals->_sceneText._color3 = v;
- _globals->gfxManager()._font._colors.foreground = v;
+ g_globals->_sceneText._color3 = v;
+ g_globals->gfxManager()._font._colors.foreground = v;
break;
}
case SET_POS_MODE:
@@ -1533,7 +1606,7 @@ void SceneItem::display(int resNum, int lineNum, ...) {
break;
case SET_TEXT_MODE:
// Set the text mode
- _globals->_sceneText._textMode = (TextAlign)va_arg(va, int);
+ g_globals->_sceneText._textMode = (TextAlign)va_arg(va, int);
break;
default:
break;
@@ -1545,27 +1618,27 @@ void SceneItem::display(int resNum, int lineNum, ...) {
if (resNum) {
// Get required bounding size
- _globals->gfxManager().getStringBounds(msg.c_str(), textRect, maxWidth);
+ g_globals->gfxManager().getStringBounds(msg.c_str(), textRect, maxWidth);
textRect.center(pos.x, pos.y);
- textRect.contain(_globals->gfxManager()._bounds);
+ textRect.contain(g_globals->gfxManager()._bounds);
if (centerText) {
- _globals->_sceneText._color1 = _globals->_sceneText._color2;
- _globals->_sceneText._color2 = 0;
- _globals->_sceneText._color3 = 0;
+ g_globals->_sceneText._color1 = g_globals->_sceneText._color2;
+ g_globals->_sceneText._color2 = 0;
+ g_globals->_sceneText._color3 = 0;
}
- _globals->_sceneText.setup(msg);
+ g_globals->_sceneText.setup(msg);
if (centerText) {
- _globals->_sceneText.setPosition(Common::Point(
- _globals->_sceneManager._scene->_sceneBounds.left + textRect.left,
- _globals->_sceneManager._scene->_sceneBounds.top + textRect.top), 0);
+ g_globals->_sceneText.setPosition(Common::Point(
+ g_globals->_sceneManager._scene->_sceneBounds.left + textRect.left,
+ g_globals->_sceneManager._scene->_sceneBounds.top + textRect.top), 0);
} else {
- _globals->_sceneText.setPosition(pos, 0);
+ g_globals->_sceneText.setPosition(pos, 0);
}
- _globals->_sceneText.fixPriority(255);
- _globals->_sceneObjects->draw();
+ g_globals->_sceneText.fixPriority(255);
+ g_globals->_sceneObjects->draw();
}
// Unless the flag is set to keep the message on-screen, show it until a mouse or keypress, then remove it
@@ -1573,20 +1646,28 @@ void SceneItem::display(int resNum, int lineNum, ...) {
Event event;
// Keep event on-screen until a mouse or keypress
- while (!_vm->shouldQuit() && !_globals->_events.getEvent(event,
+ while (!g_vm->shouldQuit() && !g_globals->_events.getEvent(event,
EVENT_BUTTON_DOWN | EVENT_KEYPRESS)) {
g_system->updateScreen();
g_system->delayMillis(10);
}
- _globals->_sceneText.remove();
+ g_globals->_sceneText.remove();
+ }
+
+ if ((g_vm->getGameID() == GType_BlueForce) && BF_GLOBALS._uiElements._active) {
+ // Show user interface
+ BF_GLOBALS._uiElements.show();
+
+ // Re-show the cursor
+ BF_GLOBALS._events.setCursor(BF_GLOBALS._events.getCursor());
}
}
void SceneItem::display2(int resNum, int lineNum) {
- if (_vm->getGameID() == GType_BlueForce)
- display(resNum, lineNum, SET_WIDTH, 312,
- SET_X, 4 + GLOBALS._sceneManager._scene->_sceneBounds.left,
+ if (g_vm->getGameID() == GType_BlueForce)
+ display(resNum, lineNum, SET_WIDTH, 312,
+ SET_X, 4 + GLOBALS._sceneManager._scene->_sceneBounds.left,
SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + BF_INTERFACE_Y + 2,
SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
SET_EXT_FGCOLOR, 13, LIST_END);
@@ -1594,23 +1675,56 @@ void SceneItem::display2(int resNum, int lineNum) {
display(resNum, lineNum, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
}
+void SceneItem::display(const Common::String &msg) {
+ assert(g_vm->getGameID() == GType_BlueForce);
+
+ display(-1, -1, msg.c_str(),
+ SET_WIDTH, 312,
+ SET_X, 4 + GLOBALS._sceneManager._scene->_sceneBounds.left,
+ SET_Y, GLOBALS._sceneManager._scene->_sceneBounds.top + BF_INTERFACE_Y + 2,
+ SET_FONT, 4, SET_BG_COLOR, 1, SET_FG_COLOR, 19, SET_EXT_BGCOLOR, 9,
+ SET_EXT_FGCOLOR, 13, LIST_END);
+}
+
/*--------------------------------------------------------------------------*/
+bool SceneHotspot::startAction(CursorType action, Event &event) {
+ if (g_vm->getGameID() != GType_BlueForce)
+ return SceneItem::startAction(action, event);
+ else {
+ BlueForce::SceneExt *scene = (BlueForce::SceneExt *)BF_GLOBALS._sceneManager._scene;
+ assert(scene);
+ return scene->display(action);
+ }
+}
+
void SceneHotspot::doAction(int action) {
switch ((int)action) {
case CURSOR_LOOK:
- display(1, 0, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
+ if (g_vm->getGameID() == GType_BlueForce)
+ SceneItem::display(LOOK_SCENE_HOTSPOT);
+ else
+ display(1, 0, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
break;
case CURSOR_USE:
- display(1, 5, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
+ if (g_vm->getGameID() == GType_BlueForce)
+ SceneItem::display(USE_SCENE_HOTSPOT);
+ else
+ display(1, 5, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
break;
case CURSOR_TALK:
- display(1, 15, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
+ if (g_vm->getGameID() == GType_BlueForce)
+ SceneItem::display(TALK_SCENE_HOTSPOT);
+ else
+ display(1, 15, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
break;
case CURSOR_WALK:
break;
default:
- display(2, action, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
+ if (g_vm->getGameID() == GType_BlueForce)
+ SceneItem::display(DEFAULT_SCENE_HOTSPOT);
+ else
+ display(2, action, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
break;
}
}
@@ -1622,45 +1736,50 @@ NamedHotspot::NamedHotspot() : SceneHotspot() {
_lookLineNum = _useLineNum = _talkLineNum = -1;
}
-void NamedHotspot::doAction(int action) {
+bool NamedHotspot::startAction(CursorType action, Event &event) {
switch (action) {
case CURSOR_WALK:
// Nothing
- break;
+ return false;
case CURSOR_LOOK:
if (_lookLineNum == -1)
SceneHotspot::doAction(action);
+ else if (g_vm->getGameID() == GType_BlueForce)
+ SceneItem::display2(_resNum, _lookLineNum);
else
SceneItem::display(_resNum, _lookLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
- break;
+ return true;
case CURSOR_USE:
if (_useLineNum == -1)
SceneHotspot::doAction(action);
+ else if (g_vm->getGameID() == GType_BlueForce)
+ SceneItem::display2(_resNum, _useLineNum);
else
SceneItem::display(_resNum, _useLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
- break;
+ return true;
case CURSOR_TALK:
if (_talkLineNum == -1)
SceneHotspot::doAction(action);
+ else if (g_vm->getGameID() == GType_BlueForce)
+ SceneItem::display2(_resNum, _talkLineNum);
else
SceneItem::display2(_resNum, _talkLineNum);
- break;
+ return true;
default:
- SceneHotspot::doAction(action);
- break;
+ return SceneHotspot::startAction(action, event);
}
}
-void NamedHotspot::setup(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum) {
+void NamedHotspot::setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum) {
setBounds(ys, xe, ye, xs);
_resNum = resnum;
_lookLineNum = lookLineNum;
_useLineNum = useLineNum;
_talkLineNum = -1;
- _globals->_sceneItems.addItems(this, NULL);
+ g_globals->_sceneItems.addItems(this, NULL);
}
-void NamedHotspot::setup(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) {
+void NamedHotspot::setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item) {
setBounds(bounds);
_resNum = resNum;
_lookLineNum = lookLineNum;
@@ -1669,26 +1788,38 @@ void NamedHotspot::setup(const Rect &bounds, int resNum, int lookLineNum, int ta
switch (mode) {
case 2:
- _globals->_sceneItems.push_front(this);
+ g_globals->_sceneItems.push_front(this);
break;
case 4:
- _globals->_sceneItems.addBefore(item, this);
+ g_globals->_sceneItems.addBefore(item, this);
break;
case 5:
- _globals->_sceneItems.addAfter(item, this);
+ g_globals->_sceneItems.addAfter(item, this);
break;
default:
- _globals->_sceneItems.push_back(this);
+ g_globals->_sceneItems.push_back(this);
break;
}
}
-void NamedHotspot::setup(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode) {
+void NamedHotspot::setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode) {
_sceneRegionId = sceneRegionId;
_resNum = resNum;
_lookLineNum = lookLineNum;
_talkLineNum = talkLineNum;
_useLineNum = useLineNum;
+
+ // Handle adding hotspot to scene items list as necessary
+ switch (mode) {
+ case 2:
+ GLOBALS._sceneItems.push_front(this);
+ break;
+ case 3:
+ break;
+ default:
+ GLOBALS._sceneItems.push_back(this);
+ break;
+ }
}
void NamedHotspot::synchronize(Serializer &s) {
@@ -1697,7 +1828,7 @@ void NamedHotspot::synchronize(Serializer &s) {
s.syncAsSint16LE(_lookLineNum);
s.syncAsSint16LE(_useLineNum);
- if (_vm->getGameID() == GType_BlueForce)
+ if (g_vm->getGameID() == GType_BlueForce)
s.syncAsSint16LE(_talkLineNum);
}
@@ -1719,17 +1850,17 @@ void SceneObjectWrapper::remove() {
}
void SceneObjectWrapper::dispatch() {
- if (_vm->getGameID() == GType_Ringworld)
+ if (g_vm->getGameID() == GType_Ringworld)
check();
}
void SceneObjectWrapper::check() {
_visageImages.setVisage(_sceneObject->_visage);
- int frameCount = _visageImages.getFrameCount();
+ int visageCount = _visageImages.getFrameCount();
int angle = _sceneObject->_angle;
int strip = _sceneObject->_strip;
- if (frameCount == 4) {
+ if (visageCount == 4) {
if ((angle > 314) || (angle < 45))
strip = 4;
if ((angle > 44) && (angle < 135))
@@ -1738,7 +1869,7 @@ void SceneObjectWrapper::check() {
strip = 3;
if ((angle >= 225) && (angle < 315))
strip = 2;
- } else if (frameCount == 8) {
+ } else if (visageCount == 8) {
if ((angle > 330) || (angle < 30))
strip = 4;
if ((angle >= 30) && (angle < 70))
@@ -1757,8 +1888,8 @@ void SceneObjectWrapper::check() {
strip = 8;
}
- if (strip > frameCount)
- strip = frameCount;
+ if (strip > visageCount)
+ strip = visageCount;
_sceneObject->setStrip(strip);
}
@@ -1786,6 +1917,8 @@ SceneObject::SceneObject() : SceneHotspot() {
_frameChange = 0;
_visage = 0;
+ _strip = 0;
+ _frame = 0;
}
SceneObject::SceneObject(const SceneObject &so) : SceneHotspot() {
@@ -1829,7 +1962,7 @@ void SceneObject::animEnded() {
int SceneObject::changeFrame() {
int frameNum = _frame;
- uint32 mouseCtr = _globals->_events.getFrameNumber();
+ uint32 mouseCtr = g_globals->_events.getFrameNumber();
if ((_updateStartFrame <= mouseCtr) || (_animateMode == ANIM_MODE_1)) {
if (_numFrames > 0) {
@@ -1940,7 +2073,7 @@ void SceneObject::addMover(ObjectMover *mover, ...) {
if (mover) {
// Set up the assigned mover
- _walkStartFrame = _globals->_events.getFrameNumber();
+ _walkStartFrame = g_globals->_events.getFrameNumber();
if (_moveRate != 0)
_walkStartFrame = 60 / _moveRate;
@@ -1963,7 +2096,7 @@ void SceneObject::getHorizBounds() {
}
int SceneObject::getRegionIndex() {
- return _globals->_sceneRegions.indexOf(_position);
+ return g_globals->_sceneRegions.indexOf(_position);
}
int SceneObject::checkRegion(const Common::Point &pt) {
@@ -1974,7 +2107,7 @@ int SceneObject::checkRegion(const Common::Point &pt) {
Common::Point savedPos = _position;
_position = pt;
- int regIndex = _globals->_sceneRegions.indexOf(pt);
+ int regIndex = g_globals->_sceneRegions.indexOf(pt);
if (_regionBitList & (1 << regIndex))
regionIndex = regIndex;
@@ -1996,7 +2129,7 @@ int SceneObject::checkRegion(const Common::Point &pt) {
newY -= _yDiff;
SynchronizedList<SceneObject *>::iterator i;
- for (i = _globals->_sceneObjects->begin(); (regionIndex == 0) && (i != _globals->_sceneObjects->end()); ++i) {
+ for (i = g_globals->_sceneObjects->begin(); (regionIndex == 0) && (i != g_globals->_sceneObjects->end()); ++i) {
if ((*i) && ((*i)->_flags & OBJFLAG_CHECK_REGION)) {
int objYDiff = (*i)->_position.y - _yDiff;
if ((objYDiff >= yPos) && (objYDiff <= newY) &&
@@ -2013,7 +2146,7 @@ int SceneObject::checkRegion(const Common::Point &pt) {
void SceneObject::animate(AnimateMode animMode, ...) {
_animateMode = animMode;
- _updateStartFrame = _globals->_events.getFrameNumber();
+ _updateStartFrame = g_globals->_events.getFrameNumber();
if (_numFrames)
_updateStartFrame += 60 / _numFrames;
@@ -2089,9 +2222,19 @@ SceneObject *SceneObject::clone() const {
}
void SceneObject::checkAngle(const SceneObject *obj) {
- _angle = GfxManager::getAngle(_position, obj->_position);
+ checkAngle(obj->_position);
+}
- if (_objectWrapper)
+void SceneObject::checkAngle(const Common::Point &pt) {
+ int angleAmount = GfxManager::getAngle(_position, pt);
+ if (angleAmount != -1) {
+ _angle = angleAmount;
+
+ if (_animateMode == ANIM_MODE_9)
+ _angle = (angleAmount + 180) % 360;
+ }
+
+ if (_objectWrapper && (g_vm->getGameID() == GType_Ringworld))
_objectWrapper->dispatch();
}
@@ -2148,7 +2291,7 @@ void SceneObject::synchronize(Serializer &s) {
void SceneObject::postInit(SceneObjectList *OwnerList) {
if (!OwnerList)
- OwnerList = _globals->_sceneObjects;
+ OwnerList = g_globals->_sceneObjects;
if (!OwnerList->contains(this)) {
_percent = 100;
@@ -2176,7 +2319,7 @@ void SceneObject::postInit(SceneObjectList *OwnerList) {
void SceneObject::remove() {
SceneItem::remove();
- if (_globals->_sceneObjects->contains(this))
+ if (g_globals->_sceneObjects->contains(this))
// For objects in the object list, flag the object for removal in the next drawing, so that
// the drawing code has a chance to restore the area previously covered by the object
_flags |= OBJFLAG_PANES | OBJFLAG_REMOVE | OBJFLAG_HIDE;
@@ -2186,7 +2329,7 @@ void SceneObject::remove() {
}
void SceneObject::dispatch() {
- uint32 currTime = _globals->_events.getFrameNumber();
+ uint32 currTime = g_globals->_events.getFrameNumber();
if (_action)
_action->dispatch();
@@ -2230,7 +2373,7 @@ void SceneObject::dispatch() {
int frameNum = 0;
do {
int count = getFrameCount();
- frameNum = _globals->_randomSource.getRandomNumber(count - 1);
+ frameNum = g_globals->_randomSource.getRandomNumber(count - 1);
} while (frameNum == _frame);
setFrame(frameNum);
@@ -2288,7 +2431,7 @@ void SceneObject::dispatch() {
// Handle updating the zoom and/or priority
if (!(_flags & OBJFLAG_ZOOMED)) {
int yp = CLIP((int)_position.y, 0, 255);
- setZoom(_globals->_sceneManager._scene->_zoomPercents[yp]);
+ setZoom(g_globals->_sceneManager._scene->_zoomPercents[yp]);
}
if (!(_flags & OBJFLAG_FIXED_PRIORITY)) {
setPriority(_position.y);
@@ -2302,12 +2445,8 @@ void SceneObject::calcAngle(const Common::Point &pt) {
}
void SceneObject::removeObject() {
- _globals->_sceneItems.remove(this);
- _globals->_sceneObjects->remove(this);
-
- if (_visage) {
- _visage = 0;
- }
+ g_globals->_sceneItems.remove(this);
+ g_globals->_sceneObjects->remove(this);
if (_objectWrapper) {
_objectWrapper->remove();
@@ -2339,11 +2478,11 @@ void SceneObject::reposition() {
*/
void SceneObject::draw() {
Rect destRect = _bounds;
- destRect.translate(-_globals->_sceneManager._scene->_sceneBounds.left,
- -_globals->_sceneManager._scene->_sceneBounds.top);
- Region *priorityRegion = _globals->_sceneManager._scene->_priorities.find(_priority);
+ destRect.translate(-g_globals->_sceneManager._scene->_sceneBounds.left,
+ -g_globals->_sceneManager._scene->_sceneBounds.top);
+ Region *priorityRegion = g_globals->_sceneManager._scene->_priorities.find(_priority);
GfxSurface frame = getFrame();
- _globals->gfxManager().copyFrom(frame, destRect, priorityRegion);
+ g_globals->gfxManager().copyFrom(frame, destRect, priorityRegion);
}
/**
@@ -2352,22 +2491,22 @@ void SceneObject::draw() {
*/
void SceneObject::updateScreen() {
Rect srcRect = _paneRects[CURRENT_PANENUM];
- const Rect &sceneBounds = _globals->_sceneManager._scene->_sceneBounds;
+ const Rect &sceneBounds = g_globals->_sceneManager._scene->_sceneBounds;
srcRect.left = (srcRect.left / 4) * 4;
srcRect.right = ((srcRect.right + 3) / 4) * 4;
- srcRect.clip(_globals->_sceneManager._scene->_sceneBounds);
+ srcRect.clip(g_globals->_sceneManager._scene->_sceneBounds);
if (srcRect.isValidRect()) {
Rect destRect = srcRect;
destRect.translate(-sceneBounds.left, -sceneBounds.top);
- srcRect.translate(-_globals->_sceneOffset.x, -_globals->_sceneOffset.y);
+ srcRect.translate(-g_globals->_sceneOffset.x, -g_globals->_sceneOffset.y);
- _globals->_screenSurface.copyFrom(_globals->_sceneManager._scene->_backSurface, srcRect, destRect);
+ g_globals->_screenSurface.copyFrom(g_globals->_sceneManager._scene->_backSurface, srcRect, destRect);
}
}
-void SceneObject::updateAngle(SceneObject *sceneObj) {
- checkAngle(sceneObj);
+void SceneObject::updateAngle(const Common::Point &pt) {
+ checkAngle(pt);
if (_objectWrapper)
_objectWrapper->check();
}
@@ -2389,12 +2528,22 @@ void SceneObject::setup(int visage, int stripFrameNum, int frameNum, int posX, i
/*--------------------------------------------------------------------------*/
-void AltSceneObject::postInit(SceneObjectList *OwnerList) {
- SceneObject::postInit(&_globals->_sceneManager._altSceneObjects);
+void BackgroundSceneObject::postInit(SceneObjectList *OwnerList) {
+ SceneObjectList dummyList;
+ SceneObjectList *pList = !g_globals->_sceneManager._scene ? &dummyList :
+ &g_globals->_sceneManager._scene->_bgSceneObjects;
+
+ SceneObject::postInit(pList);
}
-void AltSceneObject::draw() {
- SceneObject::draw();
+void BackgroundSceneObject::draw() {
+ assert(g_globals->_sceneManager._scene);
+ Rect destRect = _bounds;
+ destRect.translate(-g_globals->_sceneManager._scene->_sceneBounds.left,
+ -g_globals->_sceneManager._scene->_sceneBounds.top);
+ Region *priorityRegion = g_globals->_sceneManager._scene->_priorities.find(_priority);
+ GfxSurface frame = getFrame();
+ g_globals->_sceneManager._scene->_backSurface.copyFrom(frame, destRect, priorityRegion);
}
/*--------------------------------------------------------------------------*/
@@ -2407,27 +2556,27 @@ void SceneObjectList::draw() {
if (_objList.size() == 0) {
// Alternate draw mode
- if (_globals->_paneRefreshFlag[paneNum] == 1) {
+ if (g_globals->_paneRefreshFlag[paneNum] == 1) {
// Load the background
- _globals->_sceneManager._scene->refreshBackground(0, 0);
+ g_globals->_sceneManager._scene->refreshBackground(0, 0);
- Rect tempRect = _globals->_sceneManager._scene->_sceneBounds;
- tempRect.translate(-_globals->_sceneOffset.x, -_globals->_sceneOffset.y);
- ScenePalette::changeBackground(tempRect, _globals->_sceneManager._fadeMode);
+ Rect tempRect = g_globals->_sceneManager._scene->_sceneBounds;
+ tempRect.translate(-g_globals->_sceneOffset.x, -g_globals->_sceneOffset.y);
+ ScenePalette::changeBackground(tempRect, g_globals->_sceneManager._fadeMode);
} else {
- _globals->_paneRegions[CURRENT_PANENUM].draw();
+ g_globals->_paneRegions[CURRENT_PANENUM].draw();
}
- _globals->_paneRegions[CURRENT_PANENUM].setRect(0, 0, 0, 0);
- _globals->_sceneManager.fadeInIfNecessary();
+ g_globals->_paneRegions[CURRENT_PANENUM].setRect(0, 0, 0, 0);
+ g_globals->_sceneManager.fadeInIfNecessary();
} else {
// If there is a scroll follower, check whether it has moved off-screen
- if (_globals->_scrollFollower) {
- const Rect &scrollerRect = _globals->_sceneManager._scrollerRect;
+ if (g_globals->_scrollFollower) {
+ const Rect &scrollerRect = g_globals->_sceneManager._scrollerRect;
Common::Point objPos(
- _globals->_scrollFollower->_position.x - _globals->_sceneManager._scene->_sceneBounds.left,
- _globals->_scrollFollower->_position.y - _globals->_sceneManager._scene->_sceneBounds.top);
+ g_globals->_scrollFollower->_position.x - g_globals->_sceneManager._scene->_sceneBounds.left,
+ g_globals->_scrollFollower->_position.y - g_globals->_sceneManager._scene->_sceneBounds.top);
int loadCount = 0;
if (objPos.x >= scrollerRect.right) {
@@ -2448,21 +2597,21 @@ void SceneObjectList::draw() {
}
if (loadCount > 0)
- _globals->_sceneManager.setBgOffset(Common::Point(xAmount, yAmount), loadCount);
+ g_globals->_sceneManager.setBgOffset(Common::Point(xAmount, yAmount), loadCount);
}
- if (_globals->_sceneManager._sceneLoadCount > 0) {
- --_globals->_sceneManager._sceneLoadCount;
- _globals->_sceneManager._scene->loadBackground(_globals->_sceneManager._sceneBgOffset.x,
- _globals->_sceneManager._sceneBgOffset.y);
+ if (g_globals->_sceneManager._sceneLoadCount > 0) {
+ --g_globals->_sceneManager._sceneLoadCount;
+ g_globals->_sceneManager._scene->loadBackground(g_globals->_sceneManager._sceneBgOffset.x,
+ g_globals->_sceneManager._sceneBgOffset.y);
}
// Set up the flag mask
uint32 flagMask = (paneNum == 0) ? OBJFLAG_PANE_0 : OBJFLAG_PANE_1;
// Initial loop to set up object list and update object position, priority, and flags
- for (SynchronizedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin();
- i != _globals->_sceneObjects->end(); ++i) {
+ for (SynchronizedList<SceneObject *>::iterator i = g_globals->_sceneObjects->begin();
+ i != g_globals->_sceneObjects->end(); ++i) {
SceneObject *obj = *i;
objList.push_back(obj);
@@ -2475,10 +2624,10 @@ void SceneObjectList::draw() {
// Handle updating object priority
if (!(obj->_flags & OBJFLAG_FIXED_PRIORITY)) {
obj->_priority = MIN((int)obj->_position.y,
- (int)_globals->_sceneManager._scene->_backgroundBounds.bottom - 1);
+ (int)g_globals->_sceneManager._scene->_backgroundBounds.bottom - 1);
}
- if ((_globals->_paneRefreshFlag[paneNum] != 0) || !_globals->_paneRegions[paneNum].empty()) {
+ if ((g_globals->_paneRefreshFlag[paneNum] != 0) || !g_globals->_paneRegions[paneNum].empty()) {
obj->_flags |= flagMask;
}
}
@@ -2487,20 +2636,20 @@ void SceneObjectList::draw() {
checkIntersection(objList, objList.size(), CURRENT_PANENUM);
sortList(objList);
- if (_globals->_paneRefreshFlag[paneNum] == 1) {
+ if (g_globals->_paneRefreshFlag[paneNum] == 1) {
// Load the background
- _globals->_sceneManager._scene->refreshBackground(0, 0);
+ g_globals->_sceneManager._scene->refreshBackground(0, 0);
}
- _globals->_sceneManager._scene->_sceneBounds.left &= ~3;
- _globals->_sceneManager._scene->_sceneBounds.right &= ~3;
- _globals->_sceneOffset.x &= ~3;
+ g_globals->_sceneManager._scene->_sceneBounds.left &= ~3;
+ g_globals->_sceneManager._scene->_sceneBounds.right &= ~3;
+ g_globals->_sceneOffset.x &= ~3;
- if (_globals->_paneRefreshFlag[paneNum] != 0) {
+ if (g_globals->_paneRefreshFlag[paneNum] != 0) {
// Change the background
- Rect tempRect = _globals->_sceneManager._scene->_sceneBounds;
- tempRect.translate(-_globals->_sceneOffset.x, -_globals->_sceneOffset.y);
- ScenePalette::changeBackground(tempRect, _globals->_sceneManager._fadeMode);
+ Rect tempRect = g_globals->_sceneManager._scene->_sceneBounds;
+ tempRect.translate(-g_globals->_sceneOffset.x, -g_globals->_sceneOffset.y);
+ ScenePalette::changeBackground(tempRect, g_globals->_sceneManager._fadeMode);
} else {
for (uint objIndex = 0; objIndex < objList.size(); ++objIndex) {
SceneObject *obj = objList[objIndex];
@@ -2509,10 +2658,10 @@ void SceneObjectList::draw() {
obj->updateScreen();
}
- _globals->_paneRegions[paneNum].draw();
+ g_globals->_paneRegions[paneNum].draw();
}
- _globals->_paneRegions[paneNum].setRect(0, 0, 0, 0);
+ g_globals->_paneRegions[paneNum].setRect(0, 0, 0, 0);
redraw:
// Main draw loop
for (uint objIndex = 0; objIndex < objList.size(); ++objIndex) {
@@ -2525,9 +2674,9 @@ redraw:
}
// Update the palette
- _globals->_sceneManager.fadeInIfNecessary();
- _globals->_sceneManager._loadMode = 0;
- _globals->_paneRefreshFlag[paneNum] = 0;
+ g_globals->_sceneManager.fadeInIfNecessary();
+ g_globals->_sceneManager._loadMode = 0;
+ g_globals->_paneRefreshFlag[paneNum] = 0;
// Loop through the object list, removing any objects and refreshing the screen as necessary
for (uint objIndex = 0; objIndex < objList.size(); ++objIndex) {
@@ -2610,9 +2759,9 @@ void SceneObjectList::sortList(Common::Array<SceneObject *> &ObjList) {
}
void SceneObjectList::activate() {
- SceneObjectList *objectList = _globals->_sceneObjects;
- _globals->_sceneObjects = this;
- _globals->_sceneObjects_queue.push_front(this);
+ SceneObjectList *objectList = g_globals->_sceneObjects;
+ g_globals->_sceneObjects = this;
+ g_globals->_sceneObjects_queue.push_front(this);
// Flag all the objects as modified
SynchronizedList<SceneObject *>::iterator i;
@@ -2629,19 +2778,19 @@ void SceneObjectList::activate() {
}
void SceneObjectList::deactivate() {
- if (_globals->_sceneObjects_queue.size() <= 1)
+ if (g_globals->_sceneObjects_queue.size() <= 1)
return;
- SceneObjectList *objectList = *_globals->_sceneObjects_queue.begin();
- _globals->_sceneObjects_queue.pop_front();
- _globals->_sceneObjects = *_globals->_sceneObjects_queue.begin();
+ SceneObjectList *objectList = *g_globals->_sceneObjects_queue.begin();
+ g_globals->_sceneObjects_queue.pop_front();
+ g_globals->_sceneObjects = *g_globals->_sceneObjects_queue.begin();
SynchronizedList<SceneObject *>::iterator i;
for (i = objectList->begin(); i != objectList->end(); ++i) {
if (!((*i)->_flags & OBJFLAG_CLONED)) {
SceneObject *sceneObj = (*i)->clone();
sceneObj->_flags |= OBJFLAG_HIDE | OBJFLAG_REMOVE | OBJFLAG_CLONED;
- _globals->_sceneObjects->push_front(sceneObj);
+ g_globals->_sceneObjects->push_front(sceneObj);
}
}
}
@@ -2670,6 +2819,14 @@ void SceneText::setup(const Common::String &msg) {
gfxMan.activate();
Rect textRect;
+ if ((g_vm->getGameID() != GType_Ringworld) && g_globals->_sceneObjects->contains(this) &&
+ (_flags & OBJFLAG_REMOVE)) {
+ // Trying to setup a SceneText scheduled to be removed, so remove it now
+ _bounds.expandPanes();
+ this->removeObject();
+ g_globals->_sceneObjects->remove(this);
+ }
+
gfxMan._font.setFontNumber(_fontNumber);
gfxMan._font._colors.foreground = _color1;
gfxMan._font._colors2.background = _color2;
@@ -2707,12 +2864,21 @@ void SceneText::synchronize(Serializer &s) {
_textSurface.synchronize(s);
}
+void SceneText::updateScreen() {
+ // FIXME: Hack for Blue Force to handle not refreshing the screen if the user interface
+ // has been re-activated after showing some scene text
+ if ((g_vm->getGameID() != GType_BlueForce) || (_bounds.top < BF_INTERFACE_Y) ||
+ !BF_GLOBALS._uiElements._visible)
+ SceneObject::updateScreen();
+}
+
/*--------------------------------------------------------------------------*/
Visage::Visage() {
- _resNum = 0;
- _rlbNum = 0;
+ _resNum = -1;
+ _rlbNum = -1;
_data = NULL;
+ _flipHoriz = false;
}
Visage::Visage(const Visage &v) {
@@ -2720,7 +2886,7 @@ Visage::Visage(const Visage &v) {
_rlbNum = v._rlbNum;
_data = v._data;
if (_data)
- _vm->_memoryManager.incLocks(_data);
+ g_vm->_memoryManager.incLocks(_data);
}
Visage &Visage::operator=(const Visage &s) {
@@ -2728,7 +2894,7 @@ Visage &Visage::operator=(const Visage &s) {
_rlbNum = s._rlbNum;
_data = s._data;
if (_data)
- _vm->_memoryManager.incLocks(_data);
+ g_vm->_memoryManager.incLocks(_data);
return *this;
}
@@ -2738,7 +2904,32 @@ void Visage::setVisage(int resNum, int rlbNum) {
_resNum = resNum;
_rlbNum = rlbNum;
DEALLOCATE(_data);
- _data = _resourceManager->getResource(RES_VISAGE, resNum, rlbNum);
+
+ if (g_vm->getGameID() == GType_Ringworld) {
+ // In Ringworld, we immediately get the data
+ _data = g_resourceManager->getResource(RES_VISAGE, resNum, rlbNum);
+ } else {
+ // Blue Force has an extra indirection via the visage index file
+ byte *indexData = g_resourceManager->getResource(RES_VISAGE, resNum, 9999);
+ if (rlbNum == 9999) {
+ _data = indexData;
+ } else {
+ if (rlbNum == 0)
+ rlbNum = 1;
+
+ // Get the flags/rlbNum to use
+ uint32 v = READ_LE_UINT32(indexData + (rlbNum - 1) * 4 + 2);
+ int flags = v >> 30;
+
+ if (flags & 3) {
+ rlbNum = (int)(v & 0xff);
+ }
+ _flipHoriz = flags & 1;
+
+ _data = g_resourceManager->getResource(RES_VISAGE, resNum, rlbNum);
+ }
+ }
+
assert(_data);
}
}
@@ -2757,17 +2948,33 @@ GfxSurface Visage::getFrame(int frameNum) {
int offset = READ_LE_UINT32(_data + 2 + frameNum * 4);
byte *frameData = _data + offset;
- return surfaceFromRes(frameData);
+ GfxSurface result = surfaceFromRes(frameData);
+ if (_flipHoriz) flip(result);
+ return result;
}
int Visage::getFrameCount() const {
return READ_LE_UINT16(_data);
}
+void Visage::flip(GfxSurface &gfxSurface) {
+ Graphics::Surface s = gfxSurface.lockSurface();
+
+ for (int y = 0; y < s.h; ++y) {
+ // Flip the line
+ byte *lineP = (byte *)s.getBasePtr(0, y);
+ for (int x = 0; x < (s.w / 2); ++x)
+ SWAP(lineP[x], lineP[s.w - x - 1]);
+ }
+
+ gfxSurface.unlockSurface();
+}
+
/*--------------------------------------------------------------------------*/
Player::Player(): SceneObject() {
_canWalk = false;
+ _enabled = false;
_uiEnabled = false;
_field8C = 0;
}
@@ -2786,35 +2993,55 @@ void Player::postInit(SceneObjectList *OwnerList) {
void Player::disableControl() {
_canWalk = false;
_uiEnabled = false;
- _globals->_events.setCursor(CURSOR_NONE);
+ g_globals->_events.setCursor(CURSOR_NONE);
+ _enabled = false;
+
+ if ((g_vm->getGameID() == GType_BlueForce) && BF_GLOBALS._uiElements._active)
+ BF_GLOBALS._uiElements.hide();
}
void Player::enableControl() {
_canWalk = true;
_uiEnabled = true;
- _globals->_events.setCursor(CURSOR_WALK);
+ _enabled = true;
- switch (_globals->_events.getCursor()) {
- case CURSOR_WALK:
- case CURSOR_LOOK:
- case CURSOR_USE:
- case CURSOR_TALK:
- _globals->_events.setCursor(_globals->_events.getCursor());
- break;
- default:
- _globals->_events.setCursor(CURSOR_WALK);
- break;
+ if (g_vm->getGameID() == GType_Ringworld) {
+ g_globals->_events.setCursor(CURSOR_WALK);
+
+ switch (g_globals->_events.getCursor()) {
+ case CURSOR_WALK:
+ case CURSOR_LOOK:
+ case CURSOR_USE:
+ case CURSOR_TALK:
+ g_globals->_events.setCursor(g_globals->_events.getCursor());
+ break;
+ default:
+ g_globals->_events.setCursor(CURSOR_WALK);
+ break;
+ }
+ } else {
+ CursorType cursor = g_globals->_events.getCursor();
+ g_globals->_events.setCursor(cursor);
+
+ if (BF_GLOBALS._uiElements._active)
+ BF_GLOBALS._uiElements.show();
}
}
void Player::process(Event &event) {
+ if ((g_vm->getGameID() != GType_Ringworld) && _action)
+ _action->process(event);
+
if (!event.handled && (event.eventType == EVENT_BUTTON_DOWN) &&
- (_globals->_events.getCursor() == CURSOR_WALK) && _globals->_player._canWalk &&
- (_position != event.mousePos) && _globals->_sceneObjects->contains(this)) {
+ (g_globals->_events.getCursor() == CURSOR_WALK) && g_globals->_player._canWalk &&
+ (_position != event.mousePos) && g_globals->_sceneObjects->contains(this)) {
+
+ if ((g_vm->getGameID() == GType_BlueForce) && !BF_GLOBALS._player._enabled)
+ return;
PlayerMover *newMover = new PlayerMover();
- Common::Point destPos(event.mousePos.x + _globals->_sceneManager._scene->_sceneBounds.left,
- event.mousePos.y + _globals->_sceneManager._scene->_sceneBounds.top);
+ Common::Point destPos(event.mousePos.x + g_globals->_sceneManager._scene->_sceneBounds.left,
+ event.mousePos.y + g_globals->_sceneManager._scene->_sceneBounds.top);
addMover(newMover, &destPos, NULL);
event.handled = true;
@@ -2828,8 +3055,8 @@ void Player::synchronize(Serializer &s) {
s.syncAsByte(_uiEnabled);
s.syncAsSint16LE(_field8C);
- if (_vm->getGameID() == GType_BlueForce)
- s.syncAsSint16LE(_field8E);
+ if (g_vm->getGameID() == GType_BlueForce)
+ s.syncAsByte(_enabled);
}
/*--------------------------------------------------------------------------*/
@@ -2837,7 +3064,7 @@ void Player::synchronize(Serializer &s) {
Region::Region(int resNum, int rlbNum, ResourceType ctlType) {
_regionId = rlbNum;
- byte *regionData = _resourceManager->getResource(ctlType, resNum, rlbNum);
+ byte *regionData = g_resourceManager->getResource(ctlType, resNum, rlbNum);
assert(regionData);
load(regionData);
@@ -2972,7 +3199,7 @@ LineSliceSet Region::mergeSlices(const LineSliceSet &set1, const LineSliceSet &s
* Copies the background covered by the given region to the screen surface
*/
void Region::draw() {
- Rect &sceneBounds = _globals->_sceneManager._scene->_sceneBounds;
+ Rect &sceneBounds = g_globals->_sceneManager._scene->_sceneBounds;
for (int yp = sceneBounds.top; yp < sceneBounds.bottom; ++yp) {
// Generate a line slice set
@@ -2987,10 +3214,10 @@ void Region::draw() {
rect1.right = (rect1.right + 3) & ~3;
Rect rect2 = rect1;
- rect1.translate(-_globals->_sceneOffset.x, -_globals->_sceneOffset.y);
+ rect1.translate(-g_globals->_sceneOffset.x, -g_globals->_sceneOffset.y);
rect2.translate(-sceneBounds.left, -sceneBounds.top);
- _globals->gfxManager().getSurface().copyFrom(_globals->_sceneManager._scene->_backSurface,
+ g_globals->gfxManager().getSurface().copyFrom(g_globals->_sceneManager._scene->_backSurface,
rect1, rect2);
}
}
@@ -3055,8 +3282,8 @@ void Region::uniteRect(const Rect &rect) {
void SceneRegions::load(int sceneNum) {
clear();
- bool altRegions = _vm->getFeatures() & GF_ALT_REGIONS;
- byte *regionData = _resourceManager->getResource(RES_CONTROL, sceneNum, altRegions ? 1 : 9999, true);
+ bool altRegions = g_vm->getFeatures() & GF_ALT_REGIONS;
+ byte *regionData = g_resourceManager->getResource(RES_CONTROL, sceneNum, altRegions ? 1 : 9999, true);
if (regionData) {
int regionCount = READ_LE_UINT16(regionData);
@@ -3277,7 +3504,7 @@ void WalkRegions::load(int sceneNum) {
clear();
_resNum = sceneNum;
- if (_vm->getFeatures() & GF_ALT_REGIONS) {
+ if (g_vm->getFeatures() & GF_ALT_REGIONS) {
loadRevised();
} else {
loadOriginal();
@@ -3288,7 +3515,7 @@ void WalkRegions::load(int sceneNum) {
* This version handles loading walk regions for Ringworld floppy version and Demo #1
*/
void WalkRegions::loadOriginal() {
- byte *regionData = _resourceManager->getResource(RES_WALKRGNS, _resNum, 1, true);
+ byte *regionData = g_resourceManager->getResource(RES_WALKRGNS, _resNum, 1, true);
if (!regionData) {
// No data, so return
_resNum = -1;
@@ -3299,8 +3526,8 @@ void WalkRegions::loadOriginal() {
int dataSize;
// Load the field 18 list
- dataP = _resourceManager->getResource(RES_WALKRGNS, _resNum, 2);
- dataSize = _vm->_memoryManager.getSize(dataP);
+ dataP = g_resourceManager->getResource(RES_WALKRGNS, _resNum, 2);
+ dataSize = g_vm->_memoryManager.getSize(dataP);
assert(dataSize % 10 == 0);
byte *p = dataP;
@@ -3313,8 +3540,8 @@ void WalkRegions::loadOriginal() {
DEALLOCATE(dataP);
// Load the idx list
- dataP = _resourceManager->getResource(RES_WALKRGNS, _resNum, 3);
- dataSize = _vm->_memoryManager.getSize(dataP);
+ dataP = g_resourceManager->getResource(RES_WALKRGNS, _resNum, 3);
+ dataSize = g_vm->_memoryManager.getSize(dataP);
assert(dataSize % 2 == 0);
p = dataP;
@@ -3324,8 +3551,8 @@ void WalkRegions::loadOriginal() {
DEALLOCATE(dataP);
// Load the secondary idx list
- dataP = _resourceManager->getResource(RES_WALKRGNS, _resNum, 4);
- dataSize = _vm->_memoryManager.getSize(dataP);
+ dataP = g_resourceManager->getResource(RES_WALKRGNS, _resNum, 4);
+ dataSize = g_vm->_memoryManager.getSize(dataP);
assert(dataSize % 2 == 0);
p = dataP;
@@ -3335,7 +3562,7 @@ void WalkRegions::loadOriginal() {
DEALLOCATE(dataP);
// Handle the loading of the actual regions themselves
- dataP = _resourceManager->getResource(RES_WALKRGNS, _resNum, 5);
+ dataP = g_resourceManager->getResource(RES_WALKRGNS, _resNum, 5);
byte *pWalkRegion = regionData + 16;
byte *srcP = dataP;
@@ -3366,7 +3593,7 @@ void WalkRegions::loadOriginal() {
* version, it may also be used by future game titles
*/
void WalkRegions::loadRevised() {
- byte *regionData = _resourceManager->getResource(RES_WALKRGNS, _resNum, 2, true);
+ byte *regionData = g_resourceManager->getResource(RES_WALKRGNS, _resNum, 2, true);
if (!regionData) {
// No data, so return
_resNum = -1;
@@ -3449,8 +3676,8 @@ void ScenePriorities::load(int resNum) {
_resNum = resNum;
clear();
- bool altMode = (_vm->getFeatures() & GF_ALT_REGIONS) != 0;
- byte *regionData = _resourceManager->getResource(RES_PRIORITY, resNum, altMode ? 1 : 9999, true);
+ bool altMode = (g_vm->getFeatures() & GF_ALT_REGIONS) != 0;
+ byte *regionData = g_resourceManager->getResource(RES_PRIORITY, resNum, altMode ? 1 : 9999, true);
if (!regionData)
return;
@@ -3474,8 +3701,11 @@ void ScenePriorities::load(int resNum) {
Region *ScenePriorities::find(int priority) {
// If no priority regions are loaded, then return the placeholder region
- if (empty())
- return &_defaultPriorityRegion;
+ if (empty()) {
+ if (g_vm->getGameID() == GType_Ringworld)
+ return &_defaultPriorityRegion;
+ return NULL;
+ }
if (priority > 255)
priority = 255;
@@ -3528,8 +3758,8 @@ GameHandler::GameHandler() : EventHandler() {
}
GameHandler::~GameHandler() {
- if (_globals)
- _globals->_game->removeHandler(this);
+ if (g_globals)
+ g_globals->_game->removeHandler(this);
}
void GameHandler::execute() {
@@ -3559,7 +3789,7 @@ SceneHandler::SceneHandler() {
void SceneHandler::registerHandler() {
postInit();
- _globals->_game->addHandler(this);
+ g_globals->_game->addHandler(this);
}
uint32 SceneHandler::getFrameDifference() {
@@ -3569,83 +3799,103 @@ uint32 SceneHandler::getFrameDifference() {
void SceneHandler::postInit(SceneObjectList *OwnerList) {
_delayTicks = 2;
- _globals->_scenePalette.loadPalette(0);
- _globals->_scenePalette.refresh();
+ g_globals->_scenePalette.loadPalette(0);
+ g_globals->_scenePalette.refresh();
- _globals->_soundManager.postInit();
- _globals->_soundManager.buildDriverList(true);
- _globals->_soundManager.installConfigDrivers();
+ g_globals->_soundManager.postInit();
+ g_globals->_soundManager.buildDriverList(true);
+ g_globals->_soundManager.installConfigDrivers();
- _globals->_game->start();
+ g_globals->_game->start();
}
void SceneHandler::process(Event &event) {
// Main keypress handler
if (!event.handled) {
- _globals->_game->processEvent(event);
+ g_globals->_game->processEvent(event);
if (event.eventType == EVENT_KEYPRESS)
- _globals->_events.setCursorFromFlag();
+ g_globals->_events.setCursorFromFlag();
}
// Check for displaying right-click dialog
if ((event.eventType == EVENT_BUTTON_DOWN) && (event.btnState == BTNSHIFT_RIGHT) &&
- _globals->_player._uiEnabled) {
- RightClickDialog *dlg = new RightClickDialog();
- dlg->execute();
- delete dlg;
+ g_globals->_player._uiEnabled) {
+ g_globals->_game->rightClick();
event.handled = true;
return;
}
// If there is an active scene, pass the event to it
- if (_globals->_sceneManager._scene)
- _globals->_sceneManager._scene->process(event);
+ if (g_globals->_sceneManager._scene)
+ g_globals->_sceneManager._scene->process(event);
if (!event.handled) {
// Separate check for F5 - Save key
if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_F5)) {
// F5 - Save
- _globals->_game->saveGame();
+ g_globals->_game->saveGame();
event.handled = true;
- _globals->_events.setCursorFromFlag();
+ g_globals->_events.setCursorFromFlag();
}
// Check for debugger
if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_d) &&
(event.kbd.flags & Common::KBD_CTRL)) {
// Attach to the debugger
- _vm->_debugger->attach();
- _vm->_debugger->onFrame();
+ g_vm->_debugger->attach();
+ g_vm->_debugger->onFrame();
}
// Mouse press handling
- if (_globals->_player._uiEnabled && (event.eventType == EVENT_BUTTON_DOWN) &&
- !_globals->_sceneItems.empty()) {
+ bool enabled = (g_vm->getGameID() == GType_BlueForce) ? g_globals->_player._enabled :
+ g_globals->_player._uiEnabled;
+ if (enabled && (event.eventType == EVENT_BUTTON_DOWN) && !g_globals->_sceneItems.empty()) {
+ // Check if the mouse is on the player
+ if (g_globals->_player.contains(event.mousePos)) {
+ playerAction(event);
+ if (event.handled)
+ return;
+ }
+
// Scan the item list to find one the mouse is within
- SynchronizedList<SceneItem *>::iterator i = _globals->_sceneItems.begin();
- while ((i != _globals->_sceneItems.end()) && !(*i)->contains(event.mousePos))
- ++i;
-
- if (i != _globals->_sceneItems.end()) {
- // Pass the action to the item
- (*i)->doAction(_globals->_events.getCursor());
- event.handled = _globals->_events.getCursor() != CURSOR_WALK;
-
- if (_globals->_player._uiEnabled && _globals->_player._canWalk &&
- (_globals->_events.getCursor() != CURSOR_LOOK)) {
- _globals->_events.setCursor(CURSOR_WALK);
- } else if (_globals->_player._canWalk && (_globals->_events.getCursor() != CURSOR_LOOK)) {
- _globals->_events.setCursor(CURSOR_WALK);
- } else if (_globals->_player._uiEnabled && (_globals->_events.getCursor() != CURSOR_LOOK)) {
- _globals->_events.setCursor(CURSOR_USE);
+ SynchronizedList<SceneItem *>::iterator i;
+ for (i = g_globals->_sceneItems.begin(); i != g_globals->_sceneItems.end(); ++i) {
+ if ((*i)->contains(event.mousePos)) {
+ // Pass the action to the item
+ bool handled = (*i)->startAction(g_globals->_events.getCursor(), event);
+ if (!handled)
+ // Item wasn't handled, keep scanning
+ continue;
+
+ if ((g_vm->getGameID() == GType_Ringworld) || (g_globals->_events.getCursor() == CURSOR_9999)) {
+ event.handled = g_globals->_events.getCursor() != CURSOR_WALK;
+
+ if (g_globals->_player._uiEnabled && g_globals->_player._canWalk &&
+ (g_globals->_events.getCursor() != CURSOR_LOOK)) {
+ g_globals->_events.setCursor(CURSOR_WALK);
+ } else if (g_globals->_player._canWalk && (g_globals->_events.getCursor() != CURSOR_LOOK)) {
+ g_globals->_events.setCursor(CURSOR_WALK);
+ } else if (g_globals->_player._uiEnabled && (g_globals->_events.getCursor() != CURSOR_LOOK)) {
+ g_globals->_events.setCursor(CURSOR_USE);
+ }
+
+ if (g_vm->getGameID() == GType_BlueForce)
+ event.handled = true;
+ } else if (g_vm->getGameID() != GType_Ringworld) {
+ event.handled = true;
+ }
+ break;
}
}
- // Handle player processing
- _globals->_player.process(event);
+ // Handle any fallback text display
+ processEnd(event);
}
+
+ // Handle player processing
+ g_globals->_player.process(event);
}
}
@@ -3654,7 +3904,7 @@ void SceneHandler::dispatch() {
if (_saveGameSlot != -1) {
int saveSlot = _saveGameSlot;
_saveGameSlot = -1;
- Common::Error err = _saver->save(saveSlot, _saveName);
+ Common::Error err = g_saver->save(saveSlot, _saveName);
// FIXME: Make use of the description string in err to enhance
// the error reported to the user.
if (err.getCode() != Common::kNoError)
@@ -3663,49 +3913,49 @@ void SceneHandler::dispatch() {
if (_loadGameSlot != -1) {
int loadSlot = _loadGameSlot;
_loadGameSlot = -1;
- _saver->restore(loadSlot);
- _globals->_events.setCursorFromFlag();
+ g_saver->restore(loadSlot);
+ g_globals->_events.setCursorFromFlag();
}
- _globals->_soundManager.dispatch();
- _globals->_scenePalette.signalListeners();
+ g_globals->_soundManager.dispatch();
+ g_globals->_scenePalette.signalListeners();
// Dispatch to any objects registered in the scene
- _globals->_sceneObjects->recurse(SceneHandler::dispatchObject);
+ g_globals->_sceneObjects->recurse(SceneHandler::dispatchObject);
// If a scene is active, then dispatch to it
- if (_globals->_sceneManager._scene)
- _globals->_sceneManager._scene->dispatch();
+ if (g_globals->_sceneManager._scene)
+ g_globals->_sceneManager._scene->dispatch();
// Not actually used
//_eventListeners.forEach(SceneHandler::handleListener);
// Handle pending events
Event event;
- if (_globals->_events.getEvent(event)) {
+ if (g_globals->_events.getEvent(event)) {
// Process pending events
do {
process(event);
- } while (_globals->_events.getEvent(event));
- } else if (_vm->getGameID() == GType_BlueForce) {
+ } while (g_globals->_events.getEvent(event));
+ } else if (g_vm->getGameID() == GType_BlueForce) {
// For Blue Force, 'none' events need to be generated in the absence of any
event.eventType = EVENT_NONE;
- event.mousePos = _globals->_events._mousePos;
+ event.mousePos = g_globals->_events._mousePos;
process(event);
}
// Handle drawing the contents of the scene
- if (_globals->_sceneManager._scene)
- _globals->_sceneObjects->draw();
+ if (g_globals->_sceneManager._scene)
+ g_globals->_sceneObjects->draw();
// Check to see if any scene change is required
- _globals->_sceneManager.checkScene();
+ g_globals->_sceneManager.checkScene();
// Signal the ScummVM debugger
- _vm->_debugger->onFrame();
+ g_vm->_debugger->onFrame();
// Delay between frames
- _globals->_events.delay(_delayTicks);
+ g_globals->_events.delay(_delayTicks);
}
void SceneHandler::dispatchObject(EventHandler *obj) {
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index b1cbf74bd3..5d26b14265 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -61,7 +61,7 @@ public:
int _frame;
public:
InvObject(int sceneNumber, int rlbNum, int cursorNum, CursorType cursorId, const Common::String description);
- InvObject(int visage, int strip, int frame, int sceneNumber);
+ InvObject(int visage, int strip, int frame);
bool inInventory() const { return _sceneNumber == 1; }
void setCursor();
@@ -78,6 +78,9 @@ public:
InvObject *_selectedItem;
InvObjectList();
+ int indexOf(InvObject *obj) const;
+ InvObject *getItem(int objectNum);
+ int getObjectScene(int objectNum);
virtual Common::String getClassName() { return "InvObjectList"; }
virtual void synchronize(Serializer &s);
@@ -163,7 +166,7 @@ public:
};
#define ADD_PLAYER_MOVER(X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \
- _globals->_player.addMover(mover, &pt, this); }
+ g_globals->_player.addMover(mover, &pt, this); }
#define ADD_PLAYER_MOVER_NULL(OBJ, X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \
OBJ.addMover(mover, &pt, NULL); }
#define ADD_PLAYER_MOVER_THIS(OBJ, X, Y) { Common::Point pt(X, Y); PlayerMover *mover = new PlayerMover(); \
@@ -368,6 +371,7 @@ public:
bool loadPalette(int paletteNum);
void refresh();
void setPalette(int index, int count);
+ void setEntry(int index, uint r, uint g, uint b);
uint8 indexOf(uint r, uint g, uint b, int threshold = 0xffff);
void getPalette(int start = 0, int count = 256);
void signalListeners();
@@ -411,7 +415,7 @@ public:
virtual Common::String getClassName() { return "SceneItem"; }
virtual void remove();
virtual void destroy() {}
- virtual void startMover(CursorType action) { doAction(action); }
+ virtual bool startAction(CursorType action, Event &event);
virtual void doAction(int action);
bool contains(const Common::Point &pt);
@@ -419,6 +423,7 @@ public:
void setBounds(const int ys, const int xe, const int ye, const int xs) { _bounds = Rect(MIN(xs, xe), MIN(ys, ye), MAX(xs, xe), MAX(ys, ye)); }
static void display(int resNum, int lineNum, ...);
static void display2(int resNum, int lineNum);
+ static void display(const Common::String &msg);
};
class SceneItemExt : public SceneItem {
@@ -435,7 +440,7 @@ public:
class SceneHotspot : public SceneItem {
public:
SceneHotspot() : SceneItem() {}
-
+ virtual bool startAction(CursorType action, Event &event);
virtual Common::String getClassName() { return "SceneHotspot"; }
virtual void doAction(int action);
};
@@ -445,12 +450,25 @@ public:
int _resNum, _lookLineNum, _useLineNum, _talkLineNum;
NamedHotspot();
- virtual void doAction(int action);
+
+ virtual bool startAction(CursorType action, Event &event);
virtual Common::String getClassName() { return "NamedHotspot"; }
virtual void synchronize(Serializer &s);
- void setup(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum);
- virtual void setup(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item);
- virtual void setup(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode);
+ virtual void setDetails(int ys, int xs, int ye, int xe, const int resnum, const int lookLineNum, const int useLineNum);
+ virtual void setDetails(const Rect &bounds, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode, SceneItem *item);
+ virtual void setDetails(int sceneRegionId, int resNum, int lookLineNum, int talkLineNum, int useLineNum, int mode);
+};
+
+class NamedHotspotExt : public NamedHotspot {
+public:
+ int _flag;
+ NamedHotspotExt() { _flag = 0; }
+
+ virtual Common::String getClassName() { return "NamedHotspot"; }
+ virtual void synchronize(Serializer &s) {
+ NamedHotspot::synchronize(s);
+ s.syncAsSint16LE(_flag);
+ }
};
enum AnimateMode {ANIM_MODE_NONE = 0, ANIM_MODE_1 = 1, ANIM_MODE_2 = 2, ANIM_MODE_3 = 3,
@@ -464,9 +482,12 @@ class SceneObject;
class Visage {
private:
byte *_data;
+
+ void flip(GfxSurface &s);
public:
int _resNum;
int _rlbNum;
+ bool _flipHoriz;
public:
Visage();
Visage(const Visage &v);
@@ -475,7 +496,7 @@ public:
void setVisage(int resNum, int rlbNum = 9999);
GfxSurface getFrame(int frameNum);
int getFrameCount() const;
- Visage &operator=(const Visage &s);
+ Visage &operator=(const Visage &gfxSurface);
};
class SceneObjectWrapper : public EventHandler {
@@ -509,7 +530,6 @@ private:
int getNewFrame();
void animEnded();
int changeFrame();
- bool isNoMover() const { return !_mover || (_regionIndex > 0); }
public:
uint32 _updateStartFrame;
uint32 _walkStartFrame;
@@ -559,10 +579,12 @@ public:
void animate(AnimateMode animMode, ...);
SceneObject *clone() const;
void checkAngle(const SceneObject *obj);
+ void checkAngle(const Common::Point &pt);
void hide();
void show();
int getSpliceArea(const SceneObject *obj);
int getFrameCount();
+ bool isNoMover() const { return !_mover || (_regionIndex > 0); }
virtual void synchronize(Serializer &s);
virtual Common::String getClassName() { return "SceneObject"; }
@@ -577,16 +599,16 @@ public:
virtual void draw();
virtual void proc19() {}
virtual void updateScreen();
- // New methods introduced by Blue FOrce
- virtual void updateAngle(SceneObject *sceneObj);
+ // New methods introduced by Blue Force
+ virtual void updateAngle(const Common::Point &pt);
virtual void changeAngle(int angle);
void setup(int visage, int stripFrameNum, int frameNum, int posX, int posY, int priority);
};
-class AltSceneObject: public SceneObject {
+class BackgroundSceneObject: public SceneObject {
public:
- virtual Common::String getClassName() { return "AltObjectExt"; }
+ virtual Common::String getClassName() { return "BackgroundSceneObject"; }
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void draw();
};
@@ -609,6 +631,7 @@ public:
virtual void synchronize(Serializer &s);
virtual Common::String getClassName() { return "SceneText"; }
virtual GfxSurface getFrame() { return _textSurface; }
+ virtual void updateScreen();
};
class Player : public SceneObject {
@@ -616,7 +639,7 @@ public:
bool _canWalk;
bool _uiEnabled;
int _field8C;
- int _field8E;
+ bool _enabled;
public:
Player();
@@ -725,6 +748,7 @@ public:
_objList.remove(sceneObj);
_listAltered = true;
}
+ void clear() { _objList.clear(); }
};
class ScenePriorities : public Common::List<Region> {
@@ -811,6 +835,8 @@ public:
assert((idx >= 1) && (idx <= (int)_regionList.size()));
return _regionList[idx - 1];
}
+ void proc1(int v) { warning("TODO: WalkRegions::proc1"); }
+ void proc2(int v) { warning("TODO: WalkRegions::proc2"); }
};
/*--------------------------------------------------------------------------*/
@@ -851,6 +877,9 @@ public:
int _delayTicks;
Common::String _saveName;
uint32 _prevFrameNumber;
+protected:
+ virtual void playerAction(Event &event) {}
+ virtual void processEnd(Event &event) {}
public:
SceneHandler();
void registerHandler();
diff --git a/engines/tsage/debugger.cpp b/engines/tsage/debugger.cpp
index e3c4569dd2..a0e8b9edba 100644
--- a/engines/tsage/debugger.cpp
+++ b/engines/tsage/debugger.cpp
@@ -32,6 +32,7 @@ Debugger::Debugger() : GUI::Debugger() {
DCmd_Register("scene", WRAP_METHOD(Debugger, Cmd_Scene));
DCmd_Register("walk_regions", WRAP_METHOD(Debugger, Cmd_WalkRegions));
DCmd_Register("priority_regions", WRAP_METHOD(Debugger, Cmd_PriorityRegions));
+ DCmd_Register("scene_regions", WRAP_METHOD(Debugger, Cmd_SceneRegions));
DCmd_Register("setflag", WRAP_METHOD(Debugger, Cmd_SetFlag));
DCmd_Register("getflag", WRAP_METHOD(Debugger, Cmd_GetFlag));
DCmd_Register("clearflag", WRAP_METHOD(Debugger, Cmd_ClearFlag));
@@ -67,9 +68,9 @@ bool Debugger::Cmd_Scene(int argc, const char **argv) {
}
if (argc == 3)
- _globals->_sceneManager._sceneNumber = strToInt(argv[2]);
+ g_globals->_sceneManager._sceneNumber = strToInt(argv[2]);
- _globals->_sceneManager.changeScene(strToInt(argv[1]));
+ g_globals->_sceneManager.changeScene(strToInt(argv[1]));
return false;
}
@@ -86,20 +87,20 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) {
int color = 16;
// Lock the background surface for access
- Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface();
+ Graphics::Surface destSurface = g_globals->_sceneManager._scene->_backSurface.lockSurface();
// Loop through drawing each walk region in a different color to the background surface
Common::String regionsDesc;
- for (uint regionIndex = 0; regionIndex < _globals->_walkRegions._regionList.size(); ++regionIndex, ++color) {
- WalkRegion &wr = _globals->_walkRegions._regionList[regionIndex];
+ for (uint regionIndex = 0; regionIndex < g_globals->_walkRegions._regionList.size(); ++regionIndex, ++color) {
+ WalkRegion &wr = g_globals->_walkRegions._regionList[regionIndex];
for (int yp = wr._bounds.top; yp < wr._bounds.bottom; ++yp) {
LineSliceSet sliceSet = wr.getLineSlices(yp);
for (uint idx = 0; idx < sliceSet.items.size(); ++idx)
- destSurface.hLine(sliceSet.items[idx].xs - _globals->_sceneOffset.x, yp,
- sliceSet.items[idx].xe - _globals->_sceneOffset.x, color);
+ destSurface.hLine(sliceSet.items[idx].xs - g_globals->_sceneOffset.x, yp,
+ sliceSet.items[idx].xe - g_globals->_sceneOffset.x, color);
}
regionsDesc += Common::String::format("Region #%d d bounds=%d,%d,%d,%d\n",
@@ -107,12 +108,12 @@ bool Debugger::Cmd_WalkRegions(int argc, const char **argv) {
}
// Release the surface
- _globals->_sceneManager._scene->_backSurface.unlockSurface();
+ g_globals->_sceneManager._scene->_backSurface.unlockSurface();
// Mark the scene as requiring a full redraw
- _globals->_paneRefreshFlag[0] = 2;
+ g_globals->_paneRefreshFlag[0] = 2;
- DebugPrintf("Total regions = %d\n", _globals->_walkRegions._regionList.size());
+ DebugPrintf("Total regions = %d\n", g_globals->_walkRegions._regionList.size());
DebugPrintf("%s\n", regionsDesc.c_str());
return false;
@@ -133,12 +134,12 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) {
int count = 0;
// Lock the background surface for access
- Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface();
+ Graphics::Surface destSurface = g_globals->_sceneManager._scene->_backSurface.lockSurface();
- Common::List<Region>::iterator i = _globals->_sceneManager._scene->_priorities.begin();
+ Common::List<Region>::iterator i = g_globals->_sceneManager._scene->_priorities.begin();
Common::String regionsDesc;
- for (; i != _globals->_sceneManager._scene->_priorities.end(); ++i, ++color, ++count) {
+ for (; i != g_globals->_sceneManager._scene->_priorities.end(); ++i, ++color, ++count) {
Region &r = *i;
if ((regionNum == 0) || (regionNum == (count + 1))) {
@@ -146,8 +147,8 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) {
byte *destP = (byte *)destSurface.getBasePtr(0, y);
for (int x = 0; x < destSurface.w; ++x) {
- if (r.contains(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + x,
- _globals->_sceneManager._scene->_sceneBounds.top + y)))
+ if (r.contains(Common::Point(g_globals->_sceneManager._scene->_sceneBounds.left + x,
+ g_globals->_sceneManager._scene->_sceneBounds.top + y)))
*destP = color;
++destP;
}
@@ -159,10 +160,63 @@ bool Debugger::Cmd_PriorityRegions(int argc, const char **argv) {
}
// Release the surface
- _globals->_sceneManager._scene->_backSurface.unlockSurface();
+ g_globals->_sceneManager._scene->_backSurface.unlockSurface();
// Mark the scene as requiring a full redraw
- _globals->_paneRefreshFlag[0] = 2;
+ g_globals->_paneRefreshFlag[0] = 2;
+
+ DebugPrintf("Total regions = %d\n", count);
+ DebugPrintf("%s", regionsDesc.c_str());
+
+ return true;
+}
+
+/*
+ * This command draws the scene regions onto the screen. These are the regions
+ * used by hotspots that have non-rectangular areas.
+ */
+bool Debugger::Cmd_SceneRegions(int argc, const char **argv) {
+ int regionNum = 0;
+
+ // Check for an optional specific region to display
+ if (argc == 2)
+ regionNum = strToInt(argv[1]);
+
+ // Color index to use for the first priority region
+ int color = 16;
+ int count = 0;
+
+ // Lock the background surface for access
+ Graphics::Surface destSurface = g_globals->_sceneManager._scene->_backSurface.lockSurface();
+
+ Common::List<Region>::iterator i = g_globals->_sceneRegions.begin();
+ Common::String regionsDesc;
+
+ for (; i != g_globals->_sceneRegions.end(); ++i, ++color, ++count) {
+ Region &r = *i;
+
+ if ((regionNum == 0) || (regionNum == (count + 1))) {
+ for (int y = 0; y < destSurface.h; ++y) {
+ byte *destP = (byte *)destSurface.getBasePtr(0, y);
+
+ for (int x = 0; x < destSurface.w; ++x) {
+ if (r.contains(Common::Point(g_globals->_sceneManager._scene->_sceneBounds.left + x,
+ g_globals->_sceneManager._scene->_sceneBounds.top + y)))
+ *destP = color;
+ ++destP;
+ }
+ }
+ }
+
+ regionsDesc += Common::String::format("Region id = %d bounds=%d,%d,%d,%d\n",
+ r._regionId, r._bounds.left, r._bounds.top, r._bounds.right, r._bounds.bottom);
+ }
+
+ // Release the surface
+ g_globals->_sceneManager._scene->_backSurface.unlockSurface();
+
+ // Mark the scene as requiring a full redraw
+ g_globals->_paneRefreshFlag[0] = 2;
DebugPrintf("Total regions = %d\n", count);
DebugPrintf("%s", regionsDesc.c_str());
@@ -181,7 +235,7 @@ bool Debugger::Cmd_SetFlag(int argc, const char **argv) {
}
int flagNum = strToInt(argv[1]);
- _globals->setFlag(flagNum);
+ g_globals->setFlag(flagNum);
return true;
}
@@ -196,7 +250,7 @@ bool Debugger::Cmd_GetFlag(int argc, const char **argv) {
}
int flagNum = strToInt(argv[1]);
- DebugPrintf("Value: %d\n", _globals->getFlag(flagNum));
+ DebugPrintf("Value: %d\n", g_globals->getFlag(flagNum));
return true;
}
@@ -211,7 +265,7 @@ bool Debugger::Cmd_ClearFlag(int argc, const char **argv) {
}
int flagNum = strToInt(argv[1]);
- _globals->clearFlag(flagNum);
+ g_globals->clearFlag(flagNum);
return true;
}
@@ -390,31 +444,32 @@ bool Debugger::Cmd_MoveObject(int argc, const char **argv) {
*/
bool Debugger::Cmd_Hotspots(int argc, const char **argv) {
int colIndex = 16;
- const Rect &sceneBounds = _globals->_sceneManager._scene->_sceneBounds;
+ const Rect &sceneBounds = g_globals->_sceneManager._scene->_sceneBounds;
// Lock the background surface for access
- Graphics::Surface destSurface = _globals->_sceneManager._scene->_backSurface.lockSurface();
+ Graphics::Surface destSurface = g_globals->_sceneManager._scene->_backSurface.lockSurface();
// Iterate through the scene items
SynchronizedList<SceneItem *>::iterator i;
- for (i = _globals->_sceneItems.reverse_begin(); i != _globals->_sceneItems.end(); --i, ++colIndex) {
+ for (i = g_globals->_sceneItems.reverse_begin(); i != g_globals->_sceneItems.end(); --i, ++colIndex) {
SceneItem *o = *i;
// Draw the contents of the hotspot area
if (o->_sceneRegionId == 0) {
// Scene item doesn't use a region, so fill in the entire area
- destSurface.fillRect(Rect(o->_bounds.left - sceneBounds.left, o->_bounds.top - sceneBounds.top,
- o->_bounds.right - sceneBounds.left - 1, o->_bounds.bottom - sceneBounds.top - 1), colIndex);
+ if ((o->_bounds.right > o->_bounds.left) && (o->_bounds.bottom > o->_bounds.top))
+ destSurface.fillRect(Rect(o->_bounds.left - sceneBounds.left, o->_bounds.top - sceneBounds.top,
+ o->_bounds.right - sceneBounds.left - 1, o->_bounds.bottom - sceneBounds.top - 1), colIndex);
} else {
// Scene uses a region, so get it and use it to fill out only the correct parts
- SceneRegions::iterator ri = _globals->_sceneRegions.begin();
- while ((ri != _globals->_sceneRegions.end()) && ((*ri)._regionId != o->_sceneRegionId))
+ SceneRegions::iterator ri = g_globals->_sceneRegions.begin();
+ while ((ri != g_globals->_sceneRegions.end()) && ((*ri)._regionId != o->_sceneRegionId))
++ri;
- if (ri != _globals->_sceneRegions.end()) {
+ if (ri != g_globals->_sceneRegions.end()) {
// Fill out the areas defined by the region
Region &r = *ri;
-
+
for (int y = r._bounds.top; y < r._bounds.bottom; ++y) {
LineSliceSet set = r.getLineSlices(y);
@@ -427,10 +482,10 @@ bool Debugger::Cmd_Hotspots(int argc, const char **argv) {
}
// Release the surface
- _globals->_sceneManager._scene->_backSurface.unlockSurface();
+ g_globals->_sceneManager._scene->_backSurface.unlockSurface();
// Mark the scene as requiring a full redraw
- _globals->_paneRefreshFlag[0] = 2;
+ g_globals->_paneRefreshFlag[0] = 2;
return false;
}
@@ -445,7 +500,7 @@ bool Debugger::Cmd_Sound(int argc, const char **argv) {
}
int soundNum = strToInt(argv[1]);
- _globals->_soundHandler.play(soundNum);
+ g_globals->_soundHandler.play(soundNum);
return false;
}
diff --git a/engines/tsage/debugger.h b/engines/tsage/debugger.h
index 8bc1b06336..fcdbc2d243 100644
--- a/engines/tsage/debugger.h
+++ b/engines/tsage/debugger.h
@@ -37,6 +37,7 @@ protected:
bool Cmd_Scene(int argc, const char **argv);
bool Cmd_WalkRegions(int argc, const char **argv);
bool Cmd_PriorityRegions(int argc, const char **argv);
+ bool Cmd_SceneRegions(int argc, const char **argv);
bool Cmd_SetFlag(int argc, const char **argv);
bool Cmd_GetFlag(int argc, const char **argv);
bool Cmd_ClearFlag(int argc, const char **argv);
diff --git a/engines/tsage/detection.cpp b/engines/tsage/detection.cpp
index f12efc02e8..44a25085fa 100644
--- a/engines/tsage/detection.cpp
+++ b/engines/tsage/detection.cpp
@@ -58,7 +58,7 @@ Common::String TSageEngine::getPrimaryFilename() const {
} // End of namespace TsAGE
static const PlainGameDescriptor tSageGameTitles[] = {
- { "tsage", "Unknown Tsunami TSAGE-based Game" },
+ { "tsage", "Tsunami TsAGE-based Game" },
{ "ringworld", "Ringworld: Revenge of the Patriarch" },
{ "blueforce", "Blue Force" },
{ 0, 0 }
@@ -131,6 +131,8 @@ public:
if (in) {
if (TsAGE::Saver::readSavegameHeader(in, header)) {
saveList.push_back(SaveStateDescriptor(slot, header.saveName));
+
+ header.thumbnail->free();
delete header.thumbnail;
}
@@ -154,22 +156,25 @@ public:
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const {
Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(
generateGameStateFileName(target, slot));
- assert(f);
+
+ if (f) {
+ TsAGE::tSageSavegameHeader header;
+ TsAGE::Saver::readSavegameHeader(f, header);
+ delete f;
+
+ // Create the return descriptor
+ SaveStateDescriptor desc(slot, header.saveName);
+ desc.setDeletableFlag(true);
+ desc.setWriteProtectedFlag(false);
+ 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;
+ }
- TsAGE::tSageSavegameHeader header;
- TsAGE::Saver::readSavegameHeader(f, header);
- delete f;
-
- // Create the return descriptor
- SaveStateDescriptor desc(slot, header.saveName);
- desc.setDeletableFlag(true);
- desc.setWriteProtectedFlag(false);
- 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;
+ return SaveStateDescriptor();
}
};
diff --git a/engines/tsage/dialogs.cpp b/engines/tsage/dialogs.cpp
index ae385b8c15..002835e76b 100644
--- a/engines/tsage/dialogs.cpp
+++ b/engines/tsage/dialogs.cpp
@@ -64,16 +64,16 @@ MessageDialog::MessageDialog(const Common::String &message, const Common::String
setDefaults();
// Set the dialog's center
- setCenter(_globals->_dialogCenter.x, _globals->_dialogCenter.y);
+ setCenter(g_globals->_dialogCenter.x, g_globals->_dialogCenter.y);
}
int MessageDialog::show(const Common::String &message, const Common::String &btn1Message, const Common::String &btn2Message) {
// Ensure that the cursor is the arrow
- _globals->_events.setCursor(CURSOR_ARROW);
+ g_globals->_events.setCursor(CURSOR_ARROW);
int result = show2(message, btn1Message, btn2Message);
- _globals->_events.setCursorFromFlag();
+ g_globals->_events.setCursorFromFlag();
return result;
}
@@ -109,186 +109,6 @@ ConfigDialog::ConfigDialog() : GUI::OptionsDialog("", "GlobalConfig") {
/*--------------------------------------------------------------------------*/
-#define BUTTON_WIDTH 28
-#define BUTTON_HEIGHT 29
-
-RightClickButton::RightClickButton(int buttonIndex, int xp, int yp) : GfxButton() {
- _buttonIndex = buttonIndex;
- this->_bounds.left = xp;
- this->_bounds.top = yp;
- this->_bounds.setWidth(BUTTON_WIDTH);
- this->_bounds.setHeight(BUTTON_HEIGHT);
- _savedButton = NULL;
-}
-
-void RightClickButton::highlight() {
- if (_savedButton) {
- // Button was previously highlighted, so de-highlight by restoring saved area
- _globals->gfxManager().copyFrom(*_savedButton, _bounds.left, _bounds.top);
- delete _savedButton;
- _savedButton = NULL;
- } else {
- // Highlight button by getting the needed highlighted image resource
- _savedButton = Surface_getArea(_globals->gfxManager().getSurface(), _bounds);
-
- uint size;
- byte *imgData = _resourceManager->getSubResource(7, 2, _buttonIndex, &size);
-
- GfxSurface btnSelected = surfaceFromRes(imgData);
- _globals->gfxManager().copyFrom(btnSelected, _bounds.left, _bounds.top);
-
- DEALLOCATE(imgData);
- }
-}
-
-/*--------------------------------------------------------------------------*/
-
-/**
- * This dialog implements the right-click dialog
- */
-RightClickDialog::RightClickDialog() : GfxDialog(),
- _walkButton(1, 48, 12), _lookButton(2, 31, 29), _useButton(3, 65, 29),
- _talkButton(4, 14, 47), _inventoryButton(5, 48, 47), _optionsButton(6, 83, 47) {
- Rect rectArea, dialogRect;
-
- // Set the palette and change the cursor
- _gfxManager.setDialogPalette();
- _globals->_events.setCursor(CURSOR_ARROW);
-
- // Get the dialog image
- _surface = surfaceFromRes(7, 1, 1);
-
- // Set the dialog position
- dialogRect.resize(_surface, 0, 0, 100);
- dialogRect.center(_globals->_events._mousePos.x, _globals->_events._mousePos.y);
-
- // Ensure the dialog will be entirely on-screen
- Rect screenRect = _globals->gfxManager()._bounds;
- screenRect.collapse(4, 4);
- dialogRect.contain(screenRect);
-
- _bounds = dialogRect;
- _gfxManager._bounds = _bounds;
-
- _highlightedButton = NULL;
- _selectedAction = -1;
-}
-
-RightClickDialog::~RightClickDialog() {
-}
-
-RightClickButton *RightClickDialog::findButton(const Common::Point &pt) {
- RightClickButton *btnList[] = { &_walkButton, &_lookButton, &_useButton, &_talkButton, &_inventoryButton, &_optionsButton };
-
- for (int i = 0; i < 6; ++i) {
- btnList[i]->_owner = this;
-
- if (btnList[i]->_bounds.contains(pt))
- return btnList[i];
- }
-
- return NULL;
-}
-
-void RightClickDialog::draw() {
- // Save the covered background area
- _savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds);
-
- // Draw the dialog image
- _globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top);
-}
-
-bool RightClickDialog::process(Event &event) {
- switch (event.eventType) {
- case EVENT_MOUSE_MOVE: {
- // Check whether a button is highlighted
- RightClickButton *btn = findButton(event.mousePos);
-
- if (btn != _highlightedButton) {
- // De-highlight any previously selected button
- if (_highlightedButton) {
- _highlightedButton->highlight();
- _highlightedButton = NULL;
- }
- if (btn) {
- // Highlight the new button
- btn->highlight();
- _highlightedButton = btn;
- }
- }
- event.handled = true;
- return true;
- }
-
- case EVENT_BUTTON_DOWN:
- // If a button is highlighted, then flag the selected button index
- if (_highlightedButton)
- _selectedAction = _highlightedButton->_buttonIndex;
- else
- _selectedAction = _lookButton._buttonIndex;
- event.handled = true;
- return true;
-
- default:
- break;
- }
-
- return false;
-}
-
-void RightClickDialog::execute() {
- // Draw the dialog
- draw();
-
- // Dialog event handler loop
- _gfxManager.activate();
-
- while (!_vm->shouldQuit() && (_selectedAction == -1)) {
- Event evt;
- while (_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) {
- evt.mousePos.x -= _bounds.left;
- evt.mousePos.y -= _bounds.top;
-
- process(evt);
- }
-
- g_system->delayMillis(10);
- g_system->updateScreen();
- }
-
- // Execute the specified action
- switch (_selectedAction) {
- case 1:
- // Look action
- _globals->_events.setCursor(CURSOR_LOOK);
- break;
- case 2:
- // Walk action
- _globals->_events.setCursor(CURSOR_WALK);
- break;
- case 3:
- // Use cursor
- _globals->_events.setCursor(CURSOR_USE);
- break;
- case 4:
- // Talk cursor
- _globals->_events.setCursor(CURSOR_TALK);
- break;
- case 5:
- // Inventory dialog
- InventoryDialog::show();
- break;
- case 6:
- // Dialog options
- OptionsDialog::show();
- break;
- }
-
- _gfxManager.deactivate();
-}
-
-/*--------------------------------------------------------------------------*/
-
void ModalDialog::draw() {
// Set the palette for use in the dialog
setPalette();
@@ -296,7 +116,7 @@ void ModalDialog::draw() {
// Make a backup copy of the area the dialog will occupy
Rect tempRect = _bounds;
tempRect.collapse(-10, -10);
- _savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), tempRect);
+ _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), tempRect);
_gfxManager.activate();
@@ -318,7 +138,7 @@ void ModalDialog::drawFrame() {
_bounds.collapse(-10, -10);
// Fill the dialog area
- _globals->gfxManager().fillRect(origRect, 54);
+ g_globals->gfxManager().fillRect(origRect, 54);
// Draw top line
GfxSurface surface = surfaceFromRes(8, 1, 7);
@@ -465,14 +285,14 @@ void InventoryDialog::execute() {
bool lookFlag = false;
_gfxManager.activate();
- while (!_vm->shouldQuit()) {
+ while (!g_vm->shouldQuit()) {
// Get events
Event event;
- while (!_globals->_events.getEvent(event) && !_vm->shouldQuit()) {
+ while (!g_globals->_events.getEvent(event) && !g_vm->shouldQuit()) {
g_system->delayMillis(10);
g_system->updateScreen();
}
- if (_vm->shouldQuit())
+ if (g_vm->shouldQuit())
break;
hiliteObj = NULL;
@@ -499,18 +319,18 @@ void InventoryDialog::execute() {
if (hiliteObj == &_btnOk) {
// Ok button clicked
if (lookFlag)
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
break;
} else if (hiliteObj == &_btnLook) {
// Look button clicked
if (_btnLook._message == LOOK_BTN_STRING) {
_btnLook._message = PICK_BTN_STRING;
lookFlag = 1;
- _globals->_events.setCursor(CURSOR_LOOK);
+ g_globals->_events.setCursor(CURSOR_LOOK);
} else {
_btnLook._message = LOOK_BTN_STRING;
lookFlag = 0;
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
}
hiliteObj->draw();
@@ -518,7 +338,7 @@ void InventoryDialog::execute() {
// Inventory item selected
InvObject *invObject = static_cast<GfxInvImage *>(hiliteObj)->_invObject;
if (lookFlag) {
- _globals->_screenSurface.displayText(invObject->_description);
+ g_globals->_screenSurface.displayText(invObject->_description);
} else {
RING_INVENTORY._selectedItem = invObject;
invObject->setCursor();
@@ -540,19 +360,20 @@ void OptionsDialog::show() {
if (btn == &dlg->_btnQuit) {
// Quit game
if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1) {
- _vm->quitGame();
+ g_vm->quitGame();
}
} else if (btn == &dlg->_btnRestart) {
// Restart game
- _globals->_game->restartGame();
+ g_globals->_game->restartGame();
} else if (btn == &dlg->_btnSound) {
// Sound dialog
+ SoundDialog::execute();
} else if (btn == &dlg->_btnSave) {
// Save button
- _globals->_game->saveGame();
+ g_globals->_game->saveGame();
} else if (btn == &dlg->_btnRestore) {
// Restore button
- _globals->_game->restoreGame();
+ g_globals->_game->restoreGame();
}
dlg->remove();
@@ -594,5 +415,14 @@ OptionsDialog::OptionsDialog() {
setCenter(160, 100);
}
+/*--------------------------------------------------------------------------*/
+
+void SoundDialog::execute() {
+ ConfigDialog *dlg = new ConfigDialog();
+ dlg->runModal();
+ delete dlg;
+ g_globals->_soundManager.syncSounds();
+ g_globals->_events.setCursorFromFlag();
+}
} // End of namespace TsAGE
diff --git a/engines/tsage/dialogs.h b/engines/tsage/dialogs.h
index 55adb6c813..35ed60ba1a 100644
--- a/engines/tsage/dialogs.h
+++ b/engines/tsage/dialogs.h
@@ -49,35 +49,6 @@ public:
ConfigDialog();
};
-class RightClickButton : public GfxButton {
-private:
- GfxSurface *_savedButton;
-public:
- int _buttonIndex;
-
- RightClickButton(int buttonIndex, int xp, int yp);
- ~RightClickButton() { delete _savedButton; }
-
- virtual void highlight();
-};
-
-class RightClickDialog : public GfxDialog {
-private:
- GfxSurface _surface;
- RightClickButton *_highlightedButton;
- int _selectedAction;
- RightClickButton _walkButton, _lookButton, _useButton, _talkButton, _inventoryButton, _optionsButton;
-
- RightClickButton *findButton(const Common::Point &pt);
-public:
- RightClickDialog();
- ~RightClickDialog();
-
- virtual void draw();
- virtual bool process(Event &event);
- void execute();
-};
-
/*--------------------------------------------------------------------------*/
class ModalDialog : public GfxDialog {
@@ -128,6 +99,13 @@ public:
static void show();
};
+/*--------------------------------------------------------------------------*/
+
+class SoundDialog {
+public:
+ static void execute();
+};
+
} // End of namespace TsAGE
#endif
diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp
index a6471dc8ab..940709c8c7 100644
--- a/engines/tsage/events.cpp
+++ b/engines/tsage/events.cpp
@@ -39,8 +39,8 @@ EventsClass::EventsClass() {
_frameNumber = 0;
_priorFrameTime = 0;
_prevDelayFrame = 0;
- _saver->addListener(this);
- _saver->addLoadNotifier(&EventsClass::loadNotifierProc);
+ g_saver->addListener(this);
+ g_saver->addLoadNotifier(&EventsClass::loadNotifierProc);
}
bool EventsClass::pollEvent() {
@@ -79,7 +79,7 @@ bool EventsClass::pollEvent() {
void EventsClass::waitForPress(int eventMask) {
Event evt;
- while (!_vm->shouldQuit() && !getEvent(evt, eventMask))
+ while (!g_vm->shouldQuit() && !getEvent(evt, eventMask))
g_system->delayMillis(10);
}
@@ -87,7 +87,7 @@ void EventsClass::waitForPress(int eventMask) {
* Standard event retrieval, which only returns keyboard and mouse clicks
*/
bool EventsClass::getEvent(Event &evt, int eventMask) {
- while (pollEvent() && !_vm->shouldQuit()) {
+ while (pollEvent() && !g_vm->shouldQuit()) {
evt.handled = false;
evt.eventType = EVENT_NONE;
evt.mousePos = _event.mouse;
@@ -143,43 +143,69 @@ void EventsClass::setCursor(CursorType cursorType) {
return;
_lastCursor = cursorType;
- _globals->clearFlag(122);
+ g_globals->clearFlag(122);
CursorMan.showMouse(true);
const byte *cursor;
bool delFlag = true;
uint size;
+ bool questionEnabled = false;
switch (cursorType) {
case CURSOR_NONE:
// No cursor
- _globals->setFlag(122);
+ g_globals->setFlag(122);
- if ((_vm->getFeatures() & GF_DEMO) || (_vm->getGameID() == GType_BlueForce)) {
+ if ((g_vm->getFeatures() & GF_DEMO) || (g_vm->getGameID() == GType_BlueForce)) {
CursorMan.showMouse(false);
return;
}
- cursor = _resourceManager->getSubResource(4, 1, 6, &size);
+ cursor = g_resourceManager->getSubResource(4, 1, 6, &size);
break;
case CURSOR_LOOK:
// Look cursor
- cursor = _resourceManager->getSubResource(4, 1, 5, &size);
+ if (g_vm->getGameID() == GType_BlueForce)
+ cursor = g_resourceManager->getSubResource(1, 5, 3, &size);
+ else
+ cursor = g_resourceManager->getSubResource(4, 1, 5, &size);
_currentCursor = CURSOR_LOOK;
break;
case CURSOR_USE:
// Use cursor
- cursor = _resourceManager->getSubResource(4, 1, 4, &size);
+ if (g_vm->getGameID() == GType_BlueForce) {
+ cursor = g_resourceManager->getSubResource(1, 5, 2, &size);
+ } else {
+ cursor = g_resourceManager->getSubResource(4, 1, 4, &size);
+ }
_currentCursor = CURSOR_USE;
break;
case CURSOR_TALK:
// Talk cursor
- cursor = _resourceManager->getSubResource(4, 1, 3, &size);
+ if (g_vm->getGameID() == GType_BlueForce) {
+ cursor = g_resourceManager->getSubResource(1, 5, 4, &size);
+ } else {
+ cursor = g_resourceManager->getSubResource(4, 1, 3, &size);
+ }
_currentCursor = CURSOR_TALK;
break;
+ case CURSOR_EXIT:
+ // Exit cursor (Blue Force)
+ assert(g_vm->getGameID() == GType_BlueForce);
+ cursor = g_resourceManager->getSubResource(1, 5, 7, &size);
+ _currentCursor = CURSOR_EXIT;
+ break;
+
+ case CURSOR_PRINTER:
+ // Printer cursor (Blue Force)
+ assert(g_vm->getGameID() == GType_BlueForce);
+ cursor = g_resourceManager->getSubResource(1, 7, 6, &size);
+ _currentCursor = CURSOR_PRINTER;
+ break;
+
case CURSOR_ARROW:
// Arrow cursor
cursor = CURSOR_ARROW_DATA;
@@ -188,10 +214,22 @@ void EventsClass::setCursor(CursorType cursorType) {
case CURSOR_WALK:
default:
- // Walk cursor
- cursor = CURSOR_WALK_DATA;
- _currentCursor = CURSOR_WALK;
- delFlag = false;
+ if (g_vm->getGameID() == GType_BlueForce) {
+ if (cursorType == CURSOR_WALK) {
+ cursor = g_resourceManager->getSubResource(1, 5, 1, &size);
+ } else {
+ // Inventory icon
+ cursor = g_resourceManager->getSubResource(10, ((int)cursorType - 1) / 20 + 1,
+ ((int)cursorType - 1) % 20 + 1, &size);
+ questionEnabled = true;
+ }
+ _currentCursor = cursorType;
+ } else {
+ // For Ringworld, always treat as the walk cursor
+ cursor = CURSOR_WALK_DATA;
+ _currentCursor = CURSOR_WALK;
+ delFlag = false;
+ }
break;
}
@@ -205,6 +243,10 @@ void EventsClass::setCursor(CursorType cursorType) {
if (delFlag)
DEALLOCATE(cursor);
+
+ // For Blue Force, enable the question button when an inventory icon is selected
+ if (g_vm->getGameID() == GType_BlueForce)
+ BF_GLOBALS._uiElements._question.setEnabled(questionEnabled);
}
void EventsClass::pushCursor(CursorType cursorType) {
@@ -215,22 +257,22 @@ void EventsClass::pushCursor(CursorType cursorType) {
switch (cursorType) {
case CURSOR_NONE:
// No cursor
- cursor = _resourceManager->getSubResource(4, 1, 6, &size);
+ cursor = g_resourceManager->getSubResource(4, 1, 6, &size);
break;
case CURSOR_LOOK:
// Look cursor
- cursor = _resourceManager->getSubResource(4, 1, 5, &size);
+ cursor = g_resourceManager->getSubResource(4, 1, 5, &size);
break;
case CURSOR_USE:
// Use cursor
- cursor = _resourceManager->getSubResource(4, 1, 4, &size);
+ cursor = g_resourceManager->getSubResource(4, 1, 4, &size);
break;
case CURSOR_TALK:
// Talk cursor
- cursor = _resourceManager->getSubResource(4, 1, 3, &size);
+ cursor = g_resourceManager->getSubResource(4, 1, 3, &size);
break;
case CURSOR_ARROW:
@@ -275,10 +317,10 @@ void EventsClass::setCursor(GfxSurface &cursor) {
Graphics::Surface s = cursor.lockSurface();
const byte *cursorData = (const byte *)s.getBasePtr(0, 0);
- CursorMan.replaceCursor(cursorData, cursor.getBounds().width(), cursor.getBounds().height(),
+ CursorMan.replaceCursor(cursorData, cursor.getBounds().width(), cursor.getBounds().height(),
cursor._centroid.x, cursor._centroid.y, cursor._transColor);
- _currentCursor = CURSOR_NONE;
+ _lastCursor = CURSOR_NONE;
}
void EventsClass::setCursorFromFlag() {
@@ -296,7 +338,7 @@ CursorType EventsClass::hideCursor() {
}
bool EventsClass::isCursorVisible() const {
- return !_globals->getFlag(122);
+ return !g_globals->getFlag(122);
}
/**
@@ -331,10 +373,10 @@ void EventsClass::listenerSynchronize(Serializer &s) {
void EventsClass::loadNotifierProc(bool postFlag) {
if (postFlag) {
- if (_globals->_events._lastCursor == CURSOR_NONE)
- _globals->_events._lastCursor = _globals->_events._currentCursor;
+ if (g_globals->_events._lastCursor == CURSOR_NONE)
+ g_globals->_events._lastCursor = g_globals->_events._currentCursor;
else
- _globals->_events._lastCursor = CURSOR_NONE;
+ g_globals->_events._lastCursor = CURSOR_NONE;
}
}
diff --git a/engines/tsage/events.h b/engines/tsage/events.h
index db1941082d..0195b2fc7b 100644
--- a/engines/tsage/events.h
+++ b/engines/tsage/events.h
@@ -54,6 +54,7 @@ public:
};
enum CursorType {
+ // Ringworld objects
OBJECT_STUNNER = 0, OBJECT_SCANNER = 1, OBJECT_STASIS_BOX = 2,
OBJECT_INFODISK = 3, OBJECT_STASIS_NEGATOR = 4, OBJECT_KEY_DEVICE = 5, OBJECT_MEDKIT = 6,
OBJECT_LADDER = 7, OBJECT_ROPE = 8, OBJECT_KEY = 9, OBJECT_TRANSLATOR = 10, OBJECT_ALE = 11,
@@ -63,7 +64,27 @@ enum CursorType {
OBJECT_NULLIFIER = 25, OBJECT_PEG = 26, OBJECT_VIAL = 27, OBJECT_JACKET = 28,
OBJECT_TUNIC2 = 29, OBJECT_BONE = 30, OBJECT_EMPTY_JAR = 31, OBJECT_JAR = 32,
+ // Blue Force objects
+ INV_NONE = 0, INV_COLT45 = 1, INV_AMMO_CLIP = 2, INV_SPARE_CLIP = 3, INV_HANDCUFFS = 4,
+ INV_GREENS_GUN = 5, INV_TICKET_BOOK = 6, INV_MIRANDA_CARD = 7, INV_FOREST_RAP = 8,
+ INV_GREEN_ID = 9, INV_BASEBALL_CARD = 10, INV_BOOKING_GREEN = 11, INV_FLARE = 12,
+ INV_COBB_RAP = 13, INV_22_BULLET = 14, INV_AUTO_RIFLE = 15, INV_WIG = 16, INV_FRANKIE_ID = 17,
+ INV_TYRONE_ID = 18, INV_22_SNUB = 19, INV_BOOKING_FRANKIE = 21, INV_BOOKING_GANG = 22,
+ INV_FBI_TELETYPE = 23, INV_DA_NOTE = 24, INV_PRINT_OUT = 25, INV_WAREHOUSE_KEYS = 26,
+ INV_CENTER_PUNCH = 27, INV_TRANQ_GUN = 28, INV_HOOK = 29, INV_RAGS = 30, INV_JAR = 31,
+ INV_SCREWDRIVER = 32, INV_D_FLOPPY = 33, INV_BLANK_DISK = 34, INV_STICK = 35,
+ INV_CRATE1 = 36, INV_CRATE2 = 37, INV_SHOEBOX = 38, INV_BADGE = 39, INV_RENTAL_COUPON = 41,
+ INV_NICKEL = 42, INV_LYLE_CARD = 43, INV_CARTER_NOTE = 44, INV_MUG_SHOT = 45,
+ INV_CLIPPING = 46, INV_MICROFILM = 47, INV_WAVE_KEYS = 48, INV_RENTAL_KEYS = 49,
+ INV_NAPKIN = 50, INV_DMV_PRINTOUT = 51, INV_FISHING_NET = 52, INV_ID = 53,
+ INV_9MM_BULLETS = 54, INV_SCHEDULE = 55, INV_GRENADES = 56, INV_YELLOW_CORD = 57,
+ INV_HALF_YELLOW_CORD = 58, INV_BLACK_CORD = 59, INV_HALF_BLACK_CORD = 61, INV_WARRANT = 62,
+ INV_JACKET = 63, INV_GREENS_KNIFE = 64, INV_DOG_WHISTLE = 65, INV_AMMO_BELT = 66,
+ BF_ITEM_67 = 67, BF_LAST_INVENT = 68,
+
+ // Cursors
CURSOR_WALK = 0x100, CURSOR_LOOK = 0x200, CURSOR_700 = 700, CURSOR_USE = 0x400, CURSOR_TALK = 0x800,
+ CURSOR_1000 = 0x1000, CURSOR_PRINTER = 0x4000, CURSOR_EXIT = 0x7004, CURSOR_9999 = 9999,
CURSOR_NONE = -1, CURSOR_CROSSHAIRS = -2, CURSOR_ARROW = -3
};
@@ -101,6 +122,8 @@ public:
Common::EventType type() { return _event.type; }
uint32 getFrameNumber() const { return _frameNumber; }
void delay(int numFrames);
+ bool isInventoryIcon() const { return _currentCursor < 256; }
+ void proc1() { warning("TODO: EventsClass::proc1"); }
virtual void listenerSynchronize(Serializer &s);
static void loadNotifierProc(bool postFlag);
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index 52bd42fc5c..788ab71b76 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -28,8 +28,8 @@
namespace TsAGE {
-Globals *_globals = NULL;
-ResourceManager *_resourceManager = NULL;
+Globals *g_globals = NULL;
+ResourceManager *g_resourceManager = NULL;
/*--------------------------------------------------------------------------*/
@@ -56,7 +56,7 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface
_stripNum = 0;
_gfxEdgeAdjust = 3;
- if (_vm->getFeatures() & GF_DEMO) {
+ if (g_vm->getFeatures() & GF_DEMO) {
_gfxFontNumber = 0;
_gfxColors.background = 6;
_gfxColors.foreground = 0;
@@ -67,15 +67,15 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface
_color1 = _gfxColors.foreground;
_color2 = _gfxColors.foreground;
_color3 = _gfxColors.foreground;
- } else if (_vm->getGameID() == GType_BlueForce) {
+ } else if (g_vm->getGameID() == GType_BlueForce) {
// Blue Force
_gfxFontNumber = 0;
_gfxColors.background = 89;
_gfxColors.foreground = 83;
_fontColors.background = 88;
_fontColors.foreground = 92;
- _dialogCenter.y = 165;
- } else if ((_vm->getGameID() == GType_Ringworld) && (_vm->getFeatures() & GF_CD)) {
+ _dialogCenter.y = 140;
+ } else if ((g_vm->getGameID() == GType_Ringworld) && (g_vm->getFeatures() & GF_CD)) {
_gfxFontNumber = 50;
_gfxColors.background = 53;
_gfxColors.foreground = 0;
@@ -108,9 +108,9 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface
_scrollFollower = NULL;
_inventory = NULL;
- switch (_vm->getGameID()) {
+ switch (g_vm->getGameID()) {
case GType_Ringworld:
- if (!(_vm->getFeatures() & GF_DEMO)) {
+ if (!(g_vm->getFeatures() & GF_DEMO)) {
_inventory = new Ringworld::RingworldInvObjectList();
_game = new Ringworld::RingworldGame();
} else {
@@ -132,12 +132,12 @@ Globals::~Globals() {
delete _inventory;
delete _sceneHandler;
delete _game;
- _globals = NULL;
+ g_globals = NULL;
}
void Globals::reset() {
Common::set_to(&_flags[0], &_flags[MAX_FLAGS], false);
- _saver->addFactory(classFactoryProc);
+ g_saver->addFactory(classFactoryProc);
}
void Globals::synchronize(Serializer &s) {
@@ -184,33 +184,100 @@ void Globals::dispatchSounds() {
namespace BlueForce {
BlueForceGlobals::BlueForceGlobals(): Globals() {
- _interfaceY = 0;
- _v51C44 = 1;
- _v4CEA2 = 0;
+}
+
+void BlueForceGlobals::synchronize(Serializer &s) {
+ Globals::synchronize(s);
+
+ s.syncAsSint16LE(_dayNumber);
+ s.syncAsSint16LE(_v4CEA4);
+ s.syncAsSint16LE(_marinaWomanCtr);
+ s.syncAsSint16LE(_v4CEB6);
+ s.syncAsSint16LE(_safeCombination);
+ s.syncAsSint16LE(_v4CEC0);
+ s.syncAsSint16LE(_v4CEC2);
+ s.syncAsSint16LE(_v4CEC4);
+ s.syncAsSint16LE(_v4CEC8);
+ s.syncAsSint16LE(_deziTopic);
+ s.syncAsSint16LE(_deathReason);
+ s.syncAsSint16LE(_driveFromScene);
+ s.syncAsSint16LE(_driveToScene);
+ s.syncAsSint16LE(_v501FC);
+ s.syncAsSint16LE(_v50696);
+ s.syncAsSint16LE(_v5098C);
+ s.syncAsSint16LE(_v5098D);
+ s.syncAsSint16LE(_v50CC2);
+ s.syncAsSint16LE(_v50CC4);
+ s.syncAsSint16LE(_v50CC6);
+ s.syncAsSint16LE(_v50CC8);
+ s.syncAsSint16LE(_v51C42);
+ s.syncAsSint16LE(_v51C44);
+ s.syncAsSint16LE(_interfaceY);
+ s.syncAsSint16LE(_bookmark);
+ s.syncAsSint16LE(_mapLocationId);
+ s.syncAsSint16LE(_clip1Bullets);
+ s.syncAsSint16LE(_clip2Bullets);
+}
+
+void BlueForceGlobals::reset() {
+ Globals::reset();
+ _scenePalette.clearListeners();
+
+ _scrollFollower = &_player;
+ _bookmark = bNone;
+
+ // Reset the inventory
+ ((BlueForceInvObjectList *)_inventory)->reset();
+ BF_GLOBALS._uiElements.updateInventory();
+ BF_GLOBALS._uiElements._scoreValue = 0;
+
+ _mapLocationId = 1;
+ _driveFromScene = 300;
+ _driveToScene = 0;
+
+ _interfaceY = BF_INTERFACE_Y;
+ _dayNumber = 0;
_v4CEA4 = 0;
- _v4CEA8 = 0;
- _v4CEF2 = 0;
- _v4CEF4 = 0;
- _v4CF9E = 0;
- _v4E238 = 0;
+ _marinaWomanCtr = 0;
+ _v4CEB6 = 0;
+ _safeCombination = 0;
+ _v4CEC0 = 0;
+ _v4CEC2 = 0;
+ _v4CEC4 = 0;
+ _v4CEC8 = 1;
+ _deziTopic = 0;
+ _deathReason = 0;
_v501FC = 0;
+ _v50696 = 0;
+ _v5098C = 0;
+ _v5098D = 0;
+ _v50CC2 = 0;
+ _v50CC4 = 0;
+ _v50CC6 = 0;
+ _v50CC8 = 0;
_v51C42 = 0;
- _bikiniHutState = 0;
- _mapLocationId = 1;
- Common::set_to(_globalFlags, _globalFlags + 12, 0);
+ _v51C44 = 1;
+ _clip1Bullets = 8;
+ _clip2Bullets = 8;
}
-void BlueForceGlobals::synchronize(Serializer &s) {
- Globals::synchronize(s);
- error("Sync variables");
+bool BlueForceGlobals::getHasBullets() {
+ if (!getFlag(fGunLoaded))
+ return false;
+ return BF_GLOBALS.getFlag(fLoadedSpare) ? (_clip2Bullets > 0) : (_clip1Bullets > 0);
}
-bool BlueForceGlobals::getFlag(int v) {
- return _globalFlags[v / 8] & (1 << (v % 8));
+void BlueForceGlobals::set2Flags(int flagNum) {
+ if (!getFlag(flagNum + 1)) {
+ setFlag(flagNum + 1);
+ setFlag(flagNum);
+ }
}
-void BlueForceGlobals::setFlag(int v) {
- _globalFlags[v / 8] |= 1 << (v % 8);
+bool BlueForceGlobals::removeFlag(int flagNum) {
+ bool result = getFlag(flagNum);
+ clearFlag(flagNum);
+ return result;
}
} // end of namespace BlueForce
diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h
index f5d4aaa16f..fa99e36ab9 100644
--- a/engines/tsage/globals.h
+++ b/engines/tsage/globals.h
@@ -97,45 +97,112 @@ public:
void dispatchSounds();
};
-extern Globals *_globals;
+extern Globals *g_globals;
-#define GLOBALS (*_globals)
-#define BF_GLOBALS (*((::TsAGE::BlueForce::BlueForceGlobals *)_globals))
+#define GLOBALS (*g_globals)
+#define BF_GLOBALS (*((::TsAGE::BlueForce::BlueForceGlobals *)g_globals))
-// Note: Currently this can't be part of the _globals structure, since it needs to be constructed
+// Note: Currently this can't be part of the g_globals structure, since it needs to be constructed
// prior to many of the fields in Globals execute their constructors
-extern ResourceManager *_resourceManager;
+extern ResourceManager *g_resourceManager;
namespace BlueForce {
using namespace TsAGE;
+enum Bookmark {
+ bNone,
+ bStartOfGame, bCalledToDomesticViolence, bArrestedGreen, bLauraToParamedics,
+ bBookedGreen, bStoppedFrankie, bBookedFrankie, bBookedFrankieEvidence,
+ bEndOfWorkDayOne, bTalkedToGrannyAboutSkipsCard, bLyleStoppedBy, bEndDayOne,
+ bInspectionDone, bCalledToDrunkStop, bArrestedDrunk, bEndDayTwo,
+ bFlashBackOne, bFlashBackTwo, bFlashBackThree, bDroppedOffLyle, bEndDayThree,
+ bDoneWithIsland, bDoneAtLyles, bEndDayFour, bInvestigateBoat, bFinishedWGreen,
+ bAmbushed, bAmbushOver, bEndOfGame
+};
+
+enum Flag {
+ JAKE_FILE_COPIED, gunClean, onBike, onDuty, fShowedIdToKate, fLateToMarina,
+ fCalledBackup, fWithLyle, gunDrawn, fBackupArrived340, fBriefedBackup,
+ fGotAllSkip340, fToldToLeave340, fBackupIn350, fNetInBoat, fForbesWaiting,
+ fWithCarter, fTalkedToTony, fMugOnKate, takenWeasel, gotTrailer450,
+ showEugeneNapkin, showRapEugene, fMgrCallsWeasel, fCarterMetLyle,
+ fGunLoaded, fLoadedSpare, showEugeneID, fRandomShot350, examinedFile810,
+ shownLyleCrate1, shownLyleRapsheet, shownLyleDisk, shownLylePO,
+ fCanDrawGun, fGotAutoWeapon, fGotBulletsFromDash, fShotSuttersDesk,
+ greenTaken, fLateToDrunkStop, didDrunk, fSearchedTruck, seenFolder,
+ showMugAround, frankInJail, fTalkedCarterDay3, fDecryptedBluePrints,
+ fTalkedToDrunkInCar, fToldLyleOfSchedule, fTalkedShooterNoBkup,
+ fTalkedDriverNoBkup, fDriverOutOfTruck, readGreenRights, readFrankRights,
+ talkedToHarrisAboutDrunk, unlockBoat, fShootGoon, fBlowUpGoon,
+ fTalkedToBarry, fTalkedToLarry, fLeftTraceIn920, fLeftTraceIn900,
+ fBackupAt340, fShotNicoIn910, fGotPointsForTktBook, fGotPointsForMCard,
+ fShowedBluePrint, fGotPointsForPunch, fGotPointsForBox, fGotPointsForBank,
+ fGotPointsForCombo, fGotPointsForCoin, fGotPointsForCPU, fGotPointsForBoots,
+ fGotPointsForCrate, fGotPointsForBlackCord, fGotPointsForGeneratorPlug,
+ fGotPointsForFuseBoxPlug, fGotPointsForStartGenerator, fGotPointsForLightsOn,
+ fGotPointsForOpeningDoor, fGotPointsForClosingDoor, fGotPointsForLightsOff,
+ fGotPointsForGeneratorOff, fGotPointsForCordOnForklift, fGotPointsForCuffingNico,
+ fGotPointsForCuffingDA, fGotPointsForSearchingNico, fGotPointsForSearchingDA,
+ fLeftTraceIn910, fBookedGreenEvidence, fGotPointsForCleaningGun,
+ fGotPointsForMemo, fGotPointsForFBI, fTookTrailerAmmo, fAlertedGreen355,
+ fGotGreen355fTalkedToGrannyDay3, shownFax, beenToJRDay2, shownLyleCrate1Day1,
+ fLyleOnIsland, iWasAmbushed, fGangInCar, fArrivedAtGangStop, ticketVW,
+ f1015Marina, fCan1015Marina, f1015Frankie, fCan1015Frankie, f1015Drunk,
+ fCan1015Drunk, f1027Marina, fCan1027Marina, f1027Frankie, fCan1027Frankie,
+ f1027Drunk, fCan1027Drunk, f1035Marina, fCan1035Marina, f1035Frankie,
+ fCan1035Frankie, f1035Drunk, fCan1035Drunk, f1097Marina, fCan1097Marina,
+ f1097Frankie, fCan1097Frankie, f1097Drunk, fCan1097Drunk, f1098Marina,
+ fCan1098Marina, f1098Frankie, fCan1098Frankie, f1098Drunk, fCan1098Drunk,
+ fCuffedFrankie, fGotPointsForTrapDog, fGotPointsForUnlockGate,
+ fGotPointsForUnlockWarehouse, fGotPointsForLockWarehouse, fGotPointsForLockGate,
+ fGotPointsForFreeDog, fGotPointsForWhistleDog, fGivenNapkin, fCan1004Marina,
+ fCan1004Drunk, fHasLeftDrunk, fHasDrivenFromDrunk, fCrateOpen, fSawGuns,
+ hookPoints
+};
+
class BlueForceGlobals: public Globals {
public:
ASoundExt _sound1, _sound2, _sound3;
UIElements _uiElements;
- int _v4CEA2;
+ StripProxy _stripProxy;
+ int _dayNumber;
int _v4CEA4;
- int _v4CEA8;
- int _v4CEF2;
- int _v4CEF4;
- int _v4CF9E;
- int _v4E238;
+ int _marinaWomanCtr;
+ int _v4CEB6;
+ int _safeCombination;
+ int _v4CEC0;
+ int _v4CEC2;
+ int _v4CEC4;
+ int _v4CEC8;
+ int _deziTopic;
+ int _deathReason;
+ int _driveFromScene;
+ int _driveToScene;
int _v501FC;
+ int _v50696;
+ uint8 _v5098C;
+ uint8 _v5098D;
+ int _v50CC2;
+ int _v50CC4;
+ int _v50CC6;
+ int _v50CC8;
int _v51C42;
int _v51C44;
int _interfaceY;
- int _bikiniHutState;
+ Bookmark _bookmark;
int _mapLocationId;
- uint8 _globalFlags[12];
+ int _clip1Bullets, _clip2Bullets;
BlueForceGlobals();
+ void reset();
+ bool getHasBullets();
+
virtual Common::String getClassName() { return "BFGlobals"; }
virtual void synchronize(Serializer &s);
-
- void setFlag(int v);
- bool getFlag(int v);
+ void set2Flags(int flagNum);
+ bool removeFlag(int flagNum);
};
} // End of namespace BlueForce
diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp
index 1884bfb4f5..4b2da0b456 100644
--- a/engines/tsage/graphics.cpp
+++ b/engines/tsage/graphics.cpp
@@ -120,7 +120,7 @@ GfxSurface surfaceFromRes(const byte *imgData) {
GfxSurface surfaceFromRes(int resNum, int rlbNum, int subNum) {
uint size;
- byte *imgData = _resourceManager->getSubResource(resNum, rlbNum, subNum, &size);
+ byte *imgData = g_resourceManager->getSubResource(resNum, rlbNum, subNum, &size);
GfxSurface surface = surfaceFromRes(imgData);
DEALLOCATE(imgData);
@@ -202,8 +202,8 @@ void Rect::resize(const GfxSurface &surface, int xp, int yp, int percent) {
* Expands the pane region to contain the specified Rect
*/
void Rect::expandPanes() {
- _globals->_paneRegions[0].uniteRect(*this);
- _globals->_paneRegions[1].uniteRect(*this);
+ g_globals->_paneRegions[0].uniteRect(*this);
+ g_globals->_paneRegions[1].uniteRect(*this);
}
/**
@@ -408,7 +408,7 @@ bool GfxSurface::displayText(const Common::String &msg, const Common::Point &pt)
// Write for a mouse or keypress
Event event;
- while (!_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS) && !_vm->shouldQuit())
+ while (!g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS) && !g_vm->shouldQuit())
;
// Restore the display area
@@ -423,15 +423,15 @@ bool GfxSurface::displayText(const Common::String &msg, const Common::Point &pt)
* Loads a quarter of a screen from a resource
*/
void GfxSurface::loadScreenSection(Graphics::Surface &dest, int xHalf, int yHalf, int xSection, int ySection) {
- int screenNum = _globals->_sceneManager._scene->_activeScreenNumber;
+ int screenNum = g_globals->_sceneManager._scene->_activeScreenNumber;
Rect updateRect(0, 0, 160, 100);
updateRect.translate(xHalf * 160, yHalf * 100);
- int xHalfCount = (_globals->_sceneManager._scene->_backgroundBounds.right + 159) / 160;
- int yHalfCount = (_globals->_sceneManager._scene->_backgroundBounds.bottom + 99) / 100;
+ int xHalfCount = (g_globals->_sceneManager._scene->_backgroundBounds.right + 159) / 160;
+ int yHalfCount = (g_globals->_sceneManager._scene->_backgroundBounds.bottom + 99) / 100;
if (xSection < xHalfCount && ySection < yHalfCount) {
int rlbNum = xSection * yHalfCount + ySection;
- byte *data = _resourceManager->getResource(RES_BITMAP, screenNum, rlbNum);
+ byte *data = g_resourceManager->getResource(RES_BITMAP, screenNum, rlbNum);
for (int y = 0; y < updateRect.height(); ++y) {
byte *pSrc = data + y * 160;
@@ -582,8 +582,8 @@ void GfxSurface::copyFrom(GfxSurface &src, Rect srcBounds, Rect destBounds, Regi
while (tempSrc < (pSrc + destBounds.width())) {
if (!priorityRegion || !priorityRegion->contains(Common::Point(
- xp + _globals->_sceneManager._scene->_sceneBounds.left,
- destBounds.top + y + _globals->_sceneManager._scene->_sceneBounds.top))) {
+ xp + g_globals->_sceneManager._scene->_sceneBounds.left,
+ destBounds.top + y + g_globals->_sceneManager._scene->_sceneBounds.top))) {
if (*tempSrc != src._transColor)
*tempDest = *tempSrc;
}
@@ -609,7 +609,7 @@ void GfxSurface::draw(const Common::Point &pt, Rect *rect) {
*rect = tempRect;
} else {
// Draw image
- _globals->gfxManager().copyFrom(*this, tempRect, NULL);
+ g_globals->gfxManager().copyFrom(*this, tempRect, NULL);
}
}
@@ -623,12 +623,12 @@ GfxElement::GfxElement() {
void GfxElement::setDefaults() {
_flags = 0;
- _fontNumber = _globals->_gfxFontNumber;
- _colors = _globals->_gfxColors;
- _fontColors = _globals->_fontColors;
- _color1 = _globals->_color1;
- _color2 = _globals->_color2;
- _color3 = _globals->_color3;
+ _fontNumber = g_globals->_gfxFontNumber;
+ _colors = g_globals->_gfxColors;
+ _fontColors = g_globals->_fontColors;
+ _color1 = g_globals->_color1;
+ _color2 = g_globals->_color2;
+ _color3 = g_globals->_color3;
}
/**
@@ -636,13 +636,13 @@ void GfxElement::setDefaults() {
*/
void GfxElement::highlight() {
// Get a lock on the surface
- GfxManager &gfxManager = _globals->gfxManager();
+ GfxManager &gfxManager = g_globals->gfxManager();
Graphics::Surface surface = gfxManager.lockSurface();
// Scan through the contents of the element, switching any occurances of the foreground
// color with the background color and vice versa
Rect tempRect(_bounds);
- tempRect.collapse(_globals->_gfxEdgeAdjust - 1, _globals->_gfxEdgeAdjust - 1);
+ tempRect.collapse(g_globals->_gfxEdgeAdjust - 1, g_globals->_gfxEdgeAdjust - 1);
for (int yp = tempRect.top; yp < tempRect.bottom; ++yp) {
byte *lineP = (byte *)surface.getBasePtr(tempRect.left, yp);
@@ -661,7 +661,7 @@ void GfxElement::highlight() {
*/
void GfxElement::drawFrame() {
// Get a lock on the surface and save the active font
- GfxManager &gfxManager = _globals->gfxManager();
+ GfxManager &gfxManager = g_globals->gfxManager();
gfxManager.lockSurface();
uint8 bgColor, fgColor;
@@ -674,7 +674,7 @@ void GfxElement::drawFrame() {
}
Rect tempRect = _bounds;
- tempRect.collapse(_globals->_gfxEdgeAdjust, _globals->_gfxEdgeAdjust);
+ tempRect.collapse(g_globals->_gfxEdgeAdjust, g_globals->_gfxEdgeAdjust);
tempRect.collapse(-1, -1);
gfxManager.fillRect(tempRect, _colors.background);
@@ -715,10 +715,10 @@ bool GfxElement::focusedEvent(Event &event) {
// HACK: It should use the GfxManager object to figure out the relative
// position, but for now this seems like the easiest way.
- int xOffset = mousePos.x - _globals->_events._mousePos.x;
- int yOffset = mousePos.y - _globals->_events._mousePos.y;
+ int xOffset = mousePos.x - g_globals->_events._mousePos.x;
+ int yOffset = mousePos.y - g_globals->_events._mousePos.y;
- while (event.eventType != EVENT_BUTTON_UP && !_vm->shouldQuit()) {
+ while (event.eventType != EVENT_BUTTON_UP && !g_vm->shouldQuit()) {
g_system->delayMillis(10);
if (_bounds.contains(mousePos)) {
@@ -733,7 +733,7 @@ bool GfxElement::focusedEvent(Event &event) {
highlight();
}
- if (_globals->_events.getEvent(event, EVENT_MOUSE_MOVE | EVENT_BUTTON_UP)) {
+ if (g_globals->_events.getEvent(event, EVENT_MOUSE_MOVE | EVENT_BUTTON_UP)) {
if (event.eventType == EVENT_MOUSE_MOVE) {
mousePos.x = event.mousePos.x + xOffset;
mousePos.y = event.mousePos.y + yOffset;
@@ -769,7 +769,7 @@ void GfxImage::setDefaults() {
// Decode the image
uint size;
- byte *imgData = _resourceManager->getSubResource(_resNum, _rlbNum, _cursorNum, &size);
+ byte *imgData = g_resourceManager->getSubResource(_resNum, _rlbNum, _cursorNum, &size);
_surface = surfaceFromRes(imgData);
DEALLOCATE(imgData);
@@ -781,9 +781,9 @@ void GfxImage::setDefaults() {
void GfxImage::draw() {
Rect tempRect = _bounds;
- tempRect.translate(_globals->gfxManager()._topLeft.x, _globals->gfxManager()._topLeft.y);
+ tempRect.translate(g_globals->gfxManager()._topLeft.x, g_globals->gfxManager()._topLeft.y);
- _globals->gfxManager().copyFrom(_surface, tempRect);
+ g_globals->gfxManager().copyFrom(_surface, tempRect);
}
/*--------------------------------------------------------------------------*/
@@ -805,7 +805,7 @@ void GfxMessage::setDefaults() {
GfxElement::setDefaults();
GfxFontBackup font;
- GfxManager &gfxManager = _globals->gfxManager();
+ GfxManager &gfxManager = g_globals->gfxManager();
Rect tempRect;
gfxManager._font.setFontNumber(this->_fontNumber);
@@ -818,7 +818,7 @@ void GfxMessage::setDefaults() {
void GfxMessage::draw() {
GfxFontBackup font;
- GfxManager &gfxManager = _globals->gfxManager();
+ GfxManager &gfxManager = g_globals->gfxManager();
// Set the font and color
gfxManager.setFillFlag(false);
@@ -838,7 +838,7 @@ void GfxButton::setDefaults() {
GfxElement::setDefaults();
GfxFontBackup font;
- GfxManager &gfxManager = _globals->gfxManager();
+ GfxManager &gfxManager = g_globals->gfxManager();
Rect tempRect;
// Get the string bounds and round up the x end to a multiple of 16
@@ -847,8 +847,8 @@ void GfxButton::setDefaults() {
tempRect.right = ((tempRect.right + 15) / 16) * 16;
// Set the button bounds
- tempRect.collapse(-_globals->_gfxEdgeAdjust, -_globals->_gfxEdgeAdjust);
- if (_vm->getFeatures() & GF_CD)
+ tempRect.collapse(-g_globals->_gfxEdgeAdjust, -g_globals->_gfxEdgeAdjust);
+ if (g_vm->getFeatures() & GF_CD)
--tempRect.top;
tempRect.moveTo(_bounds.left, _bounds.top);
_bounds = tempRect;
@@ -857,7 +857,7 @@ void GfxButton::setDefaults() {
void GfxButton::draw() {
// Get a lock on the surface and save the active font
GfxFontBackup font;
- GfxManager &gfxManager = _globals->gfxManager();
+ GfxManager &gfxManager = g_globals->gfxManager();
gfxManager.lockSurface();
// Draw a basic frame for the button
@@ -873,8 +873,8 @@ void GfxButton::draw() {
// Display the button's text
Rect tempRect(_bounds);
- tempRect.collapse(_globals->_gfxEdgeAdjust, _globals->_gfxEdgeAdjust);
- if (_vm->getFeatures() & GF_CD)
+ tempRect.collapse(g_globals->_gfxEdgeAdjust, g_globals->_gfxEdgeAdjust);
+ if (g_vm->getFeatures() & GF_CD)
++tempRect.top;
gfxManager._font.writeLines(_message.c_str(), tempRect, ALIGN_CENTER);
@@ -936,14 +936,14 @@ void GfxDialog::setDefaults() {
// Set the dialog boundaries
_gfxManager._bounds = tempRect;
- tempRect.collapse(-_globals->_gfxEdgeAdjust * 2, -_globals->_gfxEdgeAdjust * 2);
+ tempRect.collapse(-g_globals->_gfxEdgeAdjust * 2, -g_globals->_gfxEdgeAdjust * 2);
_bounds = tempRect;
}
void GfxDialog::remove() {
if (_savedArea) {
// Restore the area the dialog covered
- _globals->_gfxManagerInstance.copyFrom(*_savedArea, _bounds.left, _bounds.top);
+ g_globals->_gfxManagerInstance.copyFrom(*_savedArea, _bounds.left, _bounds.top);
delete _savedArea;
_savedArea = NULL;
@@ -954,7 +954,7 @@ void GfxDialog::draw() {
Rect tempRect(_bounds);
// Make a backup copy of the area the dialog will occupy
- _savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds);
+ _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
// Set the palette for use in the dialog
setPalette();
@@ -966,7 +966,7 @@ void GfxDialog::draw() {
drawFrame();
// Reset the dialog's graphics manager to only draw within the dialog boundaries
- tempRect.translate(_globals->_gfxEdgeAdjust * 2, _globals->_gfxEdgeAdjust * 2);
+ tempRect.translate(g_globals->_gfxEdgeAdjust * 2, g_globals->_gfxEdgeAdjust * 2);
_gfxManager._bounds = tempRect;
// Draw each element in the dialog in order
@@ -1003,7 +1003,7 @@ void GfxDialog::addElements(GfxElement *ge, ...) {
}
void GfxDialog::setTopLeft(int xp, int yp) {
- _bounds.moveTo(xp - _globals->_gfxEdgeAdjust * 2, yp - _globals->_gfxEdgeAdjust * 2);
+ _bounds.moveTo(xp - g_globals->_gfxEdgeAdjust * 2, yp - g_globals->_gfxEdgeAdjust * 2);
}
void GfxDialog::setCenter(int xp, int yp) {
@@ -1029,9 +1029,9 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) {
GfxButton *selectedButton = NULL;
bool breakFlag = false;
- while (!_vm->shouldQuit() && !breakFlag) {
+ while (!g_vm->shouldQuit() && !breakFlag) {
Event event;
- while (_globals->_events.getEvent(event) && !breakFlag) {
+ while (g_globals->_events.getEvent(event) && !breakFlag) {
// Adjust mouse positions to be relative within the dialog
event.mousePos.x -= _gfxManager._bounds.left;
event.mousePos.y -= _gfxManager._bounds.top;
@@ -1069,17 +1069,28 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) {
}
void GfxDialog::setPalette() {
- _globals->_scenePalette.loadPalette(0);
- _globals->_scenePalette.setPalette(0, 1);
- _globals->_scenePalette.setPalette(_globals->_scenePalette._colors.foreground, 1);
- _globals->_scenePalette.setPalette(_globals->_fontColors.background, 1);
- _globals->_scenePalette.setPalette(_globals->_fontColors.foreground, 1);
- _globals->_scenePalette.setPalette(255, 1);
+ if (g_vm->getGameID() == GType_BlueForce) {
+ g_globals->_scenePalette.loadPalette(2);
+ g_globals->_scenePalette.setPalette(0, 1);
+ g_globals->_scenePalette.setPalette(g_globals->_gfxColors.background, 1);
+ g_globals->_scenePalette.setPalette(g_globals->_gfxColors.foreground, 1);
+ g_globals->_scenePalette.setPalette(g_globals->_fontColors.background, 1);
+ g_globals->_scenePalette.setPalette(g_globals->_fontColors.foreground, 1);
+ g_globals->_scenePalette.setEntry(255, 0xff, 0xff, 0xff);
+ g_globals->_scenePalette.setPalette(255, 1);
+ } else {
+ g_globals->_scenePalette.loadPalette(0);
+ g_globals->_scenePalette.setPalette(0, 1);
+ g_globals->_scenePalette.setPalette(g_globals->_scenePalette._colors.foreground, 1);
+ g_globals->_scenePalette.setPalette(g_globals->_fontColors.background, 1);
+ g_globals->_scenePalette.setPalette(g_globals->_fontColors.foreground, 1);
+ g_globals->_scenePalette.setPalette(255, 1);
+ }
}
/*--------------------------------------------------------------------------*/
-GfxManager::GfxManager() : _surface(_globals->_screenSurface), _oldManager(NULL) {
+GfxManager::GfxManager() : _surface(g_globals->_screenSurface), _oldManager(NULL) {
_font.setOwner(this);
_font._fillFlag = false;
_bounds = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
@@ -1098,19 +1109,19 @@ void GfxManager::setDefaults() {
_pane0Rect4 = screenBounds;
_font._edgeSize = Common::Point(1, 1);
- _font._colors = _globals->_fontColors;
- _font.setFontNumber(_globals->_gfxFontNumber);
+ _font._colors = g_globals->_fontColors;
+ _font.setFontNumber(g_globals->_gfxFontNumber);
}
void GfxManager::activate() {
- assert(!contains(_globals->_gfxManagers, this));
- _globals->_gfxManagers.push_front(this);
+ assert(!contains(g_globals->_gfxManagers, this));
+ g_globals->_gfxManagers.push_front(this);
}
void GfxManager::deactivate() {
// Assert that there will still be another manager, and we're correctly removing our own
- assert((_globals->_gfxManagers.size() > 1) && (&_globals->gfxManager() == this));
- _globals->_gfxManagers.pop_front();
+ assert((g_globals->_gfxManagers.size() > 1) && (&g_globals->gfxManager() == this));
+ g_globals->_gfxManagers.pop_front();
}
int GfxManager::getStringWidth(const char *s, int numChars) {
@@ -1148,7 +1159,7 @@ void GfxManager::setDialogPalette() {
// Get the main palette information
byte palData[256 * 3];
uint count, start;
- _resourceManager->getPalette(0, &palData[0], &start, &count);
+ g_resourceManager->getPalette(0, &palData[0], &start, &count);
g_system->getPaletteManager()->setPalette(&palData[0], start, count);
// Miscellaneous
@@ -1183,7 +1194,7 @@ int GfxManager::getAngle(const Common::Point &p1, const Common::Point &p2) {
GfxFont::GfxFont() {
- _fontNumber = (_vm->getFeatures() & GF_DEMO) ? 0 : 50;
+ _fontNumber = (g_vm->getFeatures() & GF_DEMO) ? 0 : 50;
_numChars = 0;
_bpp = 0;
_fontData = NULL;
@@ -1207,9 +1218,9 @@ void GfxFont::setFontNumber(uint32 fontNumber) {
_fontNumber = fontNumber;
- _fontData = _resourceManager->getResource(RES_FONT, _fontNumber, 0, true);
+ _fontData = g_resourceManager->getResource(RES_FONT, _fontNumber, 0, true);
if (!_fontData)
- _fontData = _resourceManager->getResource(RES_FONT, _fontNumber, 0);
+ _fontData = g_resourceManager->getResource(RES_FONT, _fontNumber, 0);
_numChars = READ_LE_UINT16(_fontData + 4);
_fontSize.y = READ_LE_UINT16(_fontData + 6);
@@ -1498,17 +1509,17 @@ void GfxFont::writeLines(const char *s, const Rect &bounds, TextAlign align) {
/*--------------------------------------------------------------------------*/
GfxFontBackup::GfxFontBackup() {
- _edgeSize = _globals->gfxManager()._font._edgeSize;
- _position = _globals->gfxManager()._font._position;
- _colors = _globals->gfxManager()._font._colors;
- _fontNumber = _globals->gfxManager()._font._fontNumber;
+ _edgeSize = g_globals->gfxManager()._font._edgeSize;
+ _position = g_globals->gfxManager()._font._position;
+ _colors = g_globals->gfxManager()._font._colors;
+ _fontNumber = g_globals->gfxManager()._font._fontNumber;
}
GfxFontBackup::~GfxFontBackup() {
- _globals->gfxManager()._font.setFontNumber(_fontNumber);
- _globals->gfxManager()._font._edgeSize = _edgeSize;
- _globals->gfxManager()._font._position = _position;
- _globals->gfxManager()._font._colors = _colors;
+ g_globals->gfxManager()._font.setFontNumber(_fontNumber);
+ g_globals->gfxManager()._font._edgeSize = _edgeSize;
+ g_globals->gfxManager()._font._position = _position;
+ g_globals->gfxManager()._font._colors = _colors;
}
diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk
index ed6fb296a0..50b269941e 100644
--- a/engines/tsage/module.mk
+++ b/engines/tsage/module.mk
@@ -1,10 +1,19 @@
MODULE := engines/tsage
MODULE_OBJS := \
+ blue_force/blueforce_dialogs.o \
blue_force/blueforce_logic.o \
blue_force/blueforce_scenes0.o \
blue_force/blueforce_scenes1.o \
+ blue_force/blueforce_scenes2.o \
blue_force/blueforce_scenes3.o \
+ blue_force/blueforce_scenes4.o \
+ blue_force/blueforce_scenes5.o \
+ blue_force/blueforce_scenes6.o \
+ blue_force/blueforce_scenes7.o \
+ blue_force/blueforce_scenes8.o \
+ blue_force/blueforce_scenes9.o \
+ blue_force/blueforce_speakers.o \
blue_force/blueforce_ui.o \
converse.o \
core.o \
@@ -16,6 +25,7 @@ MODULE_OBJS := \
graphics.o \
resources.o \
ringworld/ringworld_demo.o \
+ ringworld/ringworld_dialogs.o \
ringworld/ringworld_logic.o \
ringworld/ringworld_scenes1.o \
ringworld/ringworld_scenes2.o \
@@ -25,6 +35,7 @@ MODULE_OBJS := \
ringworld/ringworld_scenes6.o \
ringworld/ringworld_scenes8.o \
ringworld/ringworld_scenes10.o \
+ ringworld/ringworld_speakers.o \
saveload.o \
scenes.o \
sound.o \
@@ -36,5 +47,5 @@ ifeq ($(ENABLE_TSAGE), DYNAMIC_PLUGIN)
PLUGIN := 1
endif
-# Include common rules
+# Include common rules
include $(srcdir)/rules.mk
diff --git a/engines/tsage/resources.cpp b/engines/tsage/resources.cpp
index 99b431b5dc..e83801d748 100644
--- a/engines/tsage/resources.cpp
+++ b/engines/tsage/resources.cpp
@@ -438,7 +438,7 @@ ResourceManager::~ResourceManager() {
void ResourceManager::addLib(const Common::String &libName) {
assert(_libList.size() < 5);
- _libList.push_back(new TLib(_vm->_memoryManager, libName));
+ _libList.push_back(new TLib(g_vm->_memoryManager, libName));
}
byte *ResourceManager::getResource(uint16 id, bool suppressErrors) {
diff --git a/engines/tsage/ringworld/ringworld_demo.cpp b/engines/tsage/ringworld/ringworld_demo.cpp
index 5612325aff..adf4aae9dd 100644
--- a/engines/tsage/ringworld/ringworld_demo.cpp
+++ b/engines/tsage/ringworld/ringworld_demo.cpp
@@ -31,9 +31,9 @@ namespace Ringworld {
void RingworldDemoGame::start() {
// Start the demo's single scene
- _globals->_sceneManager.changeScene(1);
+ g_globals->_sceneManager.changeScene(1);
- _globals->_events.setCursor(CURSOR_NONE);
+ g_globals->_events.setCursor(CURSOR_NONE);
}
Scene *RingworldDemoGame::createScene(int sceneNumber) {
@@ -43,11 +43,11 @@ Scene *RingworldDemoGame::createScene(int sceneNumber) {
void RingworldDemoGame::quitGame() {
if (MessageDialog::show(DEMO_EXIT_MSG, EXIT_BTN_STRING, DEMO_BTN_STRING) == 0)
- _vm->quitGame();
+ g_vm->quitGame();
}
void RingworldDemoGame::pauseGame() {
- _globals->_events.setCursor(CURSOR_ARROW);
+ g_globals->_events.setCursor(CURSOR_ARROW);
MessageDialog *dlg = new MessageDialog(DEMO_PAUSED_MSG, EXIT_BTN_STRING, DEMO_RESUME_BTN_STRING);
dlg->draw();
@@ -55,10 +55,10 @@ void RingworldDemoGame::pauseGame() {
bool exitFlag = selectedButton != &dlg->_btn2;
delete dlg;
- _globals->_events.hideCursor();
+ g_globals->_events.hideCursor();
if (exitFlag)
- _vm->quitGame();
+ g_vm->quitGame();
}
void RingworldDemoGame::processEvent(Event &event) {
@@ -74,8 +74,8 @@ void RingworldDemoGame::processEvent(Event &event) {
ConfigDialog *dlg = new ConfigDialog();
dlg->runModal();
delete dlg;
- _globals->_soundManager.syncSounds();
- _globals->_events.setCursorFromFlag();
+ g_globals->_soundManager.syncSounds();
+ g_globals->_events.setCursorFromFlag();
break;
}
diff --git a/engines/tsage/ringworld/ringworld_dialogs.cpp b/engines/tsage/ringworld/ringworld_dialogs.cpp
new file mode 100644
index 0000000000..9d1a7effc2
--- /dev/null
+++ b/engines/tsage/ringworld/ringworld_dialogs.cpp
@@ -0,0 +1,222 @@
+/* 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 "common/translation.h"
+
+#include "gui/dialog.h"
+#include "gui/widget.h"
+
+#include "tsage/tsage.h"
+#include "tsage/core.h"
+#include "tsage/dialogs.h"
+#include "tsage/staticres.h"
+#include "tsage/globals.h"
+#include "tsage/ringworld/ringworld_dialogs.h"
+#include "tsage/ringworld/ringworld_logic.h"
+
+namespace TsAGE {
+
+namespace Ringworld {
+
+/*--------------------------------------------------------------------------*/
+
+#define BUTTON_WIDTH 28
+#define BUTTON_HEIGHT 29
+
+RightClickButton::RightClickButton(int buttonIndex, int xp, int yp) : GfxButton() {
+ _buttonIndex = buttonIndex;
+ this->_bounds.left = xp;
+ this->_bounds.top = yp;
+ this->_bounds.setWidth(BUTTON_WIDTH);
+ this->_bounds.setHeight(BUTTON_HEIGHT);
+ _savedButton = NULL;
+}
+
+void RightClickButton::highlight() {
+ if (_savedButton) {
+ // Button was previously highlighted, so de-highlight by restoring saved area
+ g_globals->gfxManager().copyFrom(*_savedButton, _bounds.left, _bounds.top);
+ delete _savedButton;
+ _savedButton = NULL;
+ } else {
+ // Highlight button by getting the needed highlighted image resource
+ _savedButton = Surface_getArea(g_globals->gfxManager().getSurface(), _bounds);
+
+ uint size;
+ byte *imgData = g_resourceManager->getSubResource(7, 2, _buttonIndex, &size);
+
+ GfxSurface btnSelected = surfaceFromRes(imgData);
+ g_globals->gfxManager().copyFrom(btnSelected, _bounds.left, _bounds.top);
+
+ DEALLOCATE(imgData);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+
+/**
+ * This dialog implements the right-click dialog
+ */
+RightClickDialog::RightClickDialog() : GfxDialog(),
+ _walkButton(1, 48, 12), _lookButton(2, 31, 29), _useButton(3, 65, 29),
+ _talkButton(4, 14, 47), _inventoryButton(5, 48, 47), _optionsButton(6, 83, 47) {
+ Rect rectArea, dialogRect;
+
+ // Set the palette and change the cursor
+ _gfxManager.setDialogPalette();
+ g_globals->_events.setCursor(CURSOR_ARROW);
+
+ // Get the dialog image
+ _surface = surfaceFromRes(7, 1, 1);
+
+ // Set the dialog position
+ dialogRect.resize(_surface, 0, 0, 100);
+ dialogRect.center(g_globals->_events._mousePos.x, g_globals->_events._mousePos.y);
+
+ // Ensure the dialog will be entirely on-screen
+ Rect screenRect = g_globals->gfxManager()._bounds;
+ screenRect.collapse(4, 4);
+ dialogRect.contain(screenRect);
+
+ _bounds = dialogRect;
+ _gfxManager._bounds = _bounds;
+
+ _highlightedButton = NULL;
+ _selectedAction = -1;
+}
+
+RightClickDialog::~RightClickDialog() {
+}
+
+RightClickButton *RightClickDialog::findButton(const Common::Point &pt) {
+ RightClickButton *btnList[] = { &_walkButton, &_lookButton, &_useButton, &_talkButton, &_inventoryButton, &_optionsButton };
+
+ for (int i = 0; i < 6; ++i) {
+ btnList[i]->_owner = this;
+
+ if (btnList[i]->_bounds.contains(pt))
+ return btnList[i];
+ }
+
+ return NULL;
+}
+
+void RightClickDialog::draw() {
+ // Save the covered background area
+ _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
+
+ // Draw the dialog image
+ g_globals->gfxManager().copyFrom(_surface, _bounds.left, _bounds.top);
+}
+
+bool RightClickDialog::process(Event &event) {
+ switch (event.eventType) {
+ case EVENT_MOUSE_MOVE: {
+ // Check whether a button is highlighted
+ RightClickButton *btn = findButton(event.mousePos);
+
+ if (btn != _highlightedButton) {
+ // De-highlight any previously selected button
+ if (_highlightedButton) {
+ _highlightedButton->highlight();
+ _highlightedButton = NULL;
+ }
+ if (btn) {
+ // Highlight the new button
+ btn->highlight();
+ _highlightedButton = btn;
+ }
+ }
+ event.handled = true;
+ return true;
+ }
+
+ case EVENT_BUTTON_DOWN:
+ // If a button is highlighted, then flag the selected button index
+ if (_highlightedButton)
+ _selectedAction = _highlightedButton->_buttonIndex;
+ else
+ _selectedAction = _lookButton._buttonIndex;
+ event.handled = true;
+ return true;
+
+ default:
+ break;
+ }
+
+ return false;
+}
+
+void RightClickDialog::execute() {
+ // Draw the dialog
+ draw();
+
+ // Dialog event handler loop
+ _gfxManager.activate();
+
+ while (!g_vm->shouldQuit() && (_selectedAction == -1)) {
+ Event evt;
+ while (g_globals->_events.getEvent(evt, EVENT_MOUSE_MOVE | EVENT_BUTTON_DOWN)) {
+ evt.mousePos.x -= _bounds.left;
+ evt.mousePos.y -= _bounds.top;
+
+ process(evt);
+ }
+
+ g_system->delayMillis(10);
+ g_system->updateScreen();
+ }
+
+ // Execute the specified action
+ switch (_selectedAction) {
+ case 1:
+ // Look action
+ g_globals->_events.setCursor(CURSOR_LOOK);
+ break;
+ case 2:
+ // Walk action
+ g_globals->_events.setCursor(CURSOR_WALK);
+ break;
+ case 3:
+ // Use cursor
+ g_globals->_events.setCursor(CURSOR_USE);
+ break;
+ case 4:
+ // Talk cursor
+ g_globals->_events.setCursor(CURSOR_TALK);
+ break;
+ case 5:
+ // Inventory dialog
+ InventoryDialog::show();
+ break;
+ case 6:
+ // Dialog options
+ OptionsDialog::show();
+ break;
+ }
+
+ _gfxManager.deactivate();
+}
+
+} // End of namespace Ringworld
+
+} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld/ringworld_dialogs.h b/engines/tsage/ringworld/ringworld_dialogs.h
new file mode 100644
index 0000000000..11a8f10e70
--- /dev/null
+++ b/engines/tsage/ringworld/ringworld_dialogs.h
@@ -0,0 +1,70 @@
+/* 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.
+ *
+ */
+
+#ifndef TSAGE_RINGWORLD_DIALOGS_H
+#define TSAGE_RINGWORLD_DIALOGS_H
+
+#include "gui/options.h"
+#include "tsage/events.h"
+#include "tsage/graphics.h"
+#include "common/list.h"
+#include "common/rect.h"
+#include "common/system.h"
+
+namespace TsAGE {
+
+namespace Ringworld {
+
+class RightClickButton : public GfxButton {
+private:
+ GfxSurface *_savedButton;
+public:
+ int _buttonIndex;
+
+ RightClickButton(int buttonIndex, int xp, int yp);
+ ~RightClickButton() { delete _savedButton; }
+
+ virtual void highlight();
+};
+
+class RightClickDialog : public GfxDialog {
+private:
+ GfxSurface _surface;
+ RightClickButton *_highlightedButton;
+ int _selectedAction;
+ RightClickButton _walkButton, _lookButton, _useButton, _talkButton, _inventoryButton, _optionsButton;
+
+ RightClickButton *findButton(const Common::Point &pt);
+public:
+ RightClickDialog();
+ ~RightClickDialog();
+
+ virtual void draw();
+ virtual bool process(Event &event);
+ void execute();
+};
+
+} // End of namespace Ringworld
+
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/ringworld/ringworld_logic.cpp b/engines/tsage/ringworld/ringworld_logic.cpp
index 2a34e49b39..3fb284f5da 100644
--- a/engines/tsage/ringworld/ringworld_logic.cpp
+++ b/engines/tsage/ringworld/ringworld_logic.cpp
@@ -21,13 +21,12 @@
*/
#include "common/config-manager.h"
-#include "common/translation.h"
-#include "gui/saveload.h"
#include "tsage/ringworld/ringworld_logic.h"
#include "tsage/scenes.h"
#include "tsage/tsage.h"
#include "tsage/staticres.h"
#include "tsage/ringworld/ringworld_demo.h"
+#include "tsage/ringworld/ringworld_dialogs.h"
#include "tsage/ringworld/ringworld_scenes1.h"
#include "tsage/ringworld/ringworld_scenes2.h"
#include "tsage/ringworld/ringworld_scenes3.h"
@@ -279,7 +278,7 @@ void SceneArea::display() {
_bounds.setWidth(_surface.getBounds().width());
_bounds.setHeight(_surface.getBounds().height());
- _savedArea = Surface_getArea(_globals->_gfxManagerInstance.getSurface(), _bounds);
+ _savedArea = Surface_getArea(g_globals->_gfxManagerInstance.getSurface(), _bounds);
draw2();
}
@@ -298,13 +297,13 @@ void SceneArea::draw(bool flag) {
void SceneArea::wait() {
// Wait until a mouse or keypress
Event event;
- while (!_vm->shouldQuit() && !_globals->_events.getEvent(event)) {
+ while (!g_vm->shouldQuit() && !g_globals->_events.getEvent(event)) {
g_system->updateScreen();
g_system->delayMillis(10);
}
SynchronizedList<SceneItem *>::iterator ii;
- for (ii = _globals->_sceneItems.begin(); ii != _globals->_sceneItems.end(); ++ii) {
+ for (ii = g_globals->_sceneItems.begin(); ii != g_globals->_sceneItems.end(); ++ii) {
SceneItem *sceneItem = *ii;
if (sceneItem->contains(event.mousePos)) {
sceneItem->doAction(_actionId);
@@ -312,7 +311,7 @@ void SceneArea::wait() {
}
}
- _globals->_events.setCursor(CURSOR_ARROW);
+ g_globals->_events.setCursor(CURSOR_ARROW);
}
void SceneArea::synchronize(Serializer &s) {
@@ -330,878 +329,6 @@ void SceneArea::synchronize(Serializer &s) {
/*--------------------------------------------------------------------------*/
-SpeakerGText::SpeakerGText() {
- _speakerName = "GTEXT";
- _textWidth = 160;
- _textPos = Common::Point(130, 10);
- _color1 = 42;
- _hideObjects = false;
-}
-
-void SpeakerGText::setText(const Common::String &msg) {
- // Set the animation properties
- _sceneObject.postInit();
- _sceneObject.setVisage(9405);
- _sceneObject.setStrip2(3);
- _sceneObject.fixPriority(255);
- _sceneObject.changeZoom(100);
- _sceneObject._frame = 1;
- _sceneObject.setPosition(Common::Point(183, 71));
- _sceneObject.animate(ANIM_MODE_7, 0, NULL);
-
- // Set the text
- Rect textRect;
- _globals->gfxManager()._font.getStringBounds(msg.c_str(), textRect, _textWidth);
- textRect.center(_sceneObject._position.x, _sceneObject._position.y);
- _textPos.x = textRect.left;
- Speaker::setText(msg);
-}
-
-void SpeakerGText::removeText() {
- _sceneObject.remove();
- Speaker::removeText();
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerPOR::SpeakerPOR() {
- _speakerName = "POR";
- _newSceneNumber = 7221;
- _textPos = Common::Point(10, 30);
- _color1 = 41;
-}
-
-void SpeakerPOR::SpeakerAction1::signal(){
- switch (_actionIndex++) {
- case 0:
- setDelay(_globals->_randomSource.getRandomNumber(60) + 60);
- break;
- case 1:
- static_cast<SceneObject *>(_owner)->animate(ANIM_MODE_5, this, NULL);
- break;
- case 2:
- setDelay(_globals->_randomSource.getRandomNumber(10));
- _actionIndex = 0;
- break;
- default:
- break;
- }
-}
-
-void SpeakerPOR::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(7223);
- _object1.setStrip2(2);
- _object1.setPosition(Common::Point(191, 166));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(7223);
- _object2.setPosition(Common::Point(159, 86));
- _object2.setAction(&_speakerAction, NULL);
-
- _object3.postInit(&_objectList);
- _object3.setVisage(7223);
- _object3.setStrip(3);
- _object3.setPosition(Common::Point(119, 107));
- _object3.fixPriority(199);
- _object3.setAction(&_action2);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerOR::SpeakerOR() {
- _speakerName = "OR";
- _newSceneNumber = 9430;
- _textPos = Common::Point(8, 36);
- _color1 = 42;
- _textWidth = 136;
-}
-
-void SpeakerOR::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(9431);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(202, 147));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(9431);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.setZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(199, 85));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerOText::SpeakerOText() : SpeakerGText() {
- _speakerName = "OTEXT";
- _textWidth = 240;
- _textPos = Common::Point(130, 10);
- _color1 = 42;
- _hideObjects = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerQText::SpeakerQText() : ScreenSpeaker() {
- _speakerName = "QTEXT";
- _textPos = Common::Point(160, 40);
- _color1 = 35;
- _textWidth = 240;
- _textMode = ALIGN_CENTER;
- _hideObjects = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerSText::SpeakerSText() : ScreenSpeaker() {
- _speakerName = "STEXT";
- _color1 = 13;
- _textWidth = 240;
- _textMode = ALIGN_CENTER;
- _hideObjects = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerPOText::SpeakerPOText() : ScreenSpeaker() {
- _speakerName = "POTEXT";
- _textWidth = 240;
- _textMode = ALIGN_CENTER;
- _color1 = 41;
- _hideObjects = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerMText::SpeakerMText() {
- _speakerName = "MTEXT";
- _color1 = 22;
- _textWidth = 230;
- _textMode = ALIGN_CENTER;
- _hideObjects = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerCText::SpeakerCText() {
- _speakerName = "CTEXT";
- _color1 = 4;
- _textWidth = 240;
- _textMode = ALIGN_CENTER;
- _hideObjects = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerEText::SpeakerEText() {
- _speakerName = "ETEXT";
- _textPos = Common::Point(20, 20);
- _color1 = 22;
- _hideObjects = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerGR::SpeakerGR() : AnimatedSpeaker() {
- _speakerName = "GR";
- _newSceneNumber = 9220;
- _textWidth = 136;
- _textPos = Common::Point(168, 36);
- _color1 = 14;
-}
-
-void SpeakerGR::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(9221);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(101, 70));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerHText::SpeakerHText() {
- _speakerName = "HTEXT";
- _textPos = Common::Point(160, 40);
- _color1 = 52;
- _hideObjects = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerSKText::SpeakerSKText() : ScreenSpeaker() {
- _speakerName = "SKTEXT";
- _textWidth = 240;
- _textMode = ALIGN_CENTER;
- _color1 = 9;
- _hideObjects = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerPText::SpeakerPText() {
- _speakerName = "PTEXT";
- _textWidth = 240;
- _textMode = ALIGN_CENTER;
- _color1 = 5;
- _hideObjects = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerCHFText::SpeakerCHFText() {
- _speakerName = "CHFTEXT";
- _textWidth = 240;
- _textMode = ALIGN_CENTER;
- _color1 = 56;
- _hideObjects = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerCDRText::SpeakerCDRText() {
- _speakerName = "CDRTEXT";
- _textWidth = 240;
- _textMode = ALIGN_CENTER;
- _color1 = 52;
- _hideObjects = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerFLText::SpeakerFLText() {
- _speakerName = "FLTEXT";
- _textPos = Common::Point(10, 40);
- _color1 = 17;
- _hideObjects = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerBatText::SpeakerBatText() {
- _speakerName = "BATTEXT";
- _textWidth = 240;
- _textMode = ALIGN_CENTER;
- _color1 = 3;
- _hideObjects = false;
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerSKL::SpeakerSKL() : AnimatedSpeaker() {
- _speakerName = "SKL";
- _newSceneNumber = 7011;
- _textPos = Common::Point(10, 30);
- _color1 = 9;
-}
-
-void SpeakerSKL::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(7013);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(203, 120));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(7013);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(197, 80));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerQL::SpeakerQL() : AnimatedSpeaker() {
- _speakerName = "QL";
- _newSceneNumber = 2610;
- _textPos = Common::Point(160, 30);
- _color1 = 35;
- _textMode = ALIGN_CENTER;
-}
-
-void SpeakerQL::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(2612);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(128, 146));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(2612);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(122, 84));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerSR::SpeakerSR() {
- _speakerName = "SR";
- _newSceneNumber = 2811;
- _textPos = Common::Point(10, 30);
- _color1 = 13;
- _textMode = ALIGN_CENTER;
-}
-
-void SpeakerSR::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(2813);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(224, 198));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(2813);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(203, 96));
- _object2.setAction(&_speakerAction, NULL);
-
- _object3.postInit(&_objectList);
- _object3.setVisage(2813);
- _object3.setStrip(3);
- _object3.setPosition(Common::Point(204, 91));
- _object3.fixPriority(199);
- _object3._numFrames = 3;
- _object3.animate(ANIM_MODE_7, 0, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerSL::SpeakerSL() {
- _speakerName = "SL";
- _newSceneNumber = 2810;
- _textPos = Common::Point(140, 30);
- _textWidth = 160;
- _color1 = 13;
- _textMode = ALIGN_CENTER;
-}
-
-void SpeakerSL::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(2812);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(95, 198));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(2812);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(116, 96));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerQR::SpeakerQR() {
- _speakerName = "QR";
- _newSceneNumber = 2611;
- _textPos = Common::Point(10, 30);
- _color1 = 35;
- _textMode = ALIGN_CENTER;
-}
-
-void SpeakerQR::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(2613);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(191, 146));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(2613);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(197, 84));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerQU::SpeakerQU() {
- _speakerName = "QU";
- _newSceneNumber = 7020;
- _textPos = Common::Point(160, 30);
- _color1 = 35;
- _textMode = ALIGN_CENTER;
-}
-
-void SpeakerQU::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(7021);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(116, 120));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(7021);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(111, 84));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerCR::SpeakerCR() {
- _speakerName = "CR";
- _newSceneNumber = 9010;
- _textPos = Common::Point(20, 40);
- _color1 = 4;
-}
-
-void SpeakerCR::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(9011);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.setPosition(Common::Point(219, 168));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(9011);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.setPosition(Common::Point(232, 81));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerMR::SpeakerMR() {
- _speakerName = "MR";
- _newSceneNumber = 2711;
- _textPos = Common::Point(10, 40);
- _color1 = 22;
-}
-
-void SpeakerMR::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(2713);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(220, 143));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(2713);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(215, 99));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerSAL::SpeakerSAL() {
- _speakerName = "SAL";
- _newSceneNumber = 2851;
- _textPos = Common::Point(10, 30);
- _color1 = 13;
- _textMode = ALIGN_CENTER;
-}
-
-void SpeakerSAL::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(2853);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(185, 200));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(2853);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(170, 92));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerML::SpeakerML() {
- _speakerName = "ML";
- _newSceneNumber = 2710;
- _textPos = Common::Point(160, 40);
- _color1 = 22;
-}
-
-void SpeakerML::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(2712);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(99, 143));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(2712);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(105, 99));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerCHFL::SpeakerCHFL() {
- _speakerName = "CHFL";
- _newSceneNumber = 4111;
- _textPos = Common::Point(10, 40);
- _color1 = 56;
-}
-
-void SpeakerCHFL::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(4113);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(205, 116));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(4113);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(202, 71));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerCHFR::SpeakerCHFR() {
- _speakerName = "CHFR";
- _newSceneNumber = 4110;
- _textPos = Common::Point(160, 40);
- _color1 = 56;
-}
-
-void SpeakerCHFR::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(4112);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(103, 116));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(4112);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(106, 71));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerPL::SpeakerPL() {
- _speakerName = "PL";
- _newSceneNumber = 4060;
- _textPos = Common::Point(160, 40);
- _color1 = 5;
-}
-
-void SpeakerPL::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(4062);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(107, 117));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(4062);
- _object2.setStrip2(1);
- _object2.fixPriority(200);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(105, 62));
- _object2.setAction(&_speakerAction, NULL);
-
- _object3.postInit(&_objectList);
- _object3.setVisage(4062);
- _object3.setStrip2(3);
- _object3.fixPriority(255);
- _object3.changeZoom(100);
- _object3._frame = 1;
- _object3.setPosition(Common::Point(105, 59));
- _object3.setAction(&_speakerAction2, NULL);
-
- Speaker::setText(msg);
-}
-
-void SpeakerPL::removeText() {
- _object3.remove();
- AnimatedSpeaker::removeText();
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerPR::SpeakerPR() {
- _speakerName = "PR";
- _newSceneNumber = 4061;
- _textPos = Common::Point(10, 40);
- _color1 = 5;
-}
-
-void SpeakerPR::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(4063);
- _object1.setStrip2(1);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(212, 117));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(4063);
- _object2.setStrip2(2);
- _object2.fixPriority(200);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(214, 62));
- _object2.setAction(&_speakerAction, NULL);
-
- _object3.postInit(&_objectList);
- _object3.setVisage(4063);
- _object3.setStrip2(3);
- _object3.fixPriority(255);
- _object3.changeZoom(100);
- _object3._frame = 1;
- _object3.setPosition(Common::Point(214, 59));
- _object3.setAction(&_speakerAction2, NULL);
-
- Speaker::setText(msg);
-}
-
-void SpeakerPR::removeText() {
- _object3.remove();
- AnimatedSpeaker::removeText();
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerCDR::SpeakerCDR() {
- _speakerName = "CDR";
- _newSceneNumber = 4161;
- _textPos = Common::Point(10, 40);
- _color1 = 52;
-}
-
-void SpeakerCDR::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(4163);
- _object1.setStrip2(1);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(208, 97));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(4163);
- _object2.setStrip2(2);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(200, 57));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerCDL::SpeakerCDL() {
- _speakerName = "CDL";
- _newSceneNumber = 4160;
- _textPos = Common::Point(160, 40);
- _color1 = 52;
-}
-
-void SpeakerCDL::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(4162);
- _object1.setStrip2(1);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(112, 97));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(4162);
- _object2.setStrip2(2);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(115, 57));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerFLL::SpeakerFLL() {
- _speakerName = "FLL";
- _newSceneNumber = 5221;
- _textPos = Common::Point(10, 40);
- _color1 = 17;
-}
-
-void SpeakerFLL::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(5223);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(216, 129));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(5223);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(210, 67));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
-SpeakerBatR::SpeakerBatR() {
- _speakerName = "BATR";
- _newSceneNumber = 5360;
- _textPos = Common::Point(140, 40);
- _color1 = 3;
-}
-
-void SpeakerBatR::setText(const Common::String &msg) {
- _object1.postInit(&_objectList);
- _object1.setVisage(5361);
- _object1.setStrip2(2);
- _object1.fixPriority(255);
- _object1.changeZoom(100);
- _object1._frame = 1;
- _object1.setPosition(Common::Point(137, 122));
- _object1.animate(ANIM_MODE_7, 0, NULL);
-
- _object2.postInit(&_objectList);
- _object2.setVisage(5361);
- _object2.setStrip2(1);
- _object2.fixPriority(255);
- _object2.changeZoom(100);
- _object2._frame = 1;
- _object2.setPosition(Common::Point(137, 104));
- _object2.setAction(&_speakerAction, NULL);
-
- Speaker::setText(msg);
-}
-
-/*--------------------------------------------------------------------------*/
-
RingworldInvObjectList::RingworldInvObjectList() :
_stunner(2280, 1, 2, OBJECT_STUNNER, "This is your stunner."),
_scanner(1, 1, 3, OBJECT_SCANNER, "A combination scanner comm unit."),
@@ -1277,58 +404,13 @@ RingworldInvObjectList::RingworldInvObjectList() :
/*--------------------------------------------------------------------------*/
-void RingworldGame::restartGame() {
- if (MessageDialog::show(RESTART_MSG, CANCEL_BTN_STRING, RESTART_BTN_STRING) == 1)
- _globals->_game->restart();
-}
-
-void RingworldGame::saveGame() {
- if (!_vm->canSaveGameStateCurrently())
- MessageDialog::show(SAVING_NOT_ALLOWED_MSG, OK_BTN_STRING);
- else {
- // Show the save dialog
- handleSaveLoad(true, _globals->_sceneHandler->_saveGameSlot, _globals->_sceneHandler->_saveName);
- }
-}
-
-void RingworldGame::restoreGame() {
- if (!_vm->canLoadGameStateCurrently())
- MessageDialog::show(RESTORING_NOT_ALLOWED_MSG, OK_BTN_STRING);
- else {
- // Show the load dialog
- handleSaveLoad(false, _globals->_sceneHandler->_loadGameSlot, _globals->_sceneHandler->_saveName);
- }
-}
-
-void RingworldGame::quitGame() {
- if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1)
- _vm->quitGame();
-}
-
-void RingworldGame::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {
- const EnginePlugin *plugin = 0;
- EngineMan.findGame(_vm->getGameId(), &plugin);
- GUI::SaveLoadChooser *dialog;
- if (saveFlag)
- dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
- else
- dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"));
-
- dialog->setSaveMode(saveFlag);
-
- saveSlot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
- saveName = dialog->getResultString();
-
- delete dialog;
-}
-
void RingworldGame::start() {
// Set some default flags
- _globals->setFlag(12);
- _globals->setFlag(34);
+ g_globals->setFlag(12);
+ g_globals->setFlag(34);
// Set the screen to scroll in response to the player moving off-screen
- _globals->_scrollFollower = &_globals->_player;
+ g_globals->_scrollFollower = &g_globals->_player;
// Set the object's that will be in the player's inventory by default
RING_INVENTORY._stunner._sceneNumber = 1;
@@ -1339,8 +421,8 @@ void RingworldGame::start() {
if (ConfMan.hasKey("save_slot")) {
slot = ConfMan.getInt("save_slot");
- Common::String file = _vm->generateSaveName(slot);
- Common::InSaveFile *in = _vm->_system->getSavefileManager()->openForLoading(file);
+ Common::String file = g_vm->generateSaveName(slot);
+ Common::InSaveFile *in = g_vm->_system->getSavefileManager()->openForLoading(file);
if (in)
delete in;
else
@@ -1348,28 +430,28 @@ void RingworldGame::start() {
}
if (slot >= 0)
- _globals->_sceneHandler->_loadGameSlot = slot;
+ g_globals->_sceneHandler->_loadGameSlot = slot;
else
// Switch to the title screen
- _globals->_sceneManager.setNewScene(1000);
+ g_globals->_sceneManager.setNewScene(1000);
- _globals->_events.showCursor();
+ g_globals->_events.showCursor();
}
void RingworldGame::restart() {
- _globals->_scenePalette.clearListeners();
- _globals->_soundHandler.stop();
+ g_globals->_scenePalette.clearListeners();
+ g_globals->_soundHandler.stop();
// Reset the flags
- _globals->reset();
- _globals->setFlag(34);
+ g_globals->reset();
+ g_globals->setFlag(34);
// Clear save/load slots
- _globals->_sceneHandler->_saveGameSlot = -1;
- _globals->_sceneHandler->_loadGameSlot = -1;
+ g_globals->_sceneHandler->_saveGameSlot = -1;
+ g_globals->_sceneHandler->_loadGameSlot = -1;
- _globals->_stripNum = 0;
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_stripNum = 0;
+ g_globals->_events.setCursor(CURSOR_WALK);
// Reset item properties
RING_INVENTORY._stunner._sceneNumber = 1;
@@ -1407,37 +489,37 @@ void RingworldGame::restart() {
RING_INVENTORY._selectedItem = NULL;
// Change to the first game scene
- _globals->_sceneManager.changeScene(30);
+ g_globals->_sceneManager.changeScene(30);
}
void RingworldGame::endGame(int resNum, int lineNum) {
- _globals->_events.setCursor(CURSOR_WALK);
- Common::String msg = _resourceManager->getMessage(resNum, lineNum);
- bool savesExist = _saver->savegamesExist();
+ g_globals->_events.setCursor(CURSOR_WALK);
+ Common::String msg = g_resourceManager->getMessage(resNum, lineNum);
+ bool savesExist = g_saver->savegamesExist();
if (!savesExist) {
// No savegames exist, so prompt the user to restart or quit
if (MessageDialog::show(msg, QUIT_BTN_STRING, RESTART_BTN_STRING) == 0)
- _vm->quitGame();
+ g_vm->quitGame();
else
restart();
} else {
// Savegames exist, so prompt for Restore/Restart
bool breakFlag;
do {
- if (_vm->shouldQuit()) {
+ if (g_vm->shouldQuit()) {
breakFlag = true;
} else if (MessageDialog::show(msg, RESTART_BTN_STRING, RESTORE_BTN_STRING) == 0) {
restart();
breakFlag = true;
} else {
- handleSaveLoad(false, _globals->_sceneHandler->_loadGameSlot, _globals->_sceneHandler->_saveName);
- breakFlag = _globals->_sceneHandler->_loadGameSlot >= 0;
+ handleSaveLoad(false, g_globals->_sceneHandler->_loadGameSlot, g_globals->_sceneHandler->_saveName);
+ breakFlag = g_globals->_sceneHandler->_loadGameSlot >= 0;
}
} while (!breakFlag);
}
- _globals->_events.setCursorFromFlag();
+ g_globals->_events.setCursorFromFlag();
}
void RingworldGame::processEvent(Event &event) {
@@ -1448,15 +530,10 @@ void RingworldGame::processEvent(Event &event) {
MessageDialog::show(HELP_MSG, OK_BTN_STRING);
break;
- case Common::KEYCODE_F2: {
+ case Common::KEYCODE_F2:
// F2 - Sound Options
- ConfigDialog *dlg = new ConfigDialog();
- dlg->runModal();
- delete dlg;
- _globals->_soundManager.syncSounds();
- _globals->_events.setCursorFromFlag();
+ SoundDialog::execute();
break;
- }
case Common::KEYCODE_F3:
// F3 - Quit
@@ -1467,20 +544,20 @@ void RingworldGame::processEvent(Event &event) {
case Common::KEYCODE_F4:
// F4 - Restart
restartGame();
- _globals->_events.setCursorFromFlag();
+ g_globals->_events.setCursorFromFlag();
break;
case Common::KEYCODE_F7:
// F7 - Restore
restoreGame();
- _globals->_events.setCursorFromFlag();
+ g_globals->_events.setCursorFromFlag();
break;
case Common::KEYCODE_F10:
// F10 - Pause
GfxDialog::setPalette();
MessageDialog::show(GAME_PAUSED_MSG, OK_BTN_STRING);
- _globals->_events.setCursorFromFlag();
+ g_globals->_events.setCursorFromFlag();
break;
default:
@@ -1489,6 +566,12 @@ void RingworldGame::processEvent(Event &event) {
}
}
+void RingworldGame::rightClick() {
+ RightClickDialog *dlg = new RightClickDialog();
+ dlg->execute();
+ delete dlg;
+}
+
} // End of namespace Ringworld
} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld/ringworld_logic.h b/engines/tsage/ringworld/ringworld_logic.h
index 69e5520581..84816347af 100644
--- a/engines/tsage/ringworld/ringworld_logic.h
+++ b/engines/tsage/ringworld/ringworld_logic.h
@@ -102,302 +102,6 @@ public:
};
/*--------------------------------------------------------------------------*/
-// Ringworld specific game speakers
-
-class SpeakerGText : public Speaker {
-public:
- SceneObject _sceneObject;
-public:
- SpeakerGText();
-
- virtual Common::String getClassName() { return "SpeakerGText"; }
- virtual void setText(const Common::String &msg);
- virtual void removeText();
-};
-
-class SpeakerPOR : public AnimatedSpeaker {
- class SpeakerAction1 : public SpeakerAction {
- public:
- virtual void signal();
- };
-
-public:
- SceneObject _object3;
- SpeakerAction1 _action2;
-public:
- SpeakerPOR();
- virtual Common::String getClassName() { return "SpeakerPOR"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerOR : public AnimatedSpeaker {
-public:
- SpeakerOR();
- virtual Common::String getClassName() { return "SpeakerOR"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerOText : public SpeakerGText {
-public:
- SpeakerOText();
-
- virtual Common::String getClassName() { return "SpeakerOText"; }
-};
-
-class SpeakerPOText : public ScreenSpeaker {
-public:
- SpeakerPOText();
-
- virtual Common::String getClassName() { return "SpeakerPOText"; }
-};
-
-class SpeakerSText : public ScreenSpeaker {
-public:
- SpeakerSText();
-
- virtual Common::String getClassName() { return "SpeakerSText"; }
-};
-
-class SpeakerQText : public ScreenSpeaker {
-public:
- SpeakerQText();
-
- virtual Common::String getClassName() { return "SpeakerQText"; }
-};
-
-class SpeakerMText : public ScreenSpeaker {
-public:
- SpeakerMText();
-
- virtual Common::String getClassName() { return "SpeakerMText"; }
-};
-
-class SpeakerCText : public ScreenSpeaker {
-public:
- SpeakerCText();
-
- virtual Common::String getClassName() { return "SpeakerCText"; }
-};
-
-class SpeakerEText : public ScreenSpeaker {
-public:
- SpeakerEText();
-
- virtual Common::String getClassName() { return "SpeakerEText"; }
-};
-
-class SpeakerGR : public AnimatedSpeaker {
-public:
- SpeakerGR();
-
- virtual Common::String getClassName() { return "SpeakerGR"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerHText : public ScreenSpeaker {
-public:
- SpeakerHText();
-
- virtual Common::String getClassName() { return "SpeakerHText"; }
-};
-
-class SpeakerPText : public ScreenSpeaker {
-public:
- SpeakerPText();
-
- virtual Common::String getClassName() { return "SpeakerPText"; }
-};
-
-class SpeakerCHFText : public ScreenSpeaker {
-public:
- SpeakerCHFText();
-
- virtual Common::String getClassName() { return "SpeakerCHFText"; }
-};
-
-class SpeakerSKText : public ScreenSpeaker {
-public:
- SpeakerSKText();
-
- virtual Common::String getClassName() { return "SpeakerSKText"; }
-};
-
-class SpeakerCDRText : public ScreenSpeaker {
-public:
- SpeakerCDRText();
-
- virtual Common::String getClassName() { return "SpeakerCDRText"; }
-};
-
-class SpeakerFLText : public ScreenSpeaker {
-public:
- SpeakerFLText();
-
- virtual Common::String getClassName() { return "SpeakerFLText"; }
-};
-
-class SpeakerBatText : public ScreenSpeaker {
-public:
- SpeakerBatText();
-
- virtual Common::String getClassName() { return "SpeakerFLText"; }
-};
-
-class SpeakerQR : public AnimatedSpeaker {
-public:
- SpeakerQR();
-
- virtual Common::String getClassName() { return "SpeakerQR"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerQU : public AnimatedSpeaker {
-public:
- SpeakerQU();
-
- virtual Common::String getClassName() { return "SpeakerQU"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerSKL : public AnimatedSpeaker {
-public:
- SpeakerSKL();
-
- virtual Common::String getClassName() { return "SpeakerQL"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerQL : public AnimatedSpeaker {
-public:
- SpeakerQL();
-
- virtual Common::String getClassName() { return "SpeakerQL"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerSR : public AnimatedSpeaker {
-public:
- SceneObject _object3;
-public:
- SpeakerSR();
-
- virtual Common::String getClassName() { return "SpeakerSR"; }
- void setText(const Common::String &msg);
-};
-
-class SpeakerSL : public AnimatedSpeaker {
-public:
- SpeakerSL();
-
- virtual Common::String getClassName() { return "SpeakerSL"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerCR : public AnimatedSpeaker {
-public:
- SpeakerCR();
-
- virtual Common::String getClassName() { return "SpeakerCR"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerMR : public AnimatedSpeaker {
-public:
- SpeakerMR();
-
- virtual Common::String getClassName() { return "SpeakerMR"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerSAL : public AnimatedSpeaker {
-public:
- SpeakerSAL();
-
- virtual Common::String getClassName() { return "SpeakerSAL"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerML : public AnimatedSpeaker {
-public:
- SpeakerML();
-
- virtual Common::String getClassName() { return "SpeakerML"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerCHFL : public AnimatedSpeaker {
-public:
- SpeakerCHFL();
-
- virtual Common::String getClassName() { return "SpeakerCHFL"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerCHFR : public AnimatedSpeaker {
-public:
- SpeakerCHFR();
-
- virtual Common::String getClassName() { return "SpeakerCHFR"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerPL : public AnimatedSpeaker {
-public:
- SceneObject _object3;
- SpeakerAction _speakerAction2;
-
- SpeakerPL();
-
- virtual Common::String getClassName() { return "SpeakerPL"; }
- virtual void setText(const Common::String &msg);
- virtual void removeText();
-};
-
-class SpeakerPR : public AnimatedSpeaker {
-public:
- SceneObject _object3;
- SpeakerAction _speakerAction2;
-
- SpeakerPR();
-
- virtual Common::String getClassName() { return "SpeakerPR"; }
- virtual void setText(const Common::String &msg);
- virtual void removeText();
-};
-
-class SpeakerCDR : public AnimatedSpeaker {
-public:
- SpeakerCDR();
-
- virtual Common::String getClassName() { return "SpeakerCDR"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerCDL : public AnimatedSpeaker {
-public:
- SpeakerCDL();
-
- virtual Common::String getClassName() { return "SpeakerCDL"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerFLL : public AnimatedSpeaker {
-public:
- SpeakerFLL();
-
- virtual Common::String getClassName() { return "SpeakerFLL"; }
- virtual void setText(const Common::String &msg);
-};
-
-class SpeakerBatR : public AnimatedSpeaker {
-public:
- SpeakerBatR();
-
- virtual Common::String getClassName() { return "SpeakerBatR"; }
- virtual void setText(const Common::String &msg);
-};
-
-/*--------------------------------------------------------------------------*/
class RingworldInvObjectList : public InvObjectList {
public:
@@ -440,22 +144,17 @@ public:
virtual Common::String getClassName() { return "RingworldInvObjectList"; }
};
-#define RING_INVENTORY (*((::TsAGE::Ringworld::RingworldInvObjectList *)_globals->_inventory))
+#define RING_INVENTORY (*((::TsAGE::Ringworld::RingworldInvObjectList *)g_globals->_inventory))
class RingworldGame: public Game {
-protected:
- virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName);
public:
virtual void start();
virtual void restart();
- virtual void restartGame();
- virtual void saveGame();
- virtual void restoreGame();
- virtual void quitGame();
virtual void endGame(int resNum, int lineNum);
virtual Scene *createScene(int sceneNumber);
virtual void processEvent(Event &event);
+ virtual void rightClick();
};
} // End of namespace Ringworld
diff --git a/engines/tsage/ringworld/ringworld_scenes1.cpp b/engines/tsage/ringworld/ringworld_scenes1.cpp
index 20af25561c..8227e2a884 100644
--- a/engines/tsage/ringworld/ringworld_scenes1.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes1.cpp
@@ -35,14 +35,14 @@ namespace Ringworld {
*--------------------------------------------------------------------------*/
void Scene10::Action1::signal() {
- Scene10 *scene = (Scene10 *)_globals->_sceneManager._scene;
+ Scene10 *scene = (Scene10 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(6);
break;
case 1:
- _globals->_scenePalette.addRotation(240, 254, -1);
+ g_globals->_scenePalette.addRotation(240, 254, -1);
scene->_stripManager.start(10, this);
break;
case 2:
@@ -100,21 +100,21 @@ void Scene10::Action1::signal() {
scene->_object4.animate(ANIM_MODE_6, this);
break;
case 10:
- _globals->_soundHandler.fadeOut(this);
+ g_globals->_soundHandler.fadeOut(this);
break;
case 11:
- _globals->_scenePalette.clearListeners();
- _globals->_sceneManager.changeScene(15);
+ g_globals->_scenePalette.clearListeners();
+ g_globals->_sceneManager.changeScene(15);
break;
}
}
void Scene10::Action2::signal() {
- Scene10 *scene = (Scene10 *)_globals->_sceneManager._scene;
+ Scene10 *scene = (Scene10 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- setDelay(_globals->_randomSource.getRandomNumber(179));
+ setDelay(g_globals->_randomSource.getRandomNumber(179));
break;
case 1:
scene->_object3.setFrame(1);
@@ -183,11 +183,11 @@ void Scene10::postInit(SceneObjectList *OwnerList) {
_object6.animate(ANIM_MODE_2, NULL);
_object6._numFrames = 5;
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
setAction(&_action1);
- _globals->_soundHandler.play(5);
+ g_globals->_soundHandler.play(5);
}
void Scene10::stripCallback(int v) {
@@ -213,7 +213,7 @@ void Scene10::stripCallback(int v) {
*--------------------------------------------------------------------------*/
void Scene15::Action1::signal() {
- Scene15 *scene = (Scene15 *)_globals->_sceneManager._scene;
+ Scene15 *scene = (Scene15 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -239,13 +239,13 @@ void Scene15::Action1::signal() {
}
case 3:
SceneItem::display(0, 0);
- _globals->_sceneManager.changeScene(20);
+ g_globals->_sceneManager.changeScene(20);
break;
}
}
void Scene15::Action1::dispatch() {
- Scene15 *scene = (Scene15 *)_globals->_sceneManager._scene;
+ Scene15 *scene = (Scene15 *)g_globals->_sceneManager._scene;
if (scene->_object1._position.y < 100)
scene->_object1.changeZoom(100 - scene->_object1._position.y);
@@ -258,7 +258,7 @@ void Scene15::postInit(SceneObjectList *OwnerList) {
loadScene(15);
Scene::postInit();
setZoomPercents(0, 100, 200, 100);
- _globals->_soundHandler.play(6);
+ g_globals->_soundHandler.play(6);
setAction(&_action1);
}
@@ -268,7 +268,7 @@ void Scene15::postInit(SceneObjectList *OwnerList) {
*--------------------------------------------------------------------------*/
void Scene20::Action1::signal() {
- Scene20 *scene = (Scene20 *)_globals->_sceneManager._scene;
+ Scene20 *scene = (Scene20 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -278,11 +278,11 @@ void Scene20::Action1::signal() {
scene->_stripManager.start(20, this);
break;
case 2:
- _globals->_soundHandler.fadeOut(this);
+ g_globals->_soundHandler.fadeOut(this);
break;
case 3:
- _globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
- _globals->_sceneManager.changeScene(30); // First game scene
+ g_globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
+ g_globals->_sceneManager.changeScene(30); // First game scene
break;
default:
break;
@@ -290,7 +290,7 @@ void Scene20::Action1::signal() {
}
void Scene20::Action2::signal() {
- Scene20 *scene = (Scene20 *)_globals->_sceneManager._scene;
+ Scene20 *scene = (Scene20 *)g_globals->_sceneManager._scene;
NpcMover *npcMover;
switch (_actionIndex++) {
@@ -305,51 +305,51 @@ void Scene20::Action2::signal() {
case 2: {
NpcMover *mover = new NpcMover();
Common::Point pt(455, 77);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
ObjectMover2 *mover2 = new ObjectMover2();
- scene->_SceneObjectExt.addMover(mover2, 5, 10, &_globals->_player);
+ scene->_SceneObjectExt.addMover(mover2, 5, 10, &g_globals->_player);
ObjectMover2 *mover3 = new ObjectMover2();
- scene->_sceneObject3.addMover(mover3, 10, 15, &_globals->_player);
+ scene->_sceneObject3.addMover(mover3, 10, 15, &g_globals->_player);
break;
}
case 3: {
npcMover = new NpcMover();
Common::Point pt(557, 100);
- _globals->_player.addMover(npcMover, &pt, this);
+ g_globals->_player.addMover(npcMover, &pt, this);
break;
}
case 4: {
npcMover = new NpcMover();
Common::Point pt(602, 90);
- _globals->_player.addMover(npcMover, &pt, this);
+ g_globals->_player.addMover(npcMover, &pt, this);
break;
}
case 5: {
npcMover = new NpcMover();
Common::Point pt(618, 90);
- _globals->_player.addMover(npcMover, &pt, this);
+ g_globals->_player.addMover(npcMover, &pt, this);
break;
}
case 6: {
npcMover = new NpcMover();
Common::Point pt(615, 81);
- _globals->_player.addMover(npcMover, &pt, this);
+ g_globals->_player.addMover(npcMover, &pt, this);
break;
}
case 7: {
npcMover = new NpcMover();
Common::Point pt(588, 79);
- _globals->_player.addMover(npcMover, &pt, this);
+ g_globals->_player.addMover(npcMover, &pt, this);
break;
}
case 8:
scene->_sound.release();
- _globals->_soundHandler.fadeOut(this);
+ g_globals->_soundHandler.fadeOut(this);
break;
case 9:
SceneItem::display(0, 0, LIST_END);
- _globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
- _globals->_sceneManager.changeScene(40);
+ g_globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
+ g_globals->_sceneManager.changeScene(40);
break;
default:
break;
@@ -357,7 +357,7 @@ void Scene20::Action2::signal() {
}
void Scene20::Action3::signal() {
- Scene20 *scene = (Scene20 *)_globals->_sceneManager._scene;
+ Scene20 *scene = (Scene20 *)g_globals->_sceneManager._scene;
NpcMover *npcMover;
switch (_actionIndex++) {
@@ -367,47 +367,47 @@ void Scene20::Action3::signal() {
case 1: {
npcMover = new NpcMover();
Common::Point pt(615, 81);
- _globals->_player.addMover(npcMover, &pt, this);
+ g_globals->_player.addMover(npcMover, &pt, this);
ObjectMover2 *mover1 = new ObjectMover2();
- scene->_SceneObjectExt.addMover(mover1, 5, 10, &_globals->_player);
+ scene->_SceneObjectExt.addMover(mover1, 5, 10, &g_globals->_player);
ObjectMover2 *mover2 = new ObjectMover2();
- scene->_sceneObject3.addMover(mover2, 20, 25, &_globals->_player);
+ scene->_sceneObject3.addMover(mover2, 20, 25, &g_globals->_player);
break;
}
case 2: {
npcMover = new NpcMover();
Common::Point pt(618, 90);
- _globals->_player.addMover(npcMover, &pt, this);
+ g_globals->_player.addMover(npcMover, &pt, this);
break;
}
case 3: {
- _globals->_player._moveDiff = Common::Point(10, 10);
+ g_globals->_player._moveDiff = Common::Point(10, 10);
scene->_SceneObjectExt._moveDiff = Common::Point(10, 10);
scene->_sceneObject3._moveDiff = Common::Point(10, 10);
npcMover = new NpcMover();
Common::Point pt(445, 132);
- _globals->_player.addMover(npcMover, &pt, this);
+ g_globals->_player.addMover(npcMover, &pt, this);
break;
}
case 4: {
npcMover = new NpcMover();
Common::Point pt(151, 137);
- _globals->_player.addMover(npcMover, &pt, this);
+ g_globals->_player.addMover(npcMover, &pt, this);
break;
}
case 5: {
npcMover = new NpcMover();
Common::Point pt(-15, 137);
- _globals->_player.addMover(npcMover, &pt, this);
+ g_globals->_player.addMover(npcMover, &pt, this);
break;
}
case 6:
scene->_sound.play(60, this, 127);
- _globals->_soundHandler.release();
+ g_globals->_soundHandler.release();
break;
case 7:
- _globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
- _globals->_sceneManager.changeScene(90);
+ g_globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
+ g_globals->_sceneManager.changeScene(90);
break;
default:
break;
@@ -415,7 +415,7 @@ void Scene20::Action3::signal() {
}
void Scene20::Action4::signal() {
- Scene20 *scene = (Scene20 *)_globals->_sceneManager._scene;
+ Scene20 *scene = (Scene20 *)g_globals->_sceneManager._scene;
NpcMover *npcMover;
switch (_actionIndex++) {
@@ -425,20 +425,20 @@ void Scene20::Action4::signal() {
case 1: {
npcMover = new NpcMover();
Common::Point pt(486, 134);
- _globals->_player.addMover(npcMover, &pt, this);
+ g_globals->_player.addMover(npcMover, &pt, this);
ObjectMover2 *mover1 = new ObjectMover2();
- scene->_SceneObjectExt.addMover(mover1, 20, 35, &_globals->_player);
+ scene->_SceneObjectExt.addMover(mover1, 20, 35, &g_globals->_player);
break;
}
case 2: {
- _globals->_player._moveDiff = Common::Point(12, 12);
+ g_globals->_player._moveDiff = Common::Point(12, 12);
scene->_SceneObjectExt._moveDiff = Common::Point(12, 12);
NpcMover *mover1 = new NpcMover();
Common::Point pt(486, 134);
scene->_sceneObject3.addMover(mover1, &pt, this);
NpcMover *mover2 = new NpcMover();
pt = Common::Point(-15, 134);
- _globals->_player.addMover(mover2, &pt, NULL);
+ g_globals->_player.addMover(mover2, &pt, NULL);
NpcMover *mover3 = new NpcMover();
pt = Common::Point(-15, 134);
scene->_SceneObjectExt.addMover(mover3, &pt, NULL);
@@ -485,7 +485,7 @@ void Scene20::Action4::signal() {
scene->_sceneObject5._moveDiff.x = 48;
ObjectMover3 *mover = new ObjectMover3();
- scene->_sceneObject5.addMover(mover, &_globals->_player, 4, this);
+ scene->_sceneObject5.addMover(mover, &g_globals->_player, 4, this);
break;
}
case 6: {
@@ -494,24 +494,24 @@ void Scene20::Action4::signal() {
scene->_SceneObjectExt.animate(ANIM_MODE_2, NULL);
scene->_sceneObject5.remove();
- _globals->_player.setVisage(21);
- _globals->_player.setStrip(1);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_5, this);
- _globals->_player._moveDiff.x = 4;
+ g_globals->_player.setVisage(21);
+ g_globals->_player.setStrip(1);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player._moveDiff.x = 4;
npcMover = new NpcMover();
- Common::Point pt(_globals->_player._position.x - 25, _globals->_player._position.y + 5);
- _globals->_player.addMover(npcMover, &pt, this);
+ Common::Point pt(g_globals->_player._position.x - 25, g_globals->_player._position.y + 5);
+ g_globals->_player.addMover(npcMover, &pt, this);
break;
}
case 7:
- _globals->_player.setStrip(2);
- _globals->_player.animate(ANIM_MODE_2, NULL);
+ g_globals->_player.setStrip(2);
+ g_globals->_player.animate(ANIM_MODE_2, NULL);
scene->_sound.play(77, this, 127);
break;
case 8:
- _globals->_game->endGame(20, 0);
+ g_globals->_game->endGame(20, 0);
break;
default:
break;
@@ -529,15 +529,15 @@ void Scene20::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerQText);
_stripManager.addSpeaker(&_speakerGameText);
- _speakerQText._npc = &_globals->_player;
+ _speakerQText._npc = &g_globals->_player;
- if (_globals->_sceneManager._previousScene == 30) {
+ if (g_globals->_sceneManager._previousScene == 30) {
// Cut scene: Assassins are coming
- _globals->_player.postInit();
- _globals->_player.setVisage(20);
- _globals->_player.setPosition(Common::Point(405, 69));
- _globals->_player._moveDiff = Common::Point(10, 10);
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(20);
+ g_globals->_player.setPosition(Common::Point(405, 69));
+ g_globals->_player._moveDiff = Common::Point(10, 10);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
_SceneObjectExt.postInit();
_SceneObjectExt.setVisage(20);
@@ -551,21 +551,21 @@ void Scene20::postInit(SceneObjectList *OwnerList) {
_SceneObjectExt._moveDiff = Common::Point(10, 10);
_sceneObject3._moveDiff = Common::Point(10, 10);
- _globals->_soundHandler.play(20);
+ g_globals->_soundHandler.play(20);
_sound.play(21);
_sound.holdAt(true);
setAction(&_action2);
_sceneBounds = Rect(320, 0, 640, 200);
- } else if (_globals->_sceneManager._previousScene == 60) {
+ } else if (g_globals->_sceneManager._previousScene == 60) {
// Evasion
_sound.play(30);
- _globals->_player.postInit();
- _globals->_player.setVisage(20);
- _globals->_player.setPosition(Common::Point(588, 79));
- _globals->_player._moveDiff = Common::Point(5, 5);
- _globals->_player.fixPriority(50);
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(20);
+ g_globals->_player.setPosition(Common::Point(588, 79));
+ g_globals->_player._moveDiff = Common::Point(5, 5);
+ g_globals->_player.fixPriority(50);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
_SceneObjectExt.postInit();
_SceneObjectExt.setVisage(20);
@@ -578,28 +578,28 @@ void Scene20::postInit(SceneObjectList *OwnerList) {
_sceneObject3.setPosition(Common::Point(595, 79));
_sceneObject3.animate(ANIM_MODE_1, NULL);
- if ((_globals->getFlag(120) && _globals->getFlag(116)) ||
- (_globals->getFlag(117) && _globals->getFlag(119))) {
+ if ((g_globals->getFlag(120) && g_globals->getFlag(116)) ||
+ (g_globals->getFlag(117) && g_globals->getFlag(119))) {
// Successful evasion
setAction(&_action3);
- } else if (_globals->getFlag(104)) {
+ } else if (g_globals->getFlag(104)) {
_sceneMode = 21;
- setAction(&_sequenceManager, this, 21, &_globals->_player, &_SceneObjectExt, NULL);
+ setAction(&_sequenceManager, this, 21, &g_globals->_player, &_SceneObjectExt, NULL);
} else {
// Failed evasion
_sceneObject3._moveDiff = Common::Point(8, 8);
setAction(&_action4);
}
- _sceneBounds.center(_globals->_player._position.x, _globals->_player._position.y);
+ _sceneBounds.center(g_globals->_player._position.x, g_globals->_player._position.y);
} else {
// Intro: Quinn looking at the monaster
- _globals->_player.postInit();
- _globals->_player.setVisage(2640);
- _globals->_player.animate(ANIM_MODE_NONE, NULL);
- _globals->_player.setStrip2(1);
- _globals->_player.setFrame2(4);
- _globals->_player.fixPriority(200);
- _globals->_player.setPosition(Common::Point(425, 233));
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(2640);
+ g_globals->_player.animate(ANIM_MODE_NONE, NULL);
+ g_globals->_player.setStrip2(1);
+ g_globals->_player.setFrame2(4);
+ g_globals->_player.fixPriority(200);
+ g_globals->_player.setPosition(Common::Point(425, 233));
setAction(&_action1);
_speakerQText.setTextPos(Common::Point(350, 20));
@@ -607,17 +607,17 @@ void Scene20::postInit(SceneObjectList *OwnerList) {
_speakerGameText.setTextPos(Common::Point(350, 20));
_speakerGameText._textWidth = 260;
- _globals->_soundHandler.play(8);
+ g_globals->_soundHandler.play(8);
_sceneBounds = Rect(320, 0, 640, 200);
}
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
loadScene(20);
}
void Scene20::signal() {
if (_sceneMode == 21)
- _globals->_sceneManager.changeScene(90);
+ g_globals->_sceneManager.changeScene(90);
}
/*--------------------------------------------------------------------------
@@ -631,7 +631,7 @@ void Scene30::BeamObject::doAction(int action) {
else if (action == CURSOR_LOOK)
display2(30, 2);
else if (action == CURSOR_USE) {
- Scene30 *parent = (Scene30 *)_globals->_sceneManager._scene;
+ Scene30 *parent = (Scene30 *)g_globals->_sceneManager._scene;
parent->setAction(&parent->_beamAction);
} else
SceneObject::doAction(action);
@@ -649,38 +649,38 @@ void Scene30::DoorObject::doAction(int action) {
}
void Scene30::BeamAction::signal() {
- Scene30 *scene = (Scene30 *)_globals->_sceneManager._scene;
+ Scene30 *scene = (Scene30 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
// Disable control and move player to the doorway beam
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
NpcMover *mover = new NpcMover();
Common::Point pt(114, 198);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 1:
// Perform the animation of player raising hand
- _globals->_player.setVisage(31);
- _globals->_player.setStrip(1);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(31);
+ g_globals->_player.setStrip(1);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 2:
// Hide the beam and lower the player's hand
scene->_sound.play(10, NULL, 127);
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_player.animate(ANIM_MODE_6, this);
scene->_beam.remove();
break;
case 3: {
// Bring the Kzin to the doorway
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setStrip(7);
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setStrip(7);
scene->_kzin.postInit();
scene->_kzin.setVisage(2801);
scene->_kzin.animate(ANIM_MODE_1, NULL);
@@ -689,7 +689,7 @@ void Scene30::BeamAction::signal() {
NpcMover *mover = new NpcMover();
Common::Point pt(158, 170);
scene->_kzin.addMover(mover, &pt, this);
- _globals->_sceneItems.push_front(&scene->_kzin);
+ g_globals->_sceneItems.push_front(&scene->_kzin);
break;
}
@@ -702,7 +702,7 @@ void Scene30::BeamAction::signal() {
case 5:
// Run the Kzin's talk sequence
scene->_sound.play(13, NULL, 127);
- _globals->_soundHandler.play(12, NULL, 127);
+ g_globals->_soundHandler.play(12, NULL, 127);
scene->_stripManager.start((scene->_sceneMode == 0) ? 30 : 37, this);
break;
@@ -715,7 +715,7 @@ void Scene30::BeamAction::signal() {
// Re-activate player control
scene->_sceneMode = 31;
scene->_kzin.setAction(&scene->_kzinAction);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
// End this action
remove();
@@ -727,19 +727,19 @@ void Scene30::BeamAction::signal() {
}
void Scene30::KzinAction::signal() {
- Scene30 *scene = (Scene30 *)_globals->_sceneManager._scene;
+ Scene30 *scene = (Scene30 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(1200);
break;
case 1:
- _globals->_soundHandler.fadeOut(NULL);
- _globals->_player.disableControl();
- setAction(&scene->_sequenceManager, _globals->_sceneManager._scene, 31, &scene->_kzin, &scene->_door, NULL);
+ g_globals->_soundHandler.fadeOut(NULL);
+ g_globals->_player.disableControl();
+ setAction(&scene->_sequenceManager, g_globals->_sceneManager._scene, 31, &scene->_kzin, &scene->_door, NULL);
break;
case 2:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
default:
@@ -748,28 +748,28 @@ void Scene30::KzinAction::signal() {
}
void Scene30::RingAction::signal() {
- Scene30 *scene = (Scene30 *)_globals->_sceneManager._scene;
+ Scene30 *scene = (Scene30 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_kzin.setAction(NULL);
NpcMover *mover = new NpcMover();
Common::Point pt(114, 198);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 1:
- _globals->_player.checkAngle(&scene->_kzin);
+ g_globals->_player.checkAngle(&scene->_kzin);
scene->_stripManager.start(32, this);
break;
case 2: {
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
NpcMover *mover = new NpcMover();
Common::Point pt(143, 177);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
@@ -785,7 +785,7 @@ void Scene30::RingAction::signal() {
scene->_kzin.addMover(kzinMover, &pt, this);
NpcMover *playerMover = new NpcMover();
pt = Common::Point(335, 36);
- _globals->_player.addMover(playerMover, &pt, this);
+ g_globals->_player.addMover(playerMover, &pt, this);
break;
}
@@ -793,7 +793,7 @@ void Scene30::RingAction::signal() {
break;
case 6:
- _globals->_sceneManager.changeScene(20);
+ g_globals->_sceneManager.changeScene(20);
break;
default:
@@ -802,19 +802,19 @@ void Scene30::RingAction::signal() {
}
void Scene30::TalkAction::signal() {
- Scene30 *scene = (Scene30 *)_globals->_sceneManager._scene;
+ Scene30 *scene = (Scene30 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_kzin.setAction(NULL);
NpcMover *mover = new NpcMover();
Common::Point pt(114, 198);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 1:
- _globals->_player.checkAngle(&scene->_kzin);
+ g_globals->_player.checkAngle(&scene->_kzin);
scene->_stripManager.start(34, this);
break;
case 2:
@@ -822,7 +822,7 @@ void Scene30::TalkAction::signal() {
break;
case 3:
scene->_kzin.setAction(&scene->_kzinAction);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
default:
@@ -833,7 +833,7 @@ void Scene30::TalkAction::signal() {
/*--------------------------------------------------------------------------*/
void Scene30::KzinObject::doAction(int action) {
- Scene30 *scene = (Scene30 *)_globals->_sceneManager._scene;
+ Scene30 *scene = (Scene30 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_STUNNER:
@@ -853,7 +853,7 @@ void Scene30::KzinObject::doAction(int action) {
display2(30, 10);
break;
case CURSOR_TALK:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_talkAction);
break;
default:
@@ -881,19 +881,19 @@ void Scene30::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerSText);
_stripManager.addSpeaker(&_speakerQText);
_speakerSText._npc = &_kzin;
- _speakerQText._npc = &_globals->_player;
+ _speakerQText._npc = &g_globals->_player;
// Setup player
- _globals->_player.postInit();
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setStrip(7);
- _globals->_player.setFrame(1);
- _globals->_player.setPosition(Common::Point(114, 198));
- _globals->_player.changeZoom(75);
- _globals->_player.enableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setStrip(7);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.setPosition(Common::Point(114, 198));
+ g_globals->_player.changeZoom(75);
+ g_globals->_player.enableControl();
// Set up beam object
_beam.postInit();
@@ -911,7 +911,7 @@ void Scene30::postInit(SceneObjectList *OwnerList) {
_courtyardHotspot.setBounds(Rect(0, 0, 320, 200));
// Add the objects and hotspots to the scene
- _globals->_sceneItems.addItems(&_beam, &_wallsHotspot, &_door, &_treeHotspot, &_groundHotspot,
+ g_globals->_sceneItems.addItems(&_beam, &_wallsHotspot, &_door, &_treeHotspot, &_groundHotspot,
&_courtyardHotspot, NULL);
// Load the scene data
@@ -927,12 +927,12 @@ void Scene30::signal() {
_beam.setStrip(2);
_beam.setPosition(Common::Point(124, 178));
_beam.fixPriority(188);
- _globals->_sceneItems.push_front(&_beam);
- _globals->_player.enableControl();
+ g_globals->_sceneItems.push_front(&_beam);
+ g_globals->_player.enableControl();
} else if (_sceneMode == 32) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 31;
- setAction(&_sequenceManager, _globals->_sceneManager._scene, 31, &_kzin, &_door, NULL);
+ setAction(&_sequenceManager, g_globals->_sceneManager._scene, 31, &_kzin, &_door, NULL);
}
}
@@ -942,14 +942,14 @@ void Scene30::signal() {
*--------------------------------------------------------------------------*/
void Scene40::Action1::signal() {
- Scene40 *scene = (Scene40 *)_globals->_sceneManager._scene;
+ Scene40 *scene = (Scene40 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(120);
break;
case 1:
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start(40, this);
break;
case 2:
@@ -962,7 +962,7 @@ void Scene40::Action1::signal() {
case 3:
scene->_doorway.hide();
scene->_dyingKzin.setPosition(Common::Point(296, 62));
- _globals->_player.animate(ANIM_MODE_5, NULL);
+ g_globals->_player.animate(ANIM_MODE_5, NULL);
scene->_object1.setVisage(43);
scene->_object1.setStrip(3);
scene->_object1.animate(ANIM_MODE_5, NULL);
@@ -1026,8 +1026,8 @@ void Scene40::Action1::signal() {
break;
}
case 12: {
- _globals->_soundHandler.play(26);
- _globals->_player._uiEnabled = true;
+ g_globals->_soundHandler.play(26);
+ g_globals->_player._uiEnabled = true;
scene->_assassin.setVisage(42);
scene->_assassin.setPosition(Common::Point(4, 191));
scene->_assassin.setStrip(1);
@@ -1048,41 +1048,41 @@ void Scene40::Action1::signal() {
scene->_soundHandler.play(28);
break;
case 15:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_object1.setVisage(40);
scene->_object1.setStrip(4);
scene->_object1.setFrame(1);
scene->_object1.animate(ANIM_MODE_5, NULL);
- _globals->_player.setVisage(40);
- _globals->_player.setStrip(2);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(40);
+ g_globals->_player.setStrip(2);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 16:
- _globals->_soundHandler.play(77, this);
+ g_globals->_soundHandler.play(77, this);
break;
case 17:
- _globals->_game->endGame(40, 20);
+ g_globals->_game->endGame(40, 20);
remove();
break;
}
}
void Scene40::Action2::signal() {
- Scene40 *scene = (Scene40 *)_globals->_sceneManager._scene;
+ Scene40 *scene = (Scene40 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
if (scene->_assassin._position.x < 229)
_actionIndex = 0;
setDelay(1);
break;
case 1:
scene->_assassin.animate(ANIM_MODE_NONE, NULL);
- _globals->_player.setStrip(2);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setStrip(2);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 2: {
scene->_soundHandler.play(28);
@@ -1109,19 +1109,19 @@ void Scene40::Action2::signal() {
RING_INVENTORY._infoDisk._sceneNumber = 40;
break;
case 4:
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 5: {
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setStrip(1);
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setStrip(1);
Common::Point pt(230, 195);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 6: {
- _globals->_player.setStrip(7);
+ g_globals->_player.setStrip(7);
scene->_object1.setVisage(2806);
scene->_object1.animate(ANIM_MODE_1, NULL);
SceneObjectWrapper *wrapper = new SceneObjectWrapper();
@@ -1143,45 +1143,45 @@ void Scene40::Action2::signal() {
case 9:
scene->_dyingKzin.setAction(&scene->_action7);
scene->_object1.remove();
- _globals->_stripNum = 88;
- _globals->_events.setCursor(CURSOR_WALK);
- _globals->_player.enableControl();
+ g_globals->_stripNum = 88;
+ g_globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_player.enableControl();
scene->_assassin.setAction(&scene->_action8);
break;
}
}
void Scene40::Action3::signal() {
- Scene40 *scene = (Scene40 *)_globals->_sceneManager._scene;
+ Scene40 *scene = (Scene40 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
- _globals->_player.setAction(NULL);
- _globals->_stripNum = 99;
- _globals->_player.disableControl();
+ g_globals->_player.setAction(NULL);
+ g_globals->_stripNum = 99;
+ g_globals->_player.disableControl();
Common::Point pt(240, 195);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 1:
- _globals->_player.setVisage(5010);
- _globals->_player._strip = 2;
- _globals->_player._frame = 1;
- _globals->_player.animate(ANIM_MODE_4, 5, 1, this);
+ g_globals->_player.setVisage(5010);
+ g_globals->_player._strip = 2;
+ g_globals->_player._frame = 1;
+ g_globals->_player.animate(ANIM_MODE_4, 5, 1, this);
break;
case 2:
scene->_assassin.setStrip(2);
scene->_assassin.setFrame(1);
RING_INVENTORY._infoDisk._sceneNumber = 1;
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 3:
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setStrip(7);
- _globals->_stripNum = 88;
- _globals->_player.enableControl();
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setStrip(7);
+ g_globals->_stripNum = 88;
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -1192,22 +1192,22 @@ void Scene40::Action4::signal() {
case 0: {
Common::Point pt(178, 190);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 1:
- _globals->_stripNum = 88;
- _globals->_player.enableControl();
+ g_globals->_stripNum = 88;
+ g_globals->_player.enableControl();
break;
}
}
void Scene40::Action5::signal() {
- Scene40 *scene = (Scene40 *)_globals->_sceneManager._scene;
+ Scene40 *scene = (Scene40 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- setDelay(_globals->_randomSource.getRandomNumber(119) + 120);
+ setDelay(g_globals->_randomSource.getRandomNumber(119) + 120);
break;
case 1:
scene->_object2.animate(ANIM_MODE_8, 1, this);
@@ -1216,7 +1216,7 @@ void Scene40::Action5::signal() {
}
void Scene40::Action6::signal() {
- Scene40 *scene = (Scene40 *)_globals->_sceneManager._scene;
+ Scene40 *scene = (Scene40 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
@@ -1253,17 +1253,17 @@ void Scene40::Action6::signal() {
}
void Scene40::Action7::signal() {
- Scene40 *scene = (Scene40 *)_globals->_sceneManager._scene;
+ Scene40 *scene = (Scene40 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- setDelay(_globals->_randomSource.getRandomNumber(499) + 500);
+ setDelay(g_globals->_randomSource.getRandomNumber(499) + 500);
break;
case 1:
scene->_object7.postInit();
scene->_object7.setVisage(46);
- if (_globals->_randomSource.getRandomNumber(32767) >= 16384) {
+ if (g_globals->_randomSource.getRandomNumber(32767) >= 16384) {
scene->_object7.setStrip(3);
scene->_object7.setPosition(Common::Point(15, 185));
} else {
@@ -1282,16 +1282,16 @@ void Scene40::Action7::signal() {
}
void Scene40::Action8::signal() {
- Scene40 *scene = (Scene40 *)_globals->_sceneManager._scene;
+ Scene40 *scene = (Scene40 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(300);
break;
case 1:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
- if ((_globals->_player._position.y >= 197) || (_globals->_player._visage)) {
+ if ((g_globals->_player._position.y >= 197) || (g_globals->_player._visage)) {
_actionIndex = 1;
setDelay(30);
} else {
@@ -1301,7 +1301,7 @@ void Scene40::Action8::signal() {
scene->_doorway.fixPriority(200);
scene->_doorway._moveRate = 60;
- if (_globals->_player._position.x >= 145) {
+ if (g_globals->_player._position.x >= 145) {
scene->_doorway.fixPriority(-1);
scene->_doorway.setPosition(Common::Point(6, 157));
} else {
@@ -1309,7 +1309,7 @@ void Scene40::Action8::signal() {
}
scene->_doorway._moveDiff = Common::Point(40, 40);
- Common::Point pt(_globals->_player._position.x, _globals->_player._position.y - 18);
+ Common::Point pt(g_globals->_player._position.x, g_globals->_player._position.y - 18);
NpcMover *mover = new NpcMover();
scene->_doorway.addMover(mover, &pt, this);
scene->_doorway.animate(ANIM_MODE_5, NULL);
@@ -1317,16 +1317,16 @@ void Scene40::Action8::signal() {
break;
case 2:
scene->_doorway.remove();
- _globals->_player.setVisage(40);
- _globals->_player.setStrip(2);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(40);
+ g_globals->_player.setStrip(2);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 3:
- _globals->_soundHandler.play(77, this);
+ g_globals->_soundHandler.play(77, this);
break;
case 4:
- _globals->_game->endGame(40, 45);
+ g_globals->_game->endGame(40, 45);
remove();
break;
}
@@ -1337,7 +1337,7 @@ void Scene40::Action8::dispatch() {
_action->dispatch();
if (_delayFrames) {
- uint32 frameNumber = _globals->_events.getFrameNumber();
+ uint32 frameNumber = g_globals->_events.getFrameNumber();
if ((_startFrame + 60) < frameNumber) {
--_delayFrames;
_startFrame = frameNumber;
@@ -1373,14 +1373,14 @@ void Scene40::DyingKzin::doAction(int action) {
}
void Scene40::Assassin::doAction(int action) {
- Scene40 *scene = (Scene40 *)_globals->_sceneManager._scene;
+ Scene40 *scene = (Scene40 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_STUNNER:
if (scene->_assassin._visage == 44)
SceneItem::display2(40, 21);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
Common::Point pt(230, 187);
NpcMover *mover = new NpcMover();
addMover(mover, &pt, NULL);
@@ -1402,7 +1402,7 @@ void Scene40::Assassin::doAction(int action) {
else if (RING_INVENTORY._infoDisk._sceneNumber == 1)
SceneItem::display2(40, 19);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setAction(&scene->_action3);
}
break;
@@ -1421,7 +1421,7 @@ void Scene40::Item2::doAction(int action) {
switch (action) {
case OBJECT_STUNNER:
SceneItem::display2(40, 35);
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
break;
case OBJECT_SCANNER:
SceneItem::display2(40, 34);
@@ -1445,7 +1445,7 @@ void Scene40::Item6::doAction(int action) {
switch (action) {
case OBJECT_STUNNER:
SceneItem::display2(40, 25);
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
break;
case OBJECT_SCANNER:
SceneItem::display2(40, 42);
@@ -1478,7 +1478,7 @@ void Scene40::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(0, 100, 200, 100);
- _globals->_stripNum = 99;
+ g_globals->_stripNum = 99;
_stripManager.addSpeaker(&_speakerQR);
_stripManager.addSpeaker(&_speakerSL);
@@ -1488,19 +1488,19 @@ void Scene40::postInit(SceneObjectList *OwnerList) {
_speakerGameText._color1 = 9;
_speakerGameText.setTextPos(Common::Point(160, 30));
- _speakerQText._npc = &_globals->_player;
+ _speakerQText._npc = &g_globals->_player;
_speakerSText._npc = &_object1;
- _globals->_player.postInit();
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setPosition(Common::Point(130, 220));
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setPosition(Common::Point(130, 220));
+ g_globals->_player.disableControl();
- if (_globals->_sceneManager._previousScene == 20) {
- _globals->_soundHandler.play(24);
- _globals->_player.setVisage(43);
+ if (g_globals->_sceneManager._previousScene == 20) {
+ g_globals->_soundHandler.play(24);
+ g_globals->_player.setVisage(43);
_object1.postInit();
_object1.setVisage(41);
@@ -1522,7 +1522,7 @@ void Scene40::postInit(SceneObjectList *OwnerList) {
_assassin.postInit();
_assassin.setPosition(Common::Point(-40, 191));
- _globals->_sceneItems.push_back(&_assassin);
+ g_globals->_sceneItems.push_back(&_assassin);
_dyingKzin.postInit();
_dyingKzin.setVisage(40);
@@ -1557,8 +1557,8 @@ void Scene40::postInit(SceneObjectList *OwnerList) {
_assassin.setStrip(2);
}
- _globals->_sceneItems.push_back(&_assassin);
- _globals->_player.setPosition(Common::Point(170, 220));
+ g_globals->_sceneItems.push_back(&_assassin);
+ g_globals->_player.setPosition(Common::Point(170, 220));
setAction(&_action4);
}
@@ -1567,24 +1567,24 @@ void Scene40::postInit(SceneObjectList *OwnerList) {
_item6._sceneRegionId = 3;
_item2._sceneRegionId = 7;
- _globals->_sceneItems.addItems(&_dyingKzin, &_item8, &_item1, &_item2, &_item3, &_item4,
+ g_globals->_sceneItems.addItems(&_dyingKzin, &_item8, &_item1, &_item2, &_item3, &_item4,
&_item6, &_item7, &_item5, NULL);
}
void Scene40::signal() {
if (_sceneMode == 41)
- _globals->_sceneManager.changeScene(50);
+ g_globals->_sceneManager.changeScene(50);
}
void Scene40::dispatch() {
- if ((_globals->_stripNum == 88) && (_globals->_player._position.y >= 197)) {
- _globals->_player.disableControl();
- _globals->_stripNum = 0;
- _globals->_player.setAction(NULL);
+ if ((g_globals->_stripNum == 88) && (g_globals->_player._position.y >= 197)) {
+ g_globals->_player.disableControl();
+ g_globals->_stripNum = 0;
+ g_globals->_player.setAction(NULL);
_sceneMode = 41;
- setAction(&_sequenceManager, this, 41, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 41, &g_globals->_player, NULL);
- if (_globals->_sceneManager._previousScene == 20) {
+ if (g_globals->_sceneManager._previousScene == 20) {
_dyingKzin.setAction(&_action6);
}
}
@@ -1598,49 +1598,49 @@ void Scene40::dispatch() {
*--------------------------------------------------------------------------*/
void Scene50::Action1::signal() {
- Scene50 *scene = (Scene50 *)_globals->_sceneManager._scene;
+ Scene50 *scene = (Scene50 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- setAction(&scene->_sequenceManager, this, 54, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager, this, 54, &g_globals->_player, NULL);
break;
case 1:
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start(63, this);
break;
case 2:
if (scene->_stripManager._field2E8 != 107) {
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
} else {
Common::Point pt(282, 139);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
}
break;
case 3:
- _globals->_stripNum = -1;
- _globals->_sceneManager.changeScene(60);
+ g_globals->_stripNum = -1;
+ g_globals->_sceneManager.changeScene(60);
break;
}
}
void Scene50::Action2::signal() {
- Scene50 *scene = (Scene50 *)_globals->_sceneManager._scene;
+ Scene50 *scene = (Scene50 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_stripManager.start(66, this);
break;
case 1: {
Common::Point pt(141, 142);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2:
- _globals->_sceneManager.changeScene(40);
+ g_globals->_sceneManager.changeScene(40);
remove();
break;
}
@@ -1649,14 +1649,14 @@ void Scene50::Action2::signal() {
void Scene50::Action3::signal() {
switch (_actionIndex++) {
case 0: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
Common::Point pt(136, 185);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 1:
- _globals->_sceneManager.changeScene(60);
+ g_globals->_sceneManager.changeScene(60);
remove();
break;
}
@@ -1665,7 +1665,7 @@ void Scene50::Action3::signal() {
/*--------------------------------------------------------------------------*/
void Scene50::Object1::doAction(int action) {
- Scene50 *scene = (Scene50 *)_globals->_sceneManager._scene;
+ Scene50 *scene = (Scene50 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_STUNNER:
@@ -1681,7 +1681,7 @@ void Scene50::Object1::doAction(int action) {
SceneItem::display2(50, 21);
break;
case CURSOR_TALK:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 52;
scene->setAction(&scene->_sequenceManager, scene, 52, NULL);
break;
@@ -1692,7 +1692,7 @@ void Scene50::Object1::doAction(int action) {
}
void Scene50::Object2::doAction(int action) {
- Scene50 *scene = (Scene50 *)_globals->_sceneManager._scene;
+ Scene50 *scene = (Scene50 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_STUNNER:
@@ -1706,7 +1706,7 @@ void Scene50::Object2::doAction(int action) {
break;
case OBJECT_INFODISK:
case CURSOR_USE:
- _globals->_stripNum = 50;
+ g_globals->_stripNum = 50;
scene->setAction(&scene->_action3);
break;
default:
@@ -1716,7 +1716,7 @@ void Scene50::Object2::doAction(int action) {
}
void Scene50::Object3::doAction(int action) {
- Scene50 *scene = (Scene50 *)_globals->_sceneManager._scene;
+ Scene50 *scene = (Scene50 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_STUNNER:
@@ -1733,7 +1733,7 @@ void Scene50::Object3::doAction(int action) {
SceneItem::display2(50, 8);
break;
case CURSOR_TALK:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 52;
scene->setAction(&scene->_sequenceManager, scene, 52, NULL);
break;
@@ -1744,7 +1744,7 @@ void Scene50::Object3::doAction(int action) {
}
void Scene50::Object4::doAction(int action) {
- Scene50 *scene = (Scene50 *)_globals->_sceneManager._scene;
+ Scene50 *scene = (Scene50 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_STUNNER:
@@ -1758,10 +1758,10 @@ void Scene50::Object4::doAction(int action) {
break;
case OBJECT_INFODISK:
case CURSOR_USE:
- _globals->_player.disableControl();
- _globals->_stripNum = 0;
+ g_globals->_player.disableControl();
+ g_globals->_stripNum = 0;
scene->_sceneMode = 51;
- scene->setAction(&scene->_sequenceManager, scene, 51, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 51, &g_globals->_player, NULL);
break;
default:
SceneHotspot::doAction(action);
@@ -1790,20 +1790,20 @@ void Scene50::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerQText);
_stripManager.addSpeaker(&_speakerSText);
- _globals->_player.postInit();
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player._canWalk = false;
- _globals->_player.changeZoom(75);
- _globals->_player._moveDiff.y = 3;
-
- if (_globals->_sceneManager._previousScene == 40) {
- _globals->_player.setPosition(Common::Point(128, 123));
- } else if (_globals->_stripNum == 50) {
- _globals->_player.setPosition(Common::Point(136, 185));
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player._canWalk = false;
+ g_globals->_player.changeZoom(75);
+ g_globals->_player._moveDiff.y = 3;
+
+ if (g_globals->_sceneManager._previousScene == 40) {
+ g_globals->_player.setPosition(Common::Point(128, 123));
+ } else if (g_globals->_stripNum == 50) {
+ g_globals->_player.setPosition(Common::Point(136, 185));
} else {
- _globals->_player.setPosition(Common::Point(270, 143));
+ g_globals->_player.setPosition(Common::Point(270, 143));
}
_object2.postInit();
@@ -1824,37 +1824,37 @@ void Scene50::postInit(SceneObjectList *OwnerList) {
_object4.setPosition(Common::Point(295, 144));
_object4.fixPriority(178);
- _globals->_sceneItems.addItems(&_object2, &_object3, &_object4, NULL);
+ g_globals->_sceneItems.addItems(&_object2, &_object3, &_object4, NULL);
- if (!_globals->getFlag(101)) {
- _globals->_player.disableControl();
- _globals->setFlag(101);
+ if (!g_globals->getFlag(101)) {
+ g_globals->_player.disableControl();
+ g_globals->setFlag(101);
setAction(&_action1);
} else {
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
- if (_globals->_sceneManager._previousScene == 40) {
- _globals->_player.disableControl();
+ if (g_globals->_sceneManager._previousScene == 40) {
+ g_globals->_player.disableControl();
_sceneMode = 54;
- setAction(&_sequenceManager, this, 54, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 54, &g_globals->_player, NULL);
}
}
_item0.setBounds(Rect(200, 0, 320, 200));
- _globals->_sceneItems.addItems(&_item3, &_item4, &_item5, &_item0, NULL);
+ g_globals->_sceneItems.addItems(&_item3, &_item4, &_item5, &_item0, NULL);
}
void Scene50::signal() {
switch (_sceneMode) {
case 51:
- _globals->_sceneManager.changeScene(60);
+ g_globals->_sceneManager.changeScene(60);
break;
case 55:
- _globals->_sceneManager.changeScene(40);
+ g_globals->_sceneManager.changeScene(40);
break;
case 52:
case 54:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
}
}
@@ -1862,13 +1862,13 @@ void Scene50::signal() {
void Scene50::dispatch() {
Scene::dispatch();
- if ((_sceneMode != 55) && _doorwayRect.contains(_globals->_player._position)) {
+ if ((_sceneMode != 55) && _doorwayRect.contains(g_globals->_player._position)) {
// Player in house doorway, start player moving to within
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 55;
Common::Point pt(89, 111);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
}
}
@@ -1878,7 +1878,7 @@ void Scene50::dispatch() {
*--------------------------------------------------------------------------*/
void Scene60::Action1::signal() {
- Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
+ Scene60 *scene = (Scene60 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -1902,7 +1902,7 @@ void Scene60::Action1::signal() {
scene->_controlButton.animate(ANIM_MODE_2, NULL);
- if (!_globals->getFlag(83)) {
+ if (!g_globals->getFlag(83)) {
scene->_message.postInit();
scene->_message.setVisage(60);
scene->_message.setStrip2(3);
@@ -1911,18 +1911,18 @@ void Scene60::Action1::signal() {
scene->_message.animate(ANIM_MODE_2, NULL);
scene->_message._numFrames = 5;
- _globals->_sceneItems.push_front(&scene->_message);
+ g_globals->_sceneItems.push_front(&scene->_message);
scene->_soundHandler2.play(38);
}
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
break;
case 3:
scene->_soundHandler2.play(37);
scene->loadScene(65);
scene->_message.remove();
- if (_globals->_sceneObjects->contains(&scene->_redLights))
+ if (g_globals->_sceneObjects->contains(&scene->_redLights))
scene->_redLights.remove();
scene->_controlButton.remove();
@@ -1951,15 +1951,15 @@ void Scene60::Action1::signal() {
scene->_rose.setFrame(1);
scene->_rose.setPosition(Common::Point(145, 165));
- _globals->_sceneItems.push_front(&scene->_nextButton);
- _globals->_sceneItems.push_front(&scene->_prevButton);
- _globals->_sceneItems.push_front(&scene->_exitButton);
+ g_globals->_sceneItems.push_front(&scene->_nextButton);
+ g_globals->_sceneItems.push_front(&scene->_prevButton);
+ g_globals->_sceneItems.push_front(&scene->_exitButton);
setDelay(10);
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
break;
case 4:
- _globals->setFlag(90);
+ g_globals->setFlag(90);
// Deliberate fall-through
case 5:
case 6:
@@ -1967,13 +1967,13 @@ void Scene60::Action1::signal() {
SceneItem::display(60, _actionIndex - 4, SET_Y, 40, SET_X, 25, SET_FONT, 75,
SET_EXT_BGCOLOR, -1, SET_FG_COLOR, 34, SET_POS_MODE, 0,
SET_WIDTH, 280, SET_KEEP_ONSCREEN, 1, LIST_END);
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
break;
case 9:
- _globals->_player._uiEnabled = false;
+ g_globals->_player._uiEnabled = false;
RING_INVENTORY._infoDisk._sceneNumber = 1;
- if (_globals->_sceneObjects->contains(&scene->_message))
+ if (g_globals->_sceneObjects->contains(&scene->_message))
scene->_message.remove();
scene->_controlButton.animate(ANIM_MODE_NONE);
@@ -1993,14 +1993,14 @@ void Scene60::Action1::signal() {
scene->_masterButton.setFrame(1);
scene->_masterButton._state = 0;
- _globals->clearFlag(103);
- _globals->clearFlag(!_globals->_stripNum ? 116 : 119);
+ g_globals->clearFlag(103);
+ g_globals->clearFlag(!g_globals->_stripNum ? 116 : 119);
break;
case 10:
setDelay(60);
break;
case 11:
- _globals->_player._uiEnabled = true;
+ g_globals->_player._uiEnabled = true;
scene->_floppyDrive.remove();
remove();
break;
@@ -2011,7 +2011,7 @@ void Scene60::Action1::signal() {
}
void Scene60::Action2::signal() {
- Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
+ Scene60 *scene = (Scene60 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -2022,7 +2022,7 @@ void Scene60::Action2::signal() {
scene->_stripManager.start(66, this);
break;
case 3:
- _globals->_sceneManager.changeScene(50);
+ g_globals->_sceneManager.changeScene(50);
break;
}
}
@@ -2030,7 +2030,7 @@ void Scene60::Action2::signal() {
/*--------------------------------------------------------------------------*/
void Scene60::PrevObject::doAction(int action) {
- Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
+ Scene60 *scene = (Scene60 *)g_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
SceneItem::display2(60, 16);
@@ -2048,7 +2048,7 @@ void Scene60::PrevObject::doAction(int action) {
}
void Scene60::NextObject::doAction(int action) {
- Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
+ Scene60 *scene = (Scene60 *)g_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
SceneItem::display2(60, 17);
@@ -2065,7 +2065,7 @@ void Scene60::NextObject::doAction(int action) {
}
void Scene60::ExitObject::doAction(int action) {
- Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
+ Scene60 *scene = (Scene60 *)g_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
SceneItem::display2(60, 18);
@@ -2096,8 +2096,8 @@ void Scene60::ExitObject::doAction(int action) {
scene->_masterButton.setStrip(8);
scene->_masterButton.setPosition(Common::Point(143, 105));
- _globals->_sceneItems.push_front(&scene->_masterButton);
- _globals->_sceneItems.push_front(&scene->_slaveButton);
+ g_globals->_sceneItems.push_front(&scene->_masterButton);
+ g_globals->_sceneItems.push_front(&scene->_slaveButton);
scene->_redLights.postInit();
scene->_redLights.setVisage(60);
@@ -2111,14 +2111,14 @@ void Scene60::ExitObject::doAction(int action) {
if (scene->_masterButton._state)
scene->_masterButton.setFrame(2);
- _globals->_sceneItems.push_front(&scene->_item1);
- _globals->_sceneItems.push_front(&scene->_controlButton);
- _globals->_sceneItems.push_front(&scene->_slaveButton);
- _globals->_sceneItems.push_front(&scene->_masterButton);
- _globals->_sceneItems.push_back(&scene->_item2);
+ g_globals->_sceneItems.push_front(&scene->_item1);
+ g_globals->_sceneItems.push_front(&scene->_controlButton);
+ g_globals->_sceneItems.push_front(&scene->_slaveButton);
+ g_globals->_sceneItems.push_front(&scene->_masterButton);
+ g_globals->_sceneItems.push_back(&scene->_item2);
- _globals->gfxManager()._font.setFontNumber(2);
- _globals->_sceneText._fontNumber = 2;
+ g_globals->gfxManager()._font.setFontNumber(2);
+ g_globals->_sceneText._fontNumber = 2;
scene->_action1.setActionIndex(2);
scene->_action1.setDelay(1);
@@ -2130,20 +2130,20 @@ void Scene60::ExitObject::doAction(int action) {
}
void Scene60::MessageObject::doAction(int action) {
- Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
+ Scene60 *scene = (Scene60 *)g_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
SceneItem::display2(60, 9);
} else if (action == CURSOR_USE) {
scene->_action1.setDelay(1);
- _globals->setFlag(83);
+ g_globals->setFlag(83);
} else {
SceneHotspot::doAction(action);
}
}
void Scene60::ControlObject::doAction(int action) {
- Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
+ Scene60 *scene = (Scene60 *)g_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
SceneItem::display2(60, 11);
@@ -2151,9 +2151,9 @@ void Scene60::ControlObject::doAction(int action) {
if (_animateMode == ANIM_MODE_NONE)
SceneItem::display2(60, 14);
else if (!scene->_slaveButton._state) {
- _globals->_soundHandler.play(40);
- _globals->_soundHandler.holdAt(true);
- _globals->_sceneManager.changeScene(20);
+ g_globals->_soundHandler.play(40);
+ g_globals->_soundHandler.holdAt(true);
+ g_globals->_sceneManager.changeScene(20);
} else {
scene->_sceneMode = 15;
setAction(&scene->_sequenceManager, scene, 62, NULL);
@@ -2164,7 +2164,7 @@ void Scene60::ControlObject::doAction(int action) {
}
void Scene60::SlaveObject::doAction(int action) {
- Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
+ Scene60 *scene = (Scene60 *)g_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
SceneItem::display2(60, 8);
@@ -2174,14 +2174,14 @@ void Scene60::SlaveObject::doAction(int action) {
else if (_state) {
scene->_soundHandler3.stop();
animate(ANIM_MODE_6, NULL);
- _globals->clearFlag(102);
- _globals->clearFlag(!_globals->_stripNum ? 117 : 120);
+ g_globals->clearFlag(102);
+ g_globals->clearFlag(!g_globals->_stripNum ? 117 : 120);
_state = 0;
scene->_sceneMode = 9998;
} else {
scene->_soundHandler3.play(39);
- _globals->setFlag(102);
- _globals->setFlag(!_globals->_stripNum ? 117 : 120);
+ g_globals->setFlag(102);
+ g_globals->setFlag(!g_globals->_stripNum ? 117 : 120);
animate(ANIM_MODE_5, NULL);
_state = 1;
scene->_sceneMode = 9998;
@@ -2194,7 +2194,7 @@ void Scene60::SlaveObject::doAction(int action) {
}
void Scene60::MasterObject::doAction(int action) {
- Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
+ Scene60 *scene = (Scene60 *)g_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
SceneItem::display2(60, 7);
@@ -2207,15 +2207,15 @@ void Scene60::MasterObject::doAction(int action) {
scene->_soundHandler3.stop();
animate(ANIM_MODE_6, NULL);
_state = 0;
- _globals->clearFlag(103);
- _globals->clearFlag(!_globals->_stripNum ? 116 : 119);
+ g_globals->clearFlag(103);
+ g_globals->clearFlag(!g_globals->_stripNum ? 116 : 119);
scene->_sceneMode = 9998;
} else {
scene->_soundHandler3.play(39);
animate(ANIM_MODE_5, NULL);
_state = 1;
- _globals->setFlag(103);
- _globals->setFlag(!_globals->_stripNum ? 116 : 119);
+ g_globals->setFlag(103);
+ g_globals->setFlag(!g_globals->_stripNum ? 116 : 119);
scene->_sceneMode = 9998;
}
@@ -2226,12 +2226,12 @@ void Scene60::MasterObject::doAction(int action) {
}
void Scene60::FloppyDrive::doAction(int action) {
- Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
+ Scene60 *scene = (Scene60 *)g_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
SceneItem::display2(60, 13);
} else if (action == CURSOR_USE) {
- _globals->setFlag(!_globals->_stripNum ? 118 : 121);
+ g_globals->setFlag(!g_globals->_stripNum ? 118 : 121);
scene->setAction(&scene->_action1);
} else {
SceneHotspot::doAction(action);
@@ -2241,12 +2241,12 @@ void Scene60::FloppyDrive::doAction(int action) {
/*--------------------------------------------------------------------------*/
void Scene60::Item1::doAction(int action) {
- Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
+ Scene60 *scene = (Scene60 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_INFODISK:
RING_INVENTORY._infoDisk._sceneNumber = 60;
- _globals->setFlag(!_globals->_stripNum ? 118 : 121);
+ g_globals->setFlag(!g_globals->_stripNum ? 118 : 121);
scene->_sceneMode = 0;
scene->setAction(&scene->_action1);
break;
@@ -2255,14 +2255,14 @@ void Scene60::Item1::doAction(int action) {
break;
case CURSOR_USE:
if (RING_INVENTORY._infoDisk._sceneNumber == 60) {
- if (_globals->getFlag(118) && !_globals->_stripNum) {
- _globals->clearFlag(118);
+ if (g_globals->getFlag(118) && !g_globals->_stripNum) {
+ g_globals->clearFlag(118);
scene->setAction(&scene->_action1);
scene->_action1.setActionIndex(9);
scene->_action1.setDelay(1);
}
- if (_globals->getFlag(121) && !_globals->_stripNum) {
- _globals->clearFlag(121);
+ if (g_globals->getFlag(121) && !g_globals->_stripNum) {
+ g_globals->clearFlag(121);
scene->setAction(&scene->_action1);
scene->_action1.setActionIndex(9);
scene->_action1.setDelay(1);
@@ -2280,7 +2280,7 @@ void Scene60::Item1::doAction(int action) {
}
void Scene60::Item::doAction(int action) {
- Scene60 *scene = (Scene60 *)_globals->_sceneManager._scene;
+ Scene60 *scene = (Scene60 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -2312,8 +2312,8 @@ void Scene60::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerQText);
_stripManager.addSpeaker(&_speakerSText);
- _globals->_player._uiEnabled = true;
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_player._uiEnabled = true;
+ g_globals->_events.setCursor(CURSOR_USE);
_slaveButton.postInit();
_slaveButton.setVisage(60);
@@ -2327,19 +2327,19 @@ void Scene60::postInit(SceneObjectList *OwnerList) {
_masterButton.setPosition(Common::Point(143, 105));
_masterButton._state = 0;
- _globals->_sceneItems.push_back(&_masterButton);
- _globals->_sceneItems.push_back(&_slaveButton);
+ g_globals->_sceneItems.push_back(&_masterButton);
+ g_globals->_sceneItems.push_back(&_slaveButton);
_controlButton.postInit();
_controlButton.setVisage(60);
_controlButton.setStrip(5);
_controlButton.setPosition(Common::Point(233, 143));
- _globals->_sceneItems.push_back(&_controlButton);
+ g_globals->_sceneItems.push_back(&_controlButton);
- if (_globals->_stripNum == -1) {
- _globals->_stripNum = 0;
+ if (g_globals->_stripNum == -1) {
+ g_globals->_stripNum = 0;
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9999;
setAction(&_sequenceManager, this, 61, NULL);
}
@@ -2347,18 +2347,18 @@ void Scene60::postInit(SceneObjectList *OwnerList) {
_item1.setBounds(Rect(130, 55, 174, 70));
_item2.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- if (_globals->_stripNum == 0) {
- if (_globals->getFlag(117)) {
+ if (g_globals->_stripNum == 0) {
+ if (g_globals->getFlag(117)) {
_slaveButton._state = 1;
_slaveButton.setFrame(2);
}
- if (_globals->getFlag(116)) {
+ if (g_globals->getFlag(116)) {
_masterButton._state = 1;
_masterButton.setFrame(2);
}
- if (_globals->getFlag(118)) {
+ if (g_globals->getFlag(118)) {
_controlButton.animate(ANIM_MODE_2, NULL);
_redLights.postInit();
@@ -2368,7 +2368,7 @@ void Scene60::postInit(SceneObjectList *OwnerList) {
_soundHandler1.play(35);
- if (!_globals->getFlag(83)) {
+ if (!g_globals->getFlag(83)) {
_message.postInit();
_message.setVisage(60);
_message.setStrip2(3);
@@ -2376,23 +2376,23 @@ void Scene60::postInit(SceneObjectList *OwnerList) {
_message.setPosition(Common::Point(148, 85));
_message.animate(ANIM_MODE_2, NULL);
_message._numFrames = 5;
- _globals->_sceneItems.push_front(&_message);
+ g_globals->_sceneItems.push_front(&_message);
_soundHandler2.play(38);
}
}
} else {
- if (_globals->getFlag(120)) {
+ if (g_globals->getFlag(120)) {
_slaveButton._state = 1;
_slaveButton.setFrame(2);
}
- if (_globals->getFlag(119)) {
+ if (g_globals->getFlag(119)) {
_masterButton._state = 1;
_masterButton.setFrame(2);
}
- if (_globals->getFlag(121)) {
+ if (g_globals->getFlag(121)) {
_controlButton.animate(ANIM_MODE_2, NULL);
_redLights.postInit();
@@ -2403,7 +2403,7 @@ void Scene60::postInit(SceneObjectList *OwnerList) {
_soundHandler1.play(35);
- if (!_globals->getFlag(83)) {
+ if (!g_globals->getFlag(83)) {
_message.postInit();
_message.setVisage(60);
_message.setStrip2(3);
@@ -2411,24 +2411,24 @@ void Scene60::postInit(SceneObjectList *OwnerList) {
_message.setPosition(Common::Point(148, 85));
_message.animate(ANIM_MODE_2, NULL);
_message._numFrames = 5;
- _globals->_sceneItems.push_front(&_message);
+ g_globals->_sceneItems.push_front(&_message);
_soundHandler2.play(38);
}
}
}
- _globals->_sceneItems.addItems(&_item3, &_item4, &_item5, &_item6,
+ g_globals->_sceneItems.addItems(&_item3, &_item4, &_item5, &_item6,
&_item1, &_item2, NULL);
}
void Scene60::signal() {
if (_sceneMode != 0) {
if (_sceneMode == 9998) {
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
} else if (_sceneMode == 9999) {
- _globals->_player._uiEnabled = true;
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_player._uiEnabled = true;
+ g_globals->_events.setCursor(CURSOR_USE);
_gfxButton.setText(EXIT_MSG);
_gfxButton._bounds.center(160, 193);
@@ -2436,7 +2436,7 @@ void Scene60::signal() {
_gfxButton._bounds.expandPanes();
} else {
SceneItem::display2(60, _sceneMode);
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
}
}
}
@@ -2446,7 +2446,7 @@ void Scene60::process(Event &event) {
if (_screenNumber == 60) {
if (_gfxButton.process(event))
- _globals->_sceneManager.changeScene(50);
+ g_globals->_sceneManager.changeScene(50);
}
}
@@ -2456,15 +2456,15 @@ void Scene60::process(Event &event) {
*--------------------------------------------------------------------------*/
void Scene90::Action1::signal() {
- Scene90 *scene = (Scene90 *)_globals->_sceneManager._scene;
+ Scene90 *scene = (Scene90 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(10);
break;
case 1:
- _globals->_scenePalette.addRotation(64, 72, -1);
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_scenePalette.addRotation(64, 72, -1);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start(90, this);
break;
case 2:
@@ -2486,17 +2486,17 @@ void Scene90::Action1::signal() {
if (scene->_stripManager._field2E8 == 220)
scene->_stripManager.start(91, this, scene);
else {
- scene->_stripManager.start(_globals->getFlag(104) ? 93 : 92, this, scene);
+ scene->_stripManager.start(g_globals->getFlag(104) ? 93 : 92, this, scene);
_actionIndex = 7;
}
break;
case 6:
scene->_object2.animate(ANIM_MODE_NONE);
- _globals->_player._uiEnabled = true;
+ g_globals->_player._uiEnabled = true;
break;
case 7:
scene->_object2.animate(ANIM_MODE_NONE);
- _globals->_soundHandler.play(56);
+ g_globals->_soundHandler.play(56);
scene->_object3.animate(ANIM_MODE_5, this);
break;
case 8: {
@@ -2518,7 +2518,7 @@ void Scene90::Action1::signal() {
PlayerMover2 *mover = new PlayerMover2();
scene->_object1.addMover(mover, 10, 15, &scene->_object5);
- if (!_globals->getFlag(104)) {
+ if (!g_globals->getFlag(104)) {
mover = new PlayerMover2();
scene->_object4.addMover(mover, 10, 15, &scene->_object1);
}
@@ -2526,17 +2526,17 @@ void Scene90::Action1::signal() {
break;
}
case 11:
- _globals->_soundHandler.play(57);
- _globals->_soundHandler.play(68);
+ g_globals->_soundHandler.play(57);
+ g_globals->_soundHandler.play(68);
scene->_object3.animate(ANIM_MODE_6, NULL);
- SceneItem::display(90, _globals->getFlag(104) ? 15 : 14,
+ SceneItem::display(90, g_globals->getFlag(104) ? 15 : 14,
SET_EXT_BGCOLOR, 13, SET_KEEP_ONSCREEN, -1, SET_X, 120, SET_Y, 20, LIST_END);
break;
case 12:
SceneItem::display(0, 0);
- _globals->_scenePalette.clearListeners();
- _globals->_sceneManager.changeScene(95);
+ g_globals->_scenePalette.clearListeners();
+ g_globals->_sceneManager.changeScene(95);
break;
}
}
@@ -2544,14 +2544,14 @@ void Scene90::Action1::signal() {
/*--------------------------------------------------------------------------*/
void Scene90::Object1::doAction(int action) {
- Scene90 *scene = (Scene90 *)_globals->_sceneManager._scene;
+ Scene90 *scene = (Scene90 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(90, 7);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 97;
setAction(&scene->_sequenceManager, scene, 97, this, NULL);
break;
@@ -2562,12 +2562,12 @@ void Scene90::Object1::doAction(int action) {
}
void Scene90::Object2::doAction(int action) {
- Scene90 *scene = (Scene90 *)_globals->_sceneManager._scene;
+ Scene90 *scene = (Scene90 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_STUNNER:
case CURSOR_USE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_object6.postInit();
scene->_object6.setVisage(90);
scene->_object6.setStrip(6);
@@ -2583,7 +2583,7 @@ void Scene90::Object2::doAction(int action) {
SceneItem::display2(90, 8);
break;
case CURSOR_TALK:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setAction(&scene->_sequenceManager, scene, 96, this, NULL);
break;
default:
@@ -2604,7 +2604,7 @@ Scene90::Scene90() :
}
void Scene90::stripCallback(int v) {
- Scene90 *scene = (Scene90 *)_globals->_sceneManager._scene;
+ Scene90 *scene = (Scene90 *)g_globals->_sceneManager._scene;
if (v == 1)
scene->_object2.animate(ANIM_MODE_7, NULL);
@@ -2635,7 +2635,7 @@ void Scene90::postInit(SceneObjectList *OwnerList) {
_object5._moveDiff = Common::Point(22, 22);
_object5.setPosition(Common::Point(151, 177));
_object5.changeZoom(-1);
- _globals->_sceneItems.push_back(&_object5);
+ g_globals->_sceneItems.push_back(&_object5);
_object1.postInit();
_object1.setVisage(2337);
@@ -2644,9 +2644,9 @@ void Scene90::postInit(SceneObjectList *OwnerList) {
_object1._moveDiff = Common::Point(20, 20);
_object1.setPosition(Common::Point(212, 183));
_object1.changeZoom(-1);
- _globals->_sceneItems.push_back(&_object1);
+ g_globals->_sceneItems.push_back(&_object1);
- if (!_globals->getFlag(104)) {
+ if (!g_globals->getFlag(104)) {
_object4.postInit();
_object4.setVisage(2331);
_object4.setObjectWrapper(new SceneObjectWrapper());
@@ -2654,7 +2654,7 @@ void Scene90::postInit(SceneObjectList *OwnerList) {
_object4._moveDiff = Common::Point(20, 20);
_object4.setPosition(Common::Point(251, 207));
_object4.changeZoom(-1);
- _globals->_sceneItems.push_back(&_object4);
+ g_globals->_sceneItems.push_back(&_object4);
}
_object2.postInit();
@@ -2662,17 +2662,17 @@ void Scene90::postInit(SceneObjectList *OwnerList) {
_object2.animate(ANIM_MODE_1, NULL);
_object2.setPosition(Common::Point(315, 185));
_object2._strip = 2;
- _globals->_sceneItems.push_back(&_object2);
+ g_globals->_sceneItems.push_back(&_object2);
_object3.postInit();
_object3.setVisage(90);
_object3.animate(ANIM_MODE_1, NULL);
_object3.setPosition(Common::Point(196, 181));
_object3.fixPriority(175);
- _globals->_sceneItems.push_back(&_object3);
+ g_globals->_sceneItems.push_back(&_object3);
- _globals->_player.disableControl();
- _globals->_soundHandler.play(55);
+ g_globals->_player.disableControl();
+ g_globals->_soundHandler.play(55);
_soundHandler1.play(52);
_soundHandler1.holdAt(true);
@@ -2682,21 +2682,21 @@ void Scene90::postInit(SceneObjectList *OwnerList) {
_item1.setBounds(Rect(271, 65, 271, 186));
_item2.setBounds(Rect(0, 17, 124, 77));
- _globals->_sceneItems.addItems(&_item1, &_item2, &_item3, NULL);
+ g_globals->_sceneItems.addItems(&_item1, &_item2, &_item3, NULL);
}
void Scene90::signal() {
switch (_sceneMode) {
case 91:
_sceneMode = 92;
- _globals->_soundHandler.play(77, this);
+ g_globals->_soundHandler.play(77, this);
break;
case 92:
- _globals->_scenePalette.clearListeners();
- _globals->_game->endGame(90, 6);
+ g_globals->_scenePalette.clearListeners();
+ g_globals->_game->endGame(90, 6);
break;
case 96:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 97:
_stripManager._field2E8 = 0;
@@ -2714,7 +2714,7 @@ void Scene90::signal() {
*--------------------------------------------------------------------------*/
void Scene95::Action1::signal() {
- Scene95 *scene = (Scene95 *)_globals->_sceneManager._scene;
+ Scene95 *scene = (Scene95 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -2739,7 +2739,7 @@ void Scene95::Action1::signal() {
Common::Point pt1(5, 198);
NpcMover *mover1 = new NpcMover();
- _globals->_player.addMover(mover1, &pt1, this);
+ g_globals->_player.addMover(mover1, &pt1, this);
Common::Point pt2(9, 190);
NpcMover *mover2 = new NpcMover();
@@ -2751,7 +2751,7 @@ void Scene95::Action1::signal() {
Common::Point pt1(235, 72);
PlayerMover *mover1 = new PlayerMover();
- _globals->_player.addMover(mover1, &pt1, NULL);
+ g_globals->_player.addMover(mover1, &pt1, NULL);
Common::Point pt2(235, 72);
PlayerMover *mover2 = new PlayerMover();
@@ -2782,8 +2782,8 @@ void Scene95::Action1::signal() {
break;
case 7: {
SceneItem::display(0, 0);
- _globals->_player.setVisage(92);
- _globals->_player.setPosition(Common::Point(-25, 200));
+ g_globals->_player.setVisage(92);
+ g_globals->_player.setPosition(Common::Point(-25, 200));
scene->_object1.setVisage(91);
scene->_object1.setPosition(Common::Point(-22, 220));
@@ -2791,7 +2791,7 @@ void Scene95::Action1::signal() {
Common::Point pt1(5, 198);
NpcMover *mover1 = new NpcMover();
- _globals->_player.addMover(mover1, &pt1, this);
+ g_globals->_player.addMover(mover1, &pt1, this);
Common::Point pt2(9, 190);
NpcMover *mover2 = new NpcMover();
@@ -2801,7 +2801,7 @@ void Scene95::Action1::signal() {
case 8: {
Common::Point pt1(108, 112);
PlayerMover *mover1 = new PlayerMover();
- _globals->_player.addMover(mover1, &pt1, this);
+ g_globals->_player.addMover(mover1, &pt1, this);
Common::Point pt2(108, 112);
PlayerMover *mover2 = new PlayerMover();
@@ -2809,7 +2809,7 @@ void Scene95::Action1::signal() {
break;
}
case 9:
- _globals->_sceneManager.changeScene(2300);
+ g_globals->_sceneManager.changeScene(2300);
break;
}
}
@@ -2824,14 +2824,14 @@ void Scene95::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(100, 10, 200, 100);
- _globals->_player.postInit();
- _globals->_player.setVisage(2337);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player._strip = 4;
- _globals->_player._moveDiff = Common::Point(30, 30);
- _globals->_player.setPosition(Common::Point(-35, 200));
- _globals->_player.changeZoom(-1);
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(2337);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player._strip = 4;
+ g_globals->_player._moveDiff = Common::Point(30, 30);
+ g_globals->_player.setPosition(Common::Point(-35, 200));
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player.disableControl();
_object1.postInit();
_object1.setVisage(2333);
@@ -2855,7 +2855,7 @@ void Scene95::postInit(SceneObjectList *OwnerList) {
*--------------------------------------------------------------------------*/
void Scene6100::Action1::signal() {
- Scene6100 *scene = (Scene6100 *)_globals->_sceneManager._scene;
+ Scene6100 *scene = (Scene6100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -2872,7 +2872,7 @@ void Scene6100::Action1::signal() {
}
void Scene6100::Action2::signal() {
- Scene6100 *scene = (Scene6100 *)_globals->_sceneManager._scene;
+ Scene6100 *scene = (Scene6100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -2889,7 +2889,7 @@ void Scene6100::Action2::signal() {
}
void Scene6100::Action3::signal() {
- Scene6100 *scene = (Scene6100 *)_globals->_sceneManager._scene;
+ Scene6100 *scene = (Scene6100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -2897,9 +2897,9 @@ void Scene6100::Action3::signal() {
setDelay(60);
break;
case 1:
- _globals->_scenePalette.clearListeners();
+ g_globals->_scenePalette.clearListeners();
scene->_fadePercent = 100;
- _globals->_scenePalette.refresh();
+ g_globals->_scenePalette.refresh();
scene->loadScene(9997);
scene->_object1.hide();
scene->_object2.hide();
@@ -2910,7 +2910,7 @@ void Scene6100::Action3::signal() {
scene->_rocks.hide();
scene->_sceneText.hide();
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start(8120, this);
break;
case 2:
@@ -2918,12 +2918,12 @@ void Scene6100::Action3::signal() {
break;
case 3:
scene->showMessage(NULL, 0, NULL);
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start(8130, this);
break;
case 4:
- _globals->setFlag(76);
- _globals->_sceneManager.changeScene(
+ g_globals->setFlag(76);
+ g_globals->_sceneManager.changeScene(
(scene->_stripManager._field2E8 == 135) ? 6100 : 2320);
remove();
break;
@@ -2931,7 +2931,7 @@ void Scene6100::Action3::signal() {
}
void Scene6100::Action4::signal() {
- Scene6100 *scene = (Scene6100 *)_globals->_sceneManager._scene;
+ Scene6100 *scene = (Scene6100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -2948,7 +2948,7 @@ void Scene6100::Action4::signal() {
}
void Scene6100::Action5::dispatch() {
- Scene6100 *scene = (Scene6100 *)_globals->_sceneManager._scene;
+ Scene6100 *scene = (Scene6100 *)g_globals->_sceneManager._scene;
FloatSet zeroSet;
const double MULTIPLY_FACTOR = 0.01744; // 2 * pi / 360
@@ -2998,9 +2998,9 @@ void Scene6100::Action5::dispatch() {
if (idx != 3) {
scene->_objList[idx]->_floats._float1 =
- _globals->_randomSource.getRandomNumber(199);
+ g_globals->_randomSource.getRandomNumber(199);
scene->_objList[idx]->_floats._float2 =
- _globals->_randomSource.getRandomNumber(999) + 750.0;
+ g_globals->_randomSource.getRandomNumber(999) + 750.0;
scene->_objList[idx]->_floats.proc1(
-(scene->_turnAmount * 10 + scene->_angle) * MULTIPLY_FACTOR);
@@ -3022,34 +3022,34 @@ void Scene6100::Action5::dispatch() {
scene->_soundHandler.play(233);
scene->showMessage(NULL, 0, NULL);
- if (!_globals->getFlag(76))
+ if (!g_globals->getFlag(76))
scene->_probe.setAction(&scene->_action1);
break;
case 1:
scene->_soundHandler.play(233);
scene->showMessage(NULL, 0, NULL);
- if (!_globals->getFlag(76))
+ if (!g_globals->getFlag(76))
scene->_probe.setAction(&scene->_action2);
break;
case 2:
scene->_soundHandler.play(234);
scene->showMessage(NULL, 0, NULL);
- if (!_globals->getFlag(76))
+ if (!g_globals->getFlag(76))
scene->_probe.setAction(NULL);
scene->setAction(&scene->_action3);
break;
}
- _globals->_scenePalette.clearListeners();
+ g_globals->_scenePalette.clearListeners();
scene->_fadePercent = 0;
}
}
}
void Scene6100::GetBoxAction::signal() {
- Scene6100 *scene = (Scene6100 *)_globals->_sceneManager._scene;
+ Scene6100 *scene = (Scene6100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
@@ -3062,7 +3062,7 @@ void Scene6100::GetBoxAction::signal() {
}
case 1: {
scene->showMessage(SCENE6100_TAKE_CONTROLS, 35, this);
- _globals->_scenePalette.clearListeners();
+ g_globals->_scenePalette.clearListeners();
Common::Point pt(scene->_rocks._position.x, scene->_rocks._position.y - 10);
NpcMover *mover = new NpcMover();
@@ -3081,13 +3081,13 @@ void Scene6100::GetBoxAction::signal() {
break;
case 5:
scene->showMessage(NULL, 0, NULL);
- _globals->_sceneManager.changeScene(2320);
+ g_globals->_sceneManager.changeScene(2320);
remove();
}
}
void Scene6100::GetBoxAction::dispatch() {
- Scene6100 *scene = (Scene6100 *)_globals->_sceneManager._scene;
+ Scene6100 *scene = (Scene6100 *)g_globals->_sceneManager._scene;
if (!scene->_probe._mover && (scene->_getBoxAction._actionIndex >= 1)) {
if (scene->_getBoxAction._actionIndex == 1) {
@@ -3113,7 +3113,7 @@ void Scene6100::Action7::signal() {
setDelay(90);
break;
case 2:
- _globals->_sceneManager.changeScene(2100);
+ g_globals->_sceneManager.changeScene(2100);
remove();
break;
}
@@ -3134,7 +3134,7 @@ void Scene6100::Object::synchronize(Serializer &s) {
/*--------------------------------------------------------------------------*/
void Scene6100::ProbeMover::dispatch() {
- Scene6100 *scene = (Scene6100 *)_globals->_sceneManager._scene;
+ Scene6100 *scene = (Scene6100 *)g_globals->_sceneManager._scene;
if (!dontMove()) {
if (scene->_speed > 0) {
@@ -3168,10 +3168,10 @@ Scene6100::Scene6100(): Scene() {
_angle = 0;
_msgActive = false;
- _globals->_sceneHandler->_delayTicks = 8;
+ g_globals->_sceneHandler->_delayTicks = 8;
- _globals->_player.disableControl();
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_player.disableControl();
+ g_globals->_events.setCursor(CURSOR_WALK);
}
void Scene6100::synchronize(Serializer &s) {
@@ -3240,10 +3240,10 @@ void Scene6100::postInit(SceneObjectList *OwnerList) {
int baseVal = 2000;
for (int idx = 0; idx < 3; ++idx) {
- _objList[idx]->_floats._float1 = _globals->_randomSource.getRandomNumber(999);
+ _objList[idx]->_floats._float1 = g_globals->_randomSource.getRandomNumber(999);
_objList[idx]->_floats._float2 = baseVal;
_objList[idx]->_floats._float3 = 0.0;
- baseVal += _globals->_randomSource.getRandomNumber(499);
+ baseVal += g_globals->_randomSource.getRandomNumber(499);
_objList[idx]->postInit();
_objList[idx]->setVisage(6100);
@@ -3251,23 +3251,23 @@ void Scene6100::postInit(SceneObjectList *OwnerList) {
_objList[idx]->_strip = 2;
_objList[idx]->setPosition(Common::Point(
- _globals->_randomSource.getRandomNumber(319), 60));
+ g_globals->_randomSource.getRandomNumber(319), 60));
_objList[idx]->fixPriority(1);
_objList[idx]->changeZoom(-1);
}
setAction(&_action5);
- _globals->_scenePalette.addRotation(96, 143, -1);
+ g_globals->_scenePalette.addRotation(96, 143, -1);
- if (!_globals->getFlag(76))
+ if (!g_globals->getFlag(76))
_probe.setAction(&_action4);
- _globals->_soundHandler.play(231);
+ g_globals->_soundHandler.play(231);
}
void Scene6100::remove() {
- _globals->_player.disableControl();
- _globals->_scenePalette.clearListeners();
+ g_globals->_player.disableControl();
+ g_globals->_scenePalette.clearListeners();
Scene::remove();
}
@@ -3294,18 +3294,18 @@ void Scene6100::dispatch() {
_probe._action->dispatch();
// Handle mouse controlling the turning
- int changeAmount = (_globals->_events._mousePos.x - 160) / -20;
+ int changeAmount = (g_globals->_events._mousePos.x - 160) / -20;
_turnAmount += (changeAmount - _turnAmount) / 2;
if (_fadePercent < 100) {
_fadePercent += 10;
if (_fadePercent >= 100) {
- _globals->_scenePalette.addRotation(96, 143, -1);
+ g_globals->_scenePalette.addRotation(96, 143, -1);
_fadePercent = 100;
}
byte adjustData[] = {0xff, 0xff, 0xff, 0};
- _globals->_scenePalette.fade(adjustData, false, _fadePercent);
+ g_globals->_scenePalette.fade(adjustData, false, _fadePercent);
}
if (_action != &_action3) {
diff --git a/engines/tsage/ringworld/ringworld_scenes1.h b/engines/tsage/ringworld/ringworld_scenes1.h
index 49ea65eb3a..bb98c89a8c 100644
--- a/engines/tsage/ringworld/ringworld_scenes1.h
+++ b/engines/tsage/ringworld/ringworld_scenes1.h
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
#include "tsage/ringworld/ringworld_logic.h"
+#include "tsage/ringworld/ringworld_speakers.h"
#include "tsage/converse.h"
#include "tsage/events.h"
#include "tsage/core.h"
diff --git a/engines/tsage/ringworld/ringworld_scenes10.cpp b/engines/tsage/ringworld/ringworld_scenes10.cpp
index df25c324ab..9a9f63705b 100644
--- a/engines/tsage/ringworld/ringworld_scenes10.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes10.cpp
@@ -37,17 +37,17 @@ Scene2::Scene2() : Scene() {
/*--------------------------------------------------------------------------*/
void Object9350::postInit(SceneObjectList *OwnerList) {
- //SceneObject::postInit(&_globals->_sceneManager._altSceneObjects);
+ //SceneObject::postInit(&g_globals->_sceneManager._bgSceneObjects);
SceneObject::postInit(OwnerList);
}
void Object9350::draw() {
reposition();
Rect destRect = _bounds;
- destRect.translate(-_globals->_sceneOffset.x, -_globals->_sceneOffset.y);
- Region *priorityRegion = _globals->_sceneManager._scene->_priorities.find(_globals->_sceneManager._scene->_stripManager._stripNum);
+ destRect.translate(-g_globals->_sceneOffset.x, -g_globals->_sceneOffset.y);
+ Region *priorityRegion = g_globals->_sceneManager._scene->_priorities.find(g_globals->_sceneManager._scene->_stripManager._stripNum);
GfxSurface frame = getFrame();
- _globals->gfxManager().copyFrom(frame, destRect, priorityRegion);
+ g_globals->gfxManager().copyFrom(frame, destRect, priorityRegion);
}
/*--------------------------------------------------------------------------
@@ -55,37 +55,37 @@ void Object9350::draw() {
*
*--------------------------------------------------------------------------*/
void Scene9100::SceneHotspot1::doAction(int action) {
- Scene9100 *scene = (Scene9100 *)_globals->_sceneManager._scene;
+ Scene9100 *scene = (Scene9100 *)g_globals->_sceneManager._scene;
if (action == CURSOR_TALK) {
- if (_globals->getFlag(23)) {
- _globals->_player.disableControl();
+ if (g_globals->getFlag(23)) {
+ g_globals->_player.disableControl();
scene->_sceneMode = 9104;
} else {
- _globals->setFlag(23);
- _globals->_player.disableControl();
+ g_globals->setFlag(23);
+ g_globals->_player.disableControl();
scene->_sceneMode = 9105;
}
- scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &_globals->_player, &scene->_object5, &scene->_object6, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &g_globals->_player, &scene->_object5, &scene->_object6, NULL);
} else {
NamedHotspot::doAction(action);
}
}
void Scene9100::dispatch() {
- Scene9100 *scene = (Scene9100 *)_globals->_sceneManager._scene;
+ Scene9100 *scene = (Scene9100 *)g_globals->_sceneManager._scene;
if (!_action) {
- if (_globals->_player._position.x < 25) {
- _globals->_player.disableControl();
- if (!_globals->getFlag(23) || _globals->getFlag(11))
+ if (g_globals->_player._position.x < 25) {
+ g_globals->_player.disableControl();
+ if (!g_globals->getFlag(23) || g_globals->getFlag(11))
_sceneMode = 9106;
else {
_sceneMode = 9108;
- _globals->setFlag(11);
+ g_globals->setFlag(11);
}
- scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, &g_globals->_player, NULL);
}
} else {
Scene::dispatch();
@@ -93,13 +93,13 @@ void Scene9100::dispatch() {
}
void Scene9100::signal() {
- Scene9100 *scene = (Scene9100 *)_globals->_sceneManager._scene;
+ Scene9100 *scene = (Scene9100 *)g_globals->_sceneManager._scene;
switch (scene->_sceneMode) {
case 9102:
case 9106:
case 9108:
- _globals->_sceneManager.changeScene(9150);
+ g_globals->_sceneManager.changeScene(9150);
break;
case 9105:
_sceneHotspot3.remove();
@@ -109,7 +109,7 @@ void Scene9100::signal() {
case 9107:
case 9109:
default:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
}
}
@@ -125,7 +125,7 @@ void Scene9100::postInit(SceneObjectList *OwnerList) {
_object1.animate(ANIM_MODE_2, NULL);
_object1.fixPriority(10);
- _globals->_player.postInit();
+ g_globals->_player.postInit();
_object2.postInit();
_object2.hide();
@@ -139,39 +139,39 @@ void Scene9100::postInit(SceneObjectList *OwnerList) {
_object5.postInit();
_object5.hide();
- if (!_globals->getFlag(23)) {
+ if (!g_globals->getFlag(23)) {
_object6.postInit();
_object6.setVisage(9111);
_object6.setStrip(6);
_object6.setFrame(1);
_object6.setPosition(Common::Point(138, 166));
- _sceneHotspot3.setup(145, 125, 166, 156, 9100, 40, 43);
- }
- _sceneHotspot1.setup(140, 176, 185, 215, 9100, 36, 37);
- _sceneHotspot2.setup(161, 138, 182, 175, 9100, 38, 39);
- _sceneHotspot4.setup(37, 196, 47, 320, 9100, 44, -1);
- _sceneHotspot5.setup(69, 36, 121, 272, 9100, 45, 46);
- _sceneHotspot6.setup(127, 0, 200, 52, 9100, 47, 48);
-
- _globals->_soundHandler.play(251);
- if (_globals->_sceneManager._previousScene == 9150) {
- if (_globals->getFlag(20)) {
- _globals->_player.disableControl();
- if (_globals->getFlag(11))
+ _sceneHotspot3.setDetails(145, 125, 166, 156, 9100, 40, 43);
+ }
+ _sceneHotspot1.setDetails(140, 176, 185, 215, 9100, 36, 37);
+ _sceneHotspot2.setDetails(161, 138, 182, 175, 9100, 38, 39);
+ _sceneHotspot4.setDetails(37, 196, 47, 320, 9100, 44, -1);
+ _sceneHotspot5.setDetails(69, 36, 121, 272, 9100, 45, 46);
+ _sceneHotspot6.setDetails(127, 0, 200, 52, 9100, 47, 48);
+
+ g_globals->_soundHandler.play(251);
+ if (g_globals->_sceneManager._previousScene == 9150) {
+ if (g_globals->getFlag(20)) {
+ g_globals->_player.disableControl();
+ if (g_globals->getFlag(11))
_sceneMode = 9107;
else
_sceneMode = 9109;
- setAction(&_sequenceManager, this, _sceneMode, &_globals->_player, &_object5, NULL);
+ setAction(&_sequenceManager, this, _sceneMode, &g_globals->_player, &_object5, NULL);
} else {
_sceneMode = 9103;
- _globals->_player.disableControl();
- setAction(&_sequenceManager, this, _sceneMode, &_globals->_player, &_object2, &_object3, &_object4, &_object5, NULL);
- _globals->setFlag(20);
+ g_globals->_player.disableControl();
+ setAction(&_sequenceManager, this, _sceneMode, &g_globals->_player, &_object2, &_object3, &_object4, &_object5, NULL);
+ g_globals->setFlag(20);
}
} else {
_sceneMode = 9102;
- _globals->_player.disableControl();
- setAction(&_sequenceManager, this, _sceneMode, &_globals->_player, &_object2, &_object3, &_object4, &_object5, NULL);
+ g_globals->_player.disableControl();
+ setAction(&_sequenceManager, this, _sceneMode, &g_globals->_player, &_object2, &_object3, &_object4, &_object5, NULL);
}
}
@@ -182,7 +182,7 @@ void Scene9100::postInit(SceneObjectList *OwnerList) {
void Scene9150::Object3::signal() {
switch (_signalFlag++) {
case 0:
- _timer = 10 + _globals->_randomSource.getRandomNumber(90);
+ _timer = 10 + g_globals->_randomSource.getRandomNumber(90);
break;
default:
animate(ANIM_MODE_5, this);
@@ -201,15 +201,15 @@ void Scene9150::signal() {
switch (_sceneMode) {
case 9151:
case 9157:
- _globals->_sceneManager.changeScene(9100);
+ g_globals->_sceneManager.changeScene(9100);
break;
case 9153:
- _globals->_sceneManager.changeScene(9300);
+ g_globals->_sceneManager.changeScene(9300);
break;
case 9152:
case 9155:
case 9156:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 9154:
default:
@@ -229,21 +229,21 @@ void Scene9150::dispatch() {
if (_action) {
_action->dispatch();
} else {
- if (_globals->_player._position.x >= 160) {
- if (_globals->_player._position.x > 630) {
- _globals->_player.disableControl();
+ if (g_globals->_player._position.x >= 160) {
+ if (g_globals->_player._position.x > 630) {
+ g_globals->_player.disableControl();
_sceneMode = 9157;
- setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, NULL);
+ setAction(&_sequenceManager1, this, _sceneMode, &g_globals->_player, NULL);
}
} else {
- _globals->_player.disableControl();
- if (_globals->getFlag(11)) {
- _globals->_soundHandler.play(286);
+ g_globals->_player.disableControl();
+ if (g_globals->getFlag(11)) {
+ g_globals->_soundHandler.play(286);
_sceneMode = 9153;
} else {
_sceneMode = 9156;
}
- setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, NULL);
+ setAction(&_sequenceManager1, this, _sceneMode, &g_globals->_player, NULL);
}
}
}
@@ -251,7 +251,7 @@ void Scene9150::dispatch() {
void Scene9150::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(0, 100, 200, 100);
- _globals->_player.postInit();
+ g_globals->_player.postInit();
_object3.postInit();
_sceneState = 1;
@@ -261,37 +261,37 @@ void Scene9150::postInit(SceneObjectList *OwnerList) {
_object3.setPosition(Common::Point(312, 95));
_object3.signal();
- _sceneHotspot1.setup(0, 0, 200, 94, 9150, 46, -1);
- _sceneHotspot2.setup(51, 90, 118, 230, 9150, 47, -1);
- _sceneHotspot3.setup(182, 104, 200, 320, 9150, 48, 49);
- _sceneHotspot4.setup(103, 292, 152, 314, 9150, 50, 51);
- _sceneHotspot5.setup(115, 350, 160, 374, 9150, 52, 53);
- _sceneHotspot6.setup(0, 471, 200, 531, 9150, 54, 55);
- _sceneHotspot7.setup(170, 320, 185, 640, 9150, 56, -1);
- _sceneHotspot9.setup(157, 107, 186, 320, 9150, 56, -1);
- _sceneHotspot8.setup(133, 584, 142, 640, 9150, 57, -1);
- _sceneHotspot10.setup(83, 304, 103, 323, 9150, 58, 59);
-
- _globals->_soundHandler.play(285);
- _globals->_player.disableControl();
-
- if (_globals->getFlag(20)) {
+ _sceneHotspot1.setDetails(0, 0, 200, 94, 9150, 46, -1);
+ _sceneHotspot2.setDetails(51, 90, 118, 230, 9150, 47, -1);
+ _sceneHotspot3.setDetails(182, 104, 200, 320, 9150, 48, 49);
+ _sceneHotspot4.setDetails(103, 292, 152, 314, 9150, 50, 51);
+ _sceneHotspot5.setDetails(115, 350, 160, 374, 9150, 52, 53);
+ _sceneHotspot6.setDetails(0, 471, 200, 531, 9150, 54, 55);
+ _sceneHotspot7.setDetails(170, 320, 185, 640, 9150, 56, -1);
+ _sceneHotspot9.setDetails(157, 107, 186, 320, 9150, 56, -1);
+ _sceneHotspot8.setDetails(133, 584, 142, 640, 9150, 57, -1);
+ _sceneHotspot10.setDetails(83, 304, 103, 323, 9150, 58, 59);
+
+ g_globals->_soundHandler.play(285);
+ g_globals->_player.disableControl();
+
+ if (g_globals->getFlag(20)) {
// Walking alone
- _globals->_scrollFollower = &_globals->_player;
- if (_globals->getFlag(11))
+ g_globals->_scrollFollower = &g_globals->_player;
+ if (g_globals->getFlag(11))
// Hero wearing peasan suit
_sceneMode = 9155;
else
// Hero wearing Purple suit
_sceneMode = 9152;
- setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, NULL);
+ setAction(&_sequenceManager1, this, _sceneMode, &g_globals->_player, NULL);
} else {
// Walking with the tiger
_sceneMode = 9151;
_object2.postInit();
_object2.hide();
_object1.postInit();
- setAction(&_sequenceManager1, this, _sceneMode, &_globals->_player, &_object1, &_object2, NULL);
+ setAction(&_sequenceManager1, this, _sceneMode, &g_globals->_player, &_object1, &_object2, NULL);
}
}
@@ -300,22 +300,22 @@ void Scene9150::postInit(SceneObjectList *OwnerList) {
*
*--------------------------------------------------------------------------*/
void Scene9200::SceneHotspot1::doAction(int action) {
- Scene9200 *scene = (Scene9200 *)_globals->_sceneManager._scene;
+ Scene9200 *scene = (Scene9200 *)g_globals->_sceneManager._scene;
if (action == OBJECT_TUNIC) {
- _globals->_player.disableControl();
- if (_globals->getFlag(93)) {
+ g_globals->_player.disableControl();
+ if (g_globals->getFlag(93)) {
scene->_sceneState = 9214;
- scene->setAction(&scene->_sequenceManager, scene, 9214, &_globals->_player, &scene->_object2, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 9214, &g_globals->_player, &scene->_object2, NULL);
} else {
- _globals->setFlag(93);
+ g_globals->setFlag(93);
scene->_sceneState = 9213;
- scene->setAction(&scene->_sequenceManager, scene, 9213, &_globals->_player, &scene->_object2, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 9213, &g_globals->_player, &scene->_object2, NULL);
}
} else if (action <= 100) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneState = 9214;
- scene->setAction(&scene->_sequenceManager, scene, 9214, &_globals->_player, &scene->_object2, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 9214, &g_globals->_player, &scene->_object2, NULL);
} else {
NamedHotspot::doAction(action);
}
@@ -324,15 +324,15 @@ void Scene9200::SceneHotspot1::doAction(int action) {
void Scene9200::signal() {
switch (_sceneState++) {
case 9207:
- _globals->_sceneManager.changeScene(9700);
+ g_globals->_sceneManager.changeScene(9700);
break;
case 9208:
case 9211:
case 9212:
- _globals->_sceneManager.changeScene(9500);
+ g_globals->_sceneManager.changeScene(9500);
break;
case 9209:
- _globals->_sceneManager.changeScene(9360);
+ g_globals->_sceneManager.changeScene(9360);
break;
case 9210:
_hotspot1.remove();
@@ -344,7 +344,7 @@ void Scene9200::signal() {
case 9205:
case 9206:
default:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
}
}
@@ -360,30 +360,30 @@ void Scene9200::dispatch() {
if (_action) {
_action->dispatch();
} else {
- if ( (_globals->_player._position.x <= 0) || ((_globals->_player._position.x < 100) && (_globals->_player._position.y > 199))) {
- _globals->_player.disableControl();
+ if ( (g_globals->_player._position.x <= 0) || ((g_globals->_player._position.x < 100) && (g_globals->_player._position.y > 199))) {
+ g_globals->_player.disableControl();
_sceneState = 9209;
- setAction(&_sequenceManager, this, 9209, &_globals->_player, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager, this, 9209, &g_globals->_player, &_object2, &_object3, NULL);
} else {
- if (rect9200.contains(_globals->_player._position)) {
- if (_globals->getFlag(93)) {
- if (_globals->getFlag(86)) {
+ if (rect9200.contains(g_globals->_player._position)) {
+ if (g_globals->getFlag(93)) {
+ if (g_globals->getFlag(86)) {
_sceneState = 9215;
- setAction(&_sequenceManager, this, 9215, &_globals->_player, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager, this, 9215, &g_globals->_player, &_object2, &_object3, NULL);
} else {
_sceneState = 9208;
- setAction(&_sequenceManager, this, 9208, &_globals->_player, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager, this, 9208, &g_globals->_player, &_object2, &_object3, NULL);
}
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneState = 9204;
- setAction(&_sequenceManager, this, 9204, &_globals->_player, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager, this, 9204, &g_globals->_player, &_object2, &_object3, NULL);
}
} else {
- if (_globals->_player._position.y < 140) {
- _globals->_player.disableControl();
+ if (g_globals->_player._position.y < 140) {
+ g_globals->_player.disableControl();
_sceneState = 9207;
- setAction(&_sequenceManager, this, 9207, &_globals->_player, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager, this, 9207, &g_globals->_player, &_object2, &_object3, NULL);
}
}
}
@@ -394,7 +394,7 @@ void Scene9200::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(130, 50, 200, 150);
- _globals->_player.postInit();
+ g_globals->_player.postInit();
_object3.postInit();
_object3.hide();
_object1.postInit();
@@ -410,63 +410,63 @@ void Scene9200::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerGR);
_stripManager.addSpeaker(&_speakerGText);
- if (!_globals->getFlag(86)) {
+ if (!g_globals->getFlag(86)) {
_object2.postInit();
- _hotspot1.setup(96, 194, 160, 234, 9200, 29, 31);
+ _hotspot1.setDetails(96, 194, 160, 234, 9200, 29, 31);
}
- _hotspot2.setup(164, 0, 200, 282, 9200, 0, 1);
- _hotspot3.setup(140, 39, 165, 153, 9200, 2, 3);
- _hotspot4.setup(92, 122, 139, 152, 9200, 4, 5);
- _hotspot5.setup(33, 20, 142, 115, 9200, 6, 7);
- _hotspot6.setup(104, 235, 153, 265, 9200, 8, 9);
- _hotspot7.setup(107, 262, 153, 286, 9200, 10, 11);
- _hotspot8.setup(69, 276, 164, 320, 9200, 12, 13);
+ _hotspot2.setDetails(164, 0, 200, 282, 9200, 0, 1);
+ _hotspot3.setDetails(140, 39, 165, 153, 9200, 2, 3);
+ _hotspot4.setDetails(92, 122, 139, 152, 9200, 4, 5);
+ _hotspot5.setDetails(33, 20, 142, 115, 9200, 6, 7);
+ _hotspot6.setDetails(104, 235, 153, 265, 9200, 8, 9);
+ _hotspot7.setDetails(107, 262, 153, 286, 9200, 10, 11);
+ _hotspot8.setDetails(69, 276, 164, 320, 9200, 12, 13);
- _globals->_events.setCursor(CURSOR_WALK);
- _globals->_player.disableControl();
+ g_globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_player.disableControl();
- switch (_globals->_sceneManager._previousScene) {
+ switch (g_globals->_sceneManager._previousScene) {
case 9500:
- if (_globals->getFlag(85)) {
+ if (g_globals->getFlag(85)) {
if (RING_INVENTORY._helmet._sceneNumber == 1) {
- _globals->setFlag(86);
- _globals->_player.disableControl();
+ g_globals->setFlag(86);
+ g_globals->_player.disableControl();
_sceneState = 9210;
- setAction(&_sequenceManager, this, 9210, &_globals->_player, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager, this, 9210, &g_globals->_player, &_object2, &_object3, NULL);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneState = 9212;
- setAction(&_sequenceManager, this, 9212, &_globals->_player, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager, this, 9212, &g_globals->_player, &_object2, &_object3, NULL);
}
} else {
if (RING_INVENTORY._helmet._sceneNumber == 1) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneState = 9211;
- setAction(&_sequenceManager, this, 9211, &_globals->_player, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager, this, 9211, &g_globals->_player, &_object2, &_object3, NULL);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneState = 9202;
- setAction(&_sequenceManager, this, 9202, &_globals->_player, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager, this, 9202, &g_globals->_player, &_object2, &_object3, NULL);
}
}
break;
case 9700:
- if (_globals->getFlag(86)) {
+ if (g_globals->getFlag(86)) {
_sceneState = 9206;
- setAction(&_sequenceManager, this, 9206, &_globals->_player, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager, this, 9206, &g_globals->_player, &_object2, &_object3, NULL);
} else {
_sceneState = 9203;
- setAction(&_sequenceManager, this, 9203, &_globals->_player, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager, this, 9203, &g_globals->_player, &_object2, &_object3, NULL);
}
break;
case 9360:
default:
- if (_globals->getFlag(86)) {
+ if (g_globals->getFlag(86)) {
_sceneState = 9205;
- setAction(&_sequenceManager, this, 9205, &_globals->_player, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager, this, 9205, &g_globals->_player, &_object2, &_object3, NULL);
} else {
_sceneState = 9201;
- setAction(&_sequenceManager, this, 9201, &_globals->_player, &_object2, &_object3, NULL);
+ setAction(&_sequenceManager, this, 9201, &g_globals->_player, &_object2, &_object3, NULL);
}
break;
}
@@ -479,14 +479,14 @@ void Scene9200::postInit(SceneObjectList *OwnerList) {
void Scene9300::signal() {
switch (_sceneMode++) {
case 9301:
- _globals->setFlag(84);
+ g_globals->setFlag(84);
// No break on purpose
case 9303:
- _globals->_soundHandler.play(295);
- _globals->_sceneManager.changeScene(9350);
+ g_globals->_soundHandler.play(295);
+ g_globals->_sceneManager.changeScene(9350);
break;
case 9302:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
default:
break;
@@ -496,10 +496,10 @@ void Scene9300::signal() {
void Scene9300::dispatch() {
if (_action) {
_action->dispatch();
- } else if (_globals->_player._position.y < 145) {
- _globals->_player.disableControl();
+ } else if (g_globals->_player._position.y < 145) {
+ g_globals->_player.disableControl();
_sceneMode = 9303;
- setAction(&_sequenceManager, this, 9303, &_globals->_player, &_object1, &_object2, NULL);
+ setAction(&_sequenceManager, this, 9303, &g_globals->_player, &_object1, &_object2, NULL);
}
}
@@ -508,34 +508,34 @@ void Scene9300::postInit(SceneObjectList *OwnerList) {
setZoomPercents(130, 75, 230, 150);
_sceneMode = 0;
- _globals->_player.postInit();
- _globals->_player.changeZoom(-1);
+ g_globals->_player.postInit();
+ g_globals->_player.changeZoom(-1);
_object1.postInit();
_object2.postInit();
- _globals->_soundHandler.play(289);
-
- _hotspot1.setup(35, 142, 76, 212, 9300, 0, 1);
- _hotspot2.setup(28, 90, 81, 143, 9300, 2, 3);
- _hotspot3.setup(78, 142, 146, 216, 9300, 4, 5);
- _hotspot4.setup(3, 43, 91, 74, 9300, 6, 7);
- _hotspot5.setup(82, 19, 157, 65, 9300, 8, 9);
- _hotspot6.setup(5, 218, 84, 274, 9300, 10, 11);
- _hotspot7.setup(86, 233, 168, 293, 9300, 12, 13);
- _hotspot8.setup(157, 0, 200, 230, 9300, 14, 15);
- _hotspot9.setup(169, 227, 200, 320, 9300, 16, 17);
- _hotspot10.setup(145, 97, 166, 225, 9300, 18, 19);
- _hotspot11.setup(81, 75, 145, 145, 9300, 20, 21);
- _hotspot12.setup(0, 0, 94, 35, 9300, 22, 23);
- _hotspot13.setup(12, 268, 149, 320, 9300, 24, 25);
-
- if (_globals->_sceneManager._previousScene == 9350) {
- _globals->_player.disableControl();
+ g_globals->_soundHandler.play(289);
+
+ _hotspot1.setDetails(35, 142, 76, 212, 9300, 0, 1);
+ _hotspot2.setDetails(28, 90, 81, 143, 9300, 2, 3);
+ _hotspot3.setDetails(78, 142, 146, 216, 9300, 4, 5);
+ _hotspot4.setDetails(3, 43, 91, 74, 9300, 6, 7);
+ _hotspot5.setDetails(82, 19, 157, 65, 9300, 8, 9);
+ _hotspot6.setDetails(5, 218, 84, 274, 9300, 10, 11);
+ _hotspot7.setDetails(86, 233, 168, 293, 9300, 12, 13);
+ _hotspot8.setDetails(157, 0, 200, 230, 9300, 14, 15);
+ _hotspot9.setDetails(169, 227, 200, 320, 9300, 16, 17);
+ _hotspot10.setDetails(145, 97, 166, 225, 9300, 18, 19);
+ _hotspot11.setDetails(81, 75, 145, 145, 9300, 20, 21);
+ _hotspot12.setDetails(0, 0, 94, 35, 9300, 22, 23);
+ _hotspot13.setDetails(12, 268, 149, 320, 9300, 24, 25);
+
+ if (g_globals->_sceneManager._previousScene == 9350) {
+ g_globals->_player.disableControl();
_sceneMode = 9302;
- setAction(&_sequenceManager, this, 9302, &_globals->_player, &_object1, &_object2, NULL);
+ setAction(&_sequenceManager, this, 9302, &g_globals->_player, &_object1, &_object2, NULL);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9301;
- setAction(&_sequenceManager, this, 9301, &_globals->_player, &_object1, &_object2, NULL);
+ setAction(&_sequenceManager, this, 9301, &g_globals->_player, &_object1, &_object2, NULL);
}
}
@@ -550,17 +550,17 @@ void Scene9350::signal() {
case 9352:
case 9353:
case 9354:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 9355:
- _globals->_sceneManager.changeScene(9300);
+ g_globals->_sceneManager.changeScene(9300);
break;
case 9356:
- _globals->_sceneManager.changeScene(9360);
+ g_globals->_sceneManager.changeScene(9360);
break;
case 9357:
case 9359:
- _globals->_sceneManager.changeScene(9400);
+ g_globals->_sceneManager.changeScene(9400);
break;
default:
break;
@@ -569,18 +569,18 @@ void Scene9350::signal() {
void Scene9350::dispatch() {
if (_action == 0) {
- if ((_globals->_player._position.x > 300) && (_globals->_player._position.y < 160)) {
- _globals->_player.disableControl();
+ if ((g_globals->_player._position.x > 300) && (g_globals->_player._position.y < 160)) {
+ g_globals->_player.disableControl();
_sceneState = 9356;
- setAction(&_sequenceManager, this, 9356, &_globals->_player, &_object2, NULL);
- } else if ((_globals->_player._position.x > 110) && (_globals->_player._position.y >= 195)) {
- _globals->_player.disableControl();
+ setAction(&_sequenceManager, this, 9356, &g_globals->_player, &_object2, NULL);
+ } else if ((g_globals->_player._position.x > 110) && (g_globals->_player._position.y >= 195)) {
+ g_globals->_player.disableControl();
_sceneState = 9357;
- setAction(&_sequenceManager, this, 9357, &_globals->_player, &_object2, NULL);
- } else if ((_globals->_player._position.x < 10) || ((_globals->_player._position.x <= 110) && (_globals->_player._position.y >= 195))) {
- _globals->_player.disableControl();
+ setAction(&_sequenceManager, this, 9357, &g_globals->_player, &_object2, NULL);
+ } else if ((g_globals->_player._position.x < 10) || ((g_globals->_player._position.x <= 110) && (g_globals->_player._position.y >= 195))) {
+ g_globals->_player.disableControl();
_sceneState = 9355;
- setAction(&_sequenceManager, this, 9355, &_globals->_player, &_object2, NULL);
+ setAction(&_sequenceManager, this, 9355, &g_globals->_player, &_object2, NULL);
}
} else {
Scene::dispatch();
@@ -590,37 +590,37 @@ void Scene9350::dispatch() {
void Scene9350::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(95, 80, 200, 100);
- _globals->_player.postInit();
+ g_globals->_player.postInit();
_object1.setup(9351, 1, 3, 139, 97, 0);
- _sceneHotspot1.setup(42, 0, 97, 60, 9350, 0, -1);
- _sceneHotspot2.setup(37, 205, 82, 256, 9350, 0, -1);
- _sceneHotspot3.setup(29, 93, 92, 174, 9350, 1, -1);
- _sceneHotspot4.setup(0, 308, 109, 320, 9350, 2, -1);
- _sceneHotspot5.setup(0, 0, 200, 320, 9350, 3, -1);
+ _sceneHotspot1.setDetails(42, 0, 97, 60, 9350, 0, -1);
+ _sceneHotspot2.setDetails(37, 205, 82, 256, 9350, 0, -1);
+ _sceneHotspot3.setDetails(29, 93, 92, 174, 9350, 1, -1);
+ _sceneHotspot4.setDetails(0, 308, 109, 320, 9350, 2, -1);
+ _sceneHotspot5.setDetails(0, 0, 200, 320, 9350, 3, -1);
- _globals->_events.setCursor(CURSOR_WALK);
- _globals->_player.disableControl();
+ g_globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_player.disableControl();
- if (_globals->_sceneManager._previousScene == 9360) {
- _globals->_player.disableControl();
+ if (g_globals->_sceneManager._previousScene == 9360) {
+ g_globals->_player.disableControl();
_sceneState = 9352;
- setAction(&_sequenceManager, this, 9352, &_globals->_player, &_object2, NULL);
- } else if (_globals->_sceneManager._previousScene == 9400) {
- _globals->_player.disableControl();
+ setAction(&_sequenceManager, this, 9352, &g_globals->_player, &_object2, NULL);
+ } else if (g_globals->_sceneManager._previousScene == 9400) {
+ g_globals->_player.disableControl();
_sceneState = 9353;
- setAction(&_sequenceManager, this, 9353, &_globals->_player, &_object2, NULL);
+ setAction(&_sequenceManager, this, 9353, &g_globals->_player, &_object2, NULL);
} else {
- if (_globals->getFlag(84)) {
- _globals->clearFlag(84);
+ if (g_globals->getFlag(84)) {
+ g_globals->clearFlag(84);
_object2.postInit();
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneState = 9359;
- setAction(&_sequenceManager, this, 9359, &_globals->_player, &_object2, NULL);
+ setAction(&_sequenceManager, this, 9359, &g_globals->_player, &_object2, NULL);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneState = 9354;
- setAction(&_sequenceManager, this, 9354, &_globals->_player, &_object2, NULL);
+ setAction(&_sequenceManager, this, 9354, &g_globals->_player, &_object2, NULL);
}
}
}
@@ -636,16 +636,16 @@ void Scene9360::signal() {
case 9362:
case 9363:
case 9364:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 9365:
- _globals->_sceneManager.changeScene(9350);
+ g_globals->_sceneManager.changeScene(9350);
break;
case 9366:
- _globals->_sceneManager.changeScene(9200);
+ g_globals->_sceneManager.changeScene(9200);
break;
case 9367:
- _globals->_sceneManager.changeScene(9450);
+ g_globals->_sceneManager.changeScene(9450);
break;
default:
break;
@@ -654,18 +654,18 @@ void Scene9360::signal() {
void Scene9360::dispatch() {
if (_action == 0) {
- if ((_globals->_player._position.x > 300) && (_globals->_player._position.y < 160)) {
- _globals->_player.disableControl();
+ if ((g_globals->_player._position.x > 300) && (g_globals->_player._position.y < 160)) {
+ g_globals->_player.disableControl();
_sceneState = 9366;
- setAction(&_sequenceManager, this, 9366, &_globals->_player, NULL);
- } else if ((_globals->_player._position.x > 110) && (_globals->_player._position.y >= 195)) {
- _globals->_player.disableControl();
+ setAction(&_sequenceManager, this, 9366, &g_globals->_player, NULL);
+ } else if ((g_globals->_player._position.x > 110) && (g_globals->_player._position.y >= 195)) {
+ g_globals->_player.disableControl();
_sceneState = 9367;
- setAction(&_sequenceManager, this, 9367, &_globals->_player, NULL);
- } else if ((_globals->_player._position.x < 10) || ((_globals->_player._position.x <= 110) && (_globals->_player._position.y >= 195))) {
- _globals->_player.disableControl();
+ setAction(&_sequenceManager, this, 9367, &g_globals->_player, NULL);
+ } else if ((g_globals->_player._position.x < 10) || ((g_globals->_player._position.x <= 110) && (g_globals->_player._position.y >= 195))) {
+ g_globals->_player.disableControl();
_sceneState = 9365;
- setAction(&_sequenceManager, this, 9365, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 9365, &g_globals->_player, NULL);
}
} else {
Scene::dispatch();
@@ -675,30 +675,30 @@ void Scene9360::dispatch() {
void Scene9360::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(95, 80, 200, 100);
- _globals->_player.postInit();
-
- _hotspot1.setup(37, 92, 93, 173, 9360, 0, 1);
- _hotspot2.setup(42, 0, 100, 63, 9360, 2, -1);
- _hotspot3.setup(36, 205, 82, 260, 9360, 3, -1);
- _hotspot4.setup(103, 2, 200, 320, 9360, 4, -1);
- _hotspot5.setup(0, 0, 37, 320, 9360, 4, -1);
- _hotspot6.setup(35, 61, 103, 92, 9360, 4, -1);
- _hotspot7.setup(33, 174, 93, 207, 9360, 4, -1);
- _hotspot8.setup(28, 257, 149, 320, 9360, 4, -1);
- _globals->_events.setCursor(CURSOR_WALK);
- _globals->_player.disableControl();
- if (_globals->_sceneManager._previousScene == 9350) {
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+
+ _hotspot1.setDetails(37, 92, 93, 173, 9360, 0, 1);
+ _hotspot2.setDetails(42, 0, 100, 63, 9360, 2, -1);
+ _hotspot3.setDetails(36, 205, 82, 260, 9360, 3, -1);
+ _hotspot4.setDetails(103, 2, 200, 320, 9360, 4, -1);
+ _hotspot5.setDetails(0, 0, 37, 320, 9360, 4, -1);
+ _hotspot6.setDetails(35, 61, 103, 92, 9360, 4, -1);
+ _hotspot7.setDetails(33, 174, 93, 207, 9360, 4, -1);
+ _hotspot8.setDetails(28, 257, 149, 320, 9360, 4, -1);
+ g_globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_player.disableControl();
+ if (g_globals->_sceneManager._previousScene == 9350) {
+ g_globals->_player.disableControl();
_sceneState = 9364;
- setAction(&_sequenceManager, this, 9364, &_globals->_player, NULL);
- } else if (_globals->_sceneManager._previousScene == 9450) {
- _globals->_player.disableControl();
+ setAction(&_sequenceManager, this, 9364, &g_globals->_player, NULL);
+ } else if (g_globals->_sceneManager._previousScene == 9450) {
+ g_globals->_player.disableControl();
_sceneState = 9363;
- setAction(&_sequenceManager, this, 9363, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 9363, &g_globals->_player, NULL);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneState = 9362;
- setAction(&_sequenceManager, this, 9362, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 9362, &g_globals->_player, NULL);
}
_object1.setup(9351, 1, 1, 131, 90, 0);
}
@@ -712,22 +712,22 @@ Scene9400::Scene9400() {
}
void Scene9400::SceneHotspot7::doAction(int action) {
- Scene9400 *scene = (Scene9400 *)_globals->_sceneManager._scene;
+ Scene9400 *scene = (Scene9400 *)g_globals->_sceneManager._scene;
if ((action == CURSOR_USE) && (RING_INVENTORY._straw._sceneNumber != 1)) {
scene->_sceneState = 1;
RING_INVENTORY._straw._sceneNumber = 1;
- scene->setAction(&scene->_sequenceManager, scene, 9408, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 9408, &g_globals->_player, NULL);
} else {
NamedHotspot::doAction(action);
}
}
void Scene9400::SceneHotspot8::doAction(int action) {
- Scene9400 *scene = (Scene9400 *)_globals->_sceneManager._scene;
+ Scene9400 *scene = (Scene9400 *)g_globals->_sceneManager._scene;
if (action == CURSOR_TALK) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneState = 2;
scene->signal();
} else {
@@ -744,7 +744,7 @@ void Scene9400::signal() {
case 1:
_object1._numFrames = 6;
_object1.animate(ANIM_MODE_2, NULL);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 2:
_object1.animate(ANIM_MODE_5, this);
@@ -754,10 +754,10 @@ void Scene9400::signal() {
break;
case 4:
_object1.animate(ANIM_MODE_2, this);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 9350:
- _globals->_sceneManager.changeScene(9350);
+ g_globals->_sceneManager.changeScene(9350);
break;
default:
break;
@@ -774,13 +774,13 @@ void Scene9400::dispatch() {
_field1032 = 0;
}
if (_action == 0) {
- if (_globals->_player._position.y < 120) {
+ if (g_globals->_player._position.y < 120) {
_sceneState = 9350;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setAction(&_action1);
Common::Point pt(-45, 88);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
}
} else {
Scene::dispatch();
@@ -791,35 +791,35 @@ void Scene9400::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
_screenNumber = 9400;
setZoomPercents(0, 100, 200, 100);
- _globals->_player.postInit();
+ g_globals->_player.postInit();
_object1.postInit();
_object3.postInit();
_speakerQText._textPos.x = 20;
- _hotspot7.setup(157, 66, 180, 110, 9400, 21, 23);
- _hotspot5.setup(130, 133, 152, 198, 9400, 22, -1);
- _hotspot1.setup(33, 280, 69, 297, 9400, 1, 2);
- _hotspot2.setup(73, 96, 87, 159, 9400, 3, 4);
- _hotspot3.setup(89, 253, 111, 305, 9400, 5, 6);
- _hotspot4.setup(46, 0, 116, 35, 9400, 7, 8);
- _hotspot8.setup(58, 169, 122, 200, 9400, 9, 10);
- _hotspot6.setup(0, 0, 199, 319, 9400, 16, 0);
+ _hotspot7.setDetails(157, 66, 180, 110, 9400, 21, 23);
+ _hotspot5.setDetails(130, 133, 152, 198, 9400, 22, -1);
+ _hotspot1.setDetails(33, 280, 69, 297, 9400, 1, 2);
+ _hotspot2.setDetails(73, 96, 87, 159, 9400, 3, 4);
+ _hotspot3.setDetails(89, 253, 111, 305, 9400, 5, 6);
+ _hotspot4.setDetails(46, 0, 116, 35, 9400, 7, 8);
+ _hotspot8.setDetails(58, 169, 122, 200, 9400, 9, 10);
+ _hotspot6.setDetails(0, 0, 199, 319, 9400, 16, 0);
_stripManager.addSpeaker(&_speakerQText);
_stripManager.addSpeaker(&_speakerOR);
_stripManager.addSpeaker(&_speakerOText);
- _globals->_events.setCursor(CURSOR_WALK);
- _globals->_player.disableControl();
+ g_globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_player.disableControl();
- // Useless check (skipped) : if (_globals->_sceneManager._previousScene == 9350)
+ // Useless check (skipped) : if (g_globals->_sceneManager._previousScene == 9350)
_sceneState = 2;
- if (!_globals->getFlag(89)) {
- _globals->setFlag(89);
+ if (!g_globals->getFlag(89)) {
+ g_globals->setFlag(89);
_sceneState = 0;
}
- setAction(&_sequenceManager, this, 9400, &_globals->_player, &_object1, &_object3, NULL);
+ setAction(&_sequenceManager, this, 9400, &g_globals->_player, &_object1, &_object3, NULL);
}
void Scene9400::synchronize(Serializer &s) {
@@ -833,7 +833,7 @@ void Scene9400::synchronize(Serializer &s) {
*
*--------------------------------------------------------------------------*/
void Scene9450::Object2::signal() {
- Scene9450 *scene = (Scene9450 *)_globals->_sceneManager._scene;
+ Scene9450 *scene = (Scene9450 *)g_globals->_sceneManager._scene;
this->setAction(&scene->_sequenceManager3, this, 9458, this, &scene->_object1, NULL);
}
@@ -844,29 +844,29 @@ void Scene9450::Object3::dispatch() {
}
void Scene9450::Hotspot1::doAction(int action) {
- Scene9450 *scene = (Scene9450 *)_globals->_sceneManager._scene;
+ Scene9450 *scene = (Scene9450 *)g_globals->_sceneManager._scene;
if (action == CURSOR_USE) {
if (scene->_object2._action)
scene->_object2._action->remove();
scene->_sceneMode = 9459;
- _globals->_player.disableControl();
- scene->setAction(&scene->_sequenceManager1, scene, 9459, &scene->_object2, &scene->_object1, &scene->_object3, &_globals->_player, NULL);
+ g_globals->_player.disableControl();
+ scene->setAction(&scene->_sequenceManager1, scene, 9459, &scene->_object2, &scene->_object1, &scene->_object3, &g_globals->_player, NULL);
} else {
NamedHotspot::doAction(action);
}
}
void Scene9450::Hotspot3::doAction(int action) {
- Scene9450 *scene = (Scene9450 *)_globals->_sceneManager._scene;
+ Scene9450 *scene = (Scene9450 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_CLOAK:
case OBJECT_JACKET:
case OBJECT_TUNIC2:
scene->_sceneMode = 9460;
- _globals->_player.disableControl();
- scene->setAction(&scene->_sequenceManager1, scene, 9460, &_globals->_player, &scene->_object2, &scene->_object1, NULL);
+ g_globals->_player.disableControl();
+ scene->setAction(&scene->_sequenceManager1, scene, 9460, &g_globals->_player, &scene->_object2, &scene->_object1, NULL);
break;
case OBJECT_TUNIC:
SceneItem::display(9450, 49, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
@@ -883,14 +883,14 @@ void Scene9450::Hotspot3::doAction(int action) {
if (scene->_object2._action)
scene->_object2._action->remove();
scene->_sceneMode = 9459;
- _globals->_player.disableControl();
- scene->setAction(&scene->_sequenceManager1, scene, 9459, &scene->_object2, &scene->_object1, &scene->_object3, &_globals->_player, NULL);
+ g_globals->_player.disableControl();
+ scene->setAction(&scene->_sequenceManager1, scene, 9459, &scene->_object2, &scene->_object1, &scene->_object3, &g_globals->_player, NULL);
} else if ((RING_INVENTORY._cloak._sceneNumber != 1) && (RING_INVENTORY._jacket._sceneNumber != 1) && (RING_INVENTORY._tunic2._sceneNumber != 1)) {
SceneItem::display(9450, 38, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
} else {
scene->_sceneMode = 9460;
- _globals->_player.disableControl();
- scene->setAction(&scene->_sequenceManager1, scene, 9460, &_globals->_player, &scene->_object2, &scene->_object1, NULL);
+ g_globals->_player.disableControl();
+ scene->setAction(&scene->_sequenceManager1, scene, 9460, &g_globals->_player, &scene->_object2, &scene->_object1, NULL);
}
break;
default:
@@ -911,8 +911,8 @@ void Scene9450::signal() {
setAction(&_sequenceManager1, this, 9457, &_object2, &_object1, &_object3, NULL);
break;
case 9451:
- if (_globals->getFlag(87)) {
- _globals->_player.enableControl();
+ if (g_globals->getFlag(87)) {
+ g_globals->_player.enableControl();
} else {
_sceneMode = 1001;
if (_object2._action)
@@ -927,20 +927,20 @@ void Scene9450::signal() {
setAction(&_sequenceManager1, this, 9455, &_object2, &_object1, &_object3, NULL);
break;
case 9453:
- _globals->_sceneManager.changeScene(9360);
+ g_globals->_sceneManager.changeScene(9360);
break;
case 9459:
RING_INVENTORY._tunic._sceneNumber = 1;
_object2.signal();
- _globals->_player.enableControl();
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_player.enableControl();
+ g_globals->_events.setCursor(CURSOR_WALK);
_hotspot1.remove();
break;
case 1006:
- _globals->setFlag(87);
+ g_globals->setFlag(87);
// No break on purpose
default:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
}
}
@@ -949,14 +949,14 @@ void Scene9450::dispatch() {
if (_action) {
_action->dispatch();
} else {
- if ((_globals->_player._position.y < 98) && (_globals->_player._position.x > 241) && (_globals->_player._position.x < 282)) {
- _globals->_player.disableControl();
+ if ((g_globals->_player._position.y < 98) && (g_globals->_player._position.x > 241) && (g_globals->_player._position.x < 282)) {
+ g_globals->_player.disableControl();
_sceneMode = 9452;
- setAction(&_sequenceManager1, this, 9452, &_globals->_player, NULL);
- } else if ((_globals->_player._position.y < 99) && (_globals->_player._position.x > 68) && (_globals->_player._position.x < 103)) {
- _globals->_player.disableControl();
+ setAction(&_sequenceManager1, this, 9452, &g_globals->_player, NULL);
+ } else if ((g_globals->_player._position.y < 99) && (g_globals->_player._position.x > 68) && (g_globals->_player._position.x < 103)) {
+ g_globals->_player.disableControl();
_sceneMode = 9453;
- setAction(&_sequenceManager1, this, 9453, &_globals->_player, NULL);
+ setAction(&_sequenceManager1, this, 9453, &g_globals->_player, NULL);
}
}
}
@@ -964,18 +964,18 @@ void Scene9450::dispatch() {
void Scene9450::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(84, 75, 167, 150);
- _globals->_events.setCursor(CURSOR_WALK);
- _globals->_player.postInit();
+ g_globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_player.postInit();
_object2.postInit();
_object1.postInit();
_object1.hide();
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9451;
- setAction(&_sequenceManager1, this, 9451, &_globals->_player, NULL);
+ setAction(&_sequenceManager1, this, 9451, &g_globals->_player, NULL);
- if (_globals->getFlag(87)) {
+ if (g_globals->getFlag(87)) {
if (RING_INVENTORY._tunic._sceneNumber == 1) {
_object2.signal();
} else {
@@ -992,23 +992,23 @@ void Scene9450::postInit(SceneObjectList *OwnerList) {
}
if (RING_INVENTORY._tunic._sceneNumber != 1)
- _hotspot1.setup(123, 139, 138, 170, 9450, 37, -1);
-
- _hotspot2.setup(153, 102, 176, 141, 9450, 39, 40);
- _hotspot3.setup(97, 198, 130, 229, 9450, 41, 42);
- _hotspot15.setup(131, 190, 145, 212, 9450, 43, 44);
- _hotspot4.setup(33, 144, 105, 192, 9450, 0, 1);
- _hotspot5.setup(20, 236, 106, 287, 9450, 2, 3);
- _hotspot6.setup(137, 119, 195, 320, 9450, 4, 5);
- _hotspot7.setup(20, 59, 99, 111, 9450, 6, -1);
- _hotspot8.setup(110, 0, 199, 117, 9450, 7, 8);
- _hotspot9.setup(101, 104, 130, 174, 9450, 9, 10);
- _hotspot10.setup(110, 246, 149, 319, 9450, 11, 12);
- _hotspot11.setup(16, 34, 74, 62, 6450, 13, 14);
- _hotspot12.setup(19, 108, 72, 134, 9450, 15, 16);
- _hotspot13.setup(18, 215, 71, 237, 9450, 17, 18);
- _hotspot14.setup(15, 288, 76, 314, 9450, 19, 20);
- _hotspot16.setup(0, 0, 200, 320, 9450, 46, -1);
+ _hotspot1.setDetails(123, 139, 138, 170, 9450, 37, -1);
+
+ _hotspot2.setDetails(153, 102, 176, 141, 9450, 39, 40);
+ _hotspot3.setDetails(97, 198, 130, 229, 9450, 41, 42);
+ _hotspot15.setDetails(131, 190, 145, 212, 9450, 43, 44);
+ _hotspot4.setDetails(33, 144, 105, 192, 9450, 0, 1);
+ _hotspot5.setDetails(20, 236, 106, 287, 9450, 2, 3);
+ _hotspot6.setDetails(137, 119, 195, 320, 9450, 4, 5);
+ _hotspot7.setDetails(20, 59, 99, 111, 9450, 6, -1);
+ _hotspot8.setDetails(110, 0, 199, 117, 9450, 7, 8);
+ _hotspot9.setDetails(101, 104, 130, 174, 9450, 9, 10);
+ _hotspot10.setDetails(110, 246, 149, 319, 9450, 11, 12);
+ _hotspot11.setDetails(16, 34, 74, 62, 6450, 13, 14);
+ _hotspot12.setDetails(19, 108, 72, 134, 9450, 15, 16);
+ _hotspot13.setDetails(18, 215, 71, 237, 9450, 17, 18);
+ _hotspot14.setDetails(15, 288, 76, 314, 9450, 19, 20);
+ _hotspot16.setDetails(0, 0, 200, 320, 9450, 46, -1);
}
/*--------------------------------------------------------------------------
@@ -1016,67 +1016,67 @@ void Scene9450::postInit(SceneObjectList *OwnerList) {
*
*--------------------------------------------------------------------------*/
void Scene9500::Hotspot1::doAction(int action) {
- Scene9500 *scene = (Scene9500 *)_globals->_sceneManager._scene;
+ Scene9500 *scene = (Scene9500 *)g_globals->_sceneManager._scene;
if (action == OBJECT_SWORD) {
scene->_sceneMode = 9510;
- _globals->setFlag(92);
+ g_globals->setFlag(92);
RING_INVENTORY._sword._sceneNumber = 9500;
- _globals->_player.disableControl();
- _globals->_sceneItems.remove(this);
- scene->_hotspot2.setup(87, 294, 104, 314, 9400, 17, -1);
- scene->setAction(&scene->_sequenceManager, scene, 9510, &_globals->_player, &scene->_object2, NULL);
+ g_globals->_player.disableControl();
+ g_globals->_sceneItems.remove(this);
+ scene->_hotspot2.setDetails(87, 294, 104, 314, 9400, 17, -1);
+ scene->setAction(&scene->_sequenceManager, scene, 9510, &g_globals->_player, &scene->_object2, NULL);
} else {
NamedHotspot::doAction(action);
}
}
void Scene9500::Hotspot2::doAction(int action) {
- Scene9500 *scene = (Scene9500 *)_globals->_sceneManager._scene;
+ Scene9500 *scene = (Scene9500 *)g_globals->_sceneManager._scene;
if (action == CURSOR_USE) {
scene->_sceneMode = 9511;
- _globals->_player.disableControl();
- _globals->_sceneItems.remove(this);
- scene->setAction(&scene->_sequenceManager, scene, 9511, &_globals->_player, &scene->_object2, NULL);
+ g_globals->_player.disableControl();
+ g_globals->_sceneItems.remove(this);
+ scene->setAction(&scene->_sequenceManager, scene, 9511, &g_globals->_player, &scene->_object2, NULL);
} else {
NamedHotspot::doAction(action);
}
}
void Scene9500::Hotspot3::doAction(int action) {
- Scene9500 *scene = (Scene9500 *)_globals->_sceneManager._scene;
+ Scene9500 *scene = (Scene9500 *)g_globals->_sceneManager._scene;
if ((action == CURSOR_USE) && (RING_INVENTORY._candle._sceneNumber != 1)){
scene->_sceneMode = 9505;
- _globals->_player.disableControl();
- _globals->_sceneItems.remove(this);
- scene->setAction(&scene->_sequenceManager, scene, 9505, &_globals->_player, &scene->_candle, NULL);
+ g_globals->_player.disableControl();
+ g_globals->_sceneItems.remove(this);
+ scene->setAction(&scene->_sequenceManager, scene, 9505, &g_globals->_player, &scene->_candle, NULL);
} else {
NamedHotspot::doAction(action);
}
}
void Scene9500::Hotspot4::doAction(int action) {
- Scene9500 *scene = (Scene9500 *)_globals->_sceneManager._scene;
+ Scene9500 *scene = (Scene9500 *)g_globals->_sceneManager._scene;
if (action == OBJECT_CANDLE) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
if (RING_INVENTORY._straw._sceneNumber == 9500) {
scene->_sceneMode = 9506;
- _globals->_sceneItems.remove(&scene->_hotspot5);
- _globals->_sceneItems.remove(this);
- scene->setAction(&scene->_sequenceManager, scene, 9506, &_globals->_player, &scene->_object3, NULL);
+ g_globals->_sceneItems.remove(&scene->_hotspot5);
+ g_globals->_sceneItems.remove(this);
+ scene->setAction(&scene->_sequenceManager, scene, 9506, &g_globals->_player, &scene->_object3, NULL);
RING_INVENTORY._candle._sceneNumber = 9850;
} else {
scene->_sceneMode = 9507;
- scene->setAction(&scene->_sequenceManager, scene, 9507, &_globals->_player, &scene->_object3, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 9507, &g_globals->_player, &scene->_object3, NULL);
}
} else if (action == OBJECT_STRAW) {
scene->_sceneMode = 9512;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
RING_INVENTORY._straw._sceneNumber = 9500;
- scene->setAction(&scene->_sequenceManager, scene, 9512, &_globals->_player, &scene->_object3, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 9512, &g_globals->_player, &scene->_object3, NULL);
} else {
NamedHotspot::doAction(action);
}
@@ -1085,35 +1085,35 @@ void Scene9500::Hotspot4::doAction(int action) {
void Scene9500::signal() {
switch (_sceneMode) {
case 9503:
- _globals->_sceneManager.changeScene(9200);
- _globals->_soundHandler.play(295);
+ g_globals->_sceneManager.changeScene(9200);
+ g_globals->_soundHandler.play(295);
break;
case 9504:
- _globals->_sceneManager.changeScene(9850);
+ g_globals->_sceneManager.changeScene(9850);
break;
case 9505:
_candle.setStrip(2);
RING_INVENTORY._candle._sceneNumber = 1;
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 9506:
- _globals->setFlag(85);
- _globals->_player.enableControl();
+ g_globals->setFlag(85);
+ g_globals->_player.enableControl();
break;
case 9511:
RING_INVENTORY._helmet._sceneNumber = 1;
- _globals->_player.enableControl();
- if (!_globals->getFlag(51)) {
- _globals->setFlag(51);
- _globals->_player.disableControl();
+ g_globals->_player.enableControl();
+ if (!g_globals->getFlag(51)) {
+ g_globals->setFlag(51);
+ g_globals->_player.disableControl();
_sceneMode = 9514;
- setAction(&_sequenceManager, this, 9514, &_globals->_player, NULL, NULL, NULL, NULL);
+ setAction(&_sequenceManager, this, 9514, &g_globals->_player, NULL, NULL, NULL, NULL);
}
break;
case 0:
case 9514:
default:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
}
}
@@ -1122,14 +1122,14 @@ void Scene9500::dispatch() {
if (_action) {
_action->dispatch();
} else {
- if (_globals->_player._position.y >= 199) {
- _globals->_player.disableControl();
+ if (g_globals->_player._position.y >= 199) {
+ g_globals->_player.disableControl();
_sceneMode = 9503;
- setAction(&_sequenceManager, this, 9503, &_globals->_player, NULL, NULL, NULL, NULL);
- } else if (_globals->_player._position.y < 127) {
- _globals->_player.disableControl();
+ setAction(&_sequenceManager, this, 9503, &g_globals->_player, NULL, NULL, NULL, NULL);
+ } else if (g_globals->_player._position.y < 127) {
+ g_globals->_player.disableControl();
_sceneMode = 9504;
- setAction(&_sequenceManager, this, 9504, &_globals->_player, NULL, NULL, NULL, NULL);
+ setAction(&_sequenceManager, this, 9504, &g_globals->_player, NULL, NULL, NULL, NULL);
}
}
@@ -1143,8 +1143,8 @@ void Scene9500::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(110, 75, 200, 150);
- _globals->_player.postInit();
- _globals->_soundHandler.play(305);
+ g_globals->_player.postInit();
+ g_globals->_soundHandler.play(305);
_candle.postInit();
_candle.setVisage(9500);
@@ -1164,7 +1164,7 @@ void Scene9500::postInit(SceneObjectList *OwnerList) {
_object3._strip = 2;
_object3._frame = 9;
_object3.setPosition(Common::Point(168, 128));
- if (_globals->getFlag(85)) {
+ if (g_globals->getFlag(85)) {
_object3.setVisage(9500);
_object3.setStrip(4);
_object3.animate(ANIM_MODE_8, 0, NULL);
@@ -1174,7 +1174,7 @@ void Scene9500::postInit(SceneObjectList *OwnerList) {
_object2.postInit();
_object2.hide();
- if (_globals->getFlag(92)) {
+ if (g_globals->getFlag(92)) {
_object2.show();
_object2.setVisage(9501);
_object2.setStrip(1);
@@ -1182,53 +1182,53 @@ void Scene9500::postInit(SceneObjectList *OwnerList) {
_object2.setPosition(Common::Point(303, 130));
_object2.fixPriority(132);
if (RING_INVENTORY._helmet._sceneNumber == 1) {
- _hotspot2.setup(87, 294, 104, 314, 9400, 17, -1);
+ _hotspot2.setDetails(87, 294, 104, 314, 9400, 17, -1);
} else {
_object2.setStrip(2);
_object2.setFrame(1);
}
} else {
- _hotspot1.setup(105, 295, 134, 313, 9500, 9, 10);
+ _hotspot1.setDetails(105, 295, 134, 313, 9500, 9, 10);
}
- _hotspot17.setup(101, 293, 135, 315, 9500, 9, 10);
- _hotspot3.setup(84, 12, 107, 47, 9500, 15, 15);
- _hotspot6.setup(93, 11, 167, 46, 9500, 0, 1);
- _hotspot7.setup(100, 70, 125, 139, 9500, 2, 3);
+ _hotspot17.setDetails(101, 293, 135, 315, 9500, 9, 10);
+ _hotspot3.setDetails(84, 12, 107, 47, 9500, 15, 15);
+ _hotspot6.setDetails(93, 11, 167, 46, 9500, 0, 1);
+ _hotspot7.setDetails(100, 70, 125, 139, 9500, 2, 3);
- if (!_globals->getFlag(85)) {
- _hotspot5.setup(111, 68, 155, 244, 9500, 17, -1);
- _hotspot4.setup(57, 71, 120, 126, 9500, 16, -1);
+ if (!g_globals->getFlag(85)) {
+ _hotspot5.setDetails(111, 68, 155, 244, 9500, 17, -1);
+ _hotspot4.setDetails(57, 71, 120, 126, 9500, 16, -1);
}
- _hotspot8.setup(60, 24, 90, 53, 9500, 4, 5);
- _hotspot9.setup(72, 143, 93, 163, 9500, 4, 5);
- _hotspot10.setup(70, 205, 92, 228, 9500, 4, 5);
- _hotspot11.setup(66, 291, 90, 317, 9500, 4, 5);
- _hotspot12.setup(22, 58, 101, 145, 9500, 6, 7);
- _hotspot13.setup(121, 57, 163, 249, 9500, 6, 7);
- _hotspot14.setup(115, 133, 135, 252, 9500, 6, 7);
- _hotspot15.setup(55, 240, 125, 254, 9500, 6, 7);
- _hotspot16.setup(53, 251, 132, 288, 9500, 8, -1);
- _hotspot19.setup(101, 207, 120, 225, 9500, 9, 10);
- _hotspot18.setup(98, 144, 117, 162, 9500, 9, 10);
- _hotspot20.setup(102, 27, 132, 50, 9500, 9, 10);
+ _hotspot8.setDetails(60, 24, 90, 53, 9500, 4, 5);
+ _hotspot9.setDetails(72, 143, 93, 163, 9500, 4, 5);
+ _hotspot10.setDetails(70, 205, 92, 228, 9500, 4, 5);
+ _hotspot11.setDetails(66, 291, 90, 317, 9500, 4, 5);
+ _hotspot12.setDetails(22, 58, 101, 145, 9500, 6, 7);
+ _hotspot13.setDetails(121, 57, 163, 249, 9500, 6, 7);
+ _hotspot14.setDetails(115, 133, 135, 252, 9500, 6, 7);
+ _hotspot15.setDetails(55, 240, 125, 254, 9500, 6, 7);
+ _hotspot16.setDetails(53, 251, 132, 288, 9500, 8, -1);
+ _hotspot19.setDetails(101, 207, 120, 225, 9500, 9, 10);
+ _hotspot18.setDetails(98, 144, 117, 162, 9500, 9, 10);
+ _hotspot20.setDetails(102, 27, 132, 50, 9500, 9, 10);
- _globals->_events.setCursor(CURSOR_WALK);
- _globals->_player.disableControl();
+ g_globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_player.disableControl();
- if ((_globals->_sceneManager._previousScene == 9200) || (_globals->_sceneManager._previousScene != 9850)) {
+ if ((g_globals->_sceneManager._previousScene == 9200) || (g_globals->_sceneManager._previousScene != 9850)) {
_sceneMode = 0;
if (RING_INVENTORY._helmet._sceneNumber != 1) {
- setAction(&_sequenceManager, this, 9501, &_globals->_player, &_candle, NULL);
+ setAction(&_sequenceManager, this, 9501, &g_globals->_player, &_candle, NULL);
} else {
RING_INVENTORY._helmet._sceneNumber = 9500;
- _hotspot2.setup(87, 294, 104, 314, 9400, 17, -1);
- setAction(&_sequenceManager, this, 9513, &_globals->_player, &_object2, NULL);
+ _hotspot2.setDetails(87, 294, 104, 314, 9400, 17, -1);
+ setAction(&_sequenceManager, this, 9513, &g_globals->_player, &_object2, NULL);
}
} else {
_sceneMode = 0;
- setAction(&_sequenceManager, this, 9502, &_globals->_player, &_candle, NULL);
+ setAction(&_sequenceManager, this, 9502, &g_globals->_player, &_candle, NULL);
}
}
@@ -1239,7 +1239,7 @@ void Scene9500::postInit(SceneObjectList *OwnerList) {
void Scene9700::signal() {
switch (_sceneMode ++) {
case 9703:
- _globals->setFlag(88);
+ g_globals->setFlag(88);
// No break on purpose
case 9701:
case 9702:
@@ -1247,13 +1247,13 @@ void Scene9700::signal() {
_gfxButton1._bounds.center(50, 190);
_gfxButton1.draw();
_gfxButton1._bounds.expandPanes();
- _globals->_player.enableControl();
- _globals->_player._canWalk = false;
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_player.enableControl();
+ g_globals->_player._canWalk = false;
+ g_globals->_events.setCursor(CURSOR_USE);
break;
case 9704:
- _globals->_soundHandler.play(323);
- _globals->_sceneManager.changeScene(9750);
+ g_globals->_soundHandler.play(323);
+ g_globals->_sceneManager.changeScene(9750);
break;
}
}
@@ -1262,17 +1262,17 @@ void Scene9700::process(Event &event) {
Scene::process(event);
if ((event.eventType == EVENT_BUTTON_DOWN) && !_action) {
if (_gfxButton1.process(event)) {
- _globals->_sceneManager.changeScene(9200);
- } else if (_globals->_events._currentCursor == OBJECT_SCANNER) {
+ g_globals->_sceneManager.changeScene(9200);
+ } else if (g_globals->_events._currentCursor == OBJECT_SCANNER) {
event.handled = true;
if (RING_INVENTORY._helmet._sceneNumber == 1) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9704;
- setAction(&_sequenceManager, this, 9704, &_globals->_player, &_object1, NULL);
+ setAction(&_sequenceManager, this, 9704, &g_globals->_player, &_object1, NULL);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9703;
- setAction(&_sequenceManager, this, 9703, &_globals->_player, &_object1, NULL);
+ setAction(&_sequenceManager, this, 9703, &g_globals->_player, &_object1, NULL);
}
}
}
@@ -1282,25 +1282,25 @@ void Scene9700::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(0, 100, 200, 100);
- _sceneHotspot1.setup(84, 218, 151, 278, 9700, 14, -1);
- _sceneHotspot2.setup(89, 11, 151, 121, 9700, 14, -1);
- _sceneHotspot3.setup(69, 119, 138, 216, 9700, 15, 16);
- _sceneHotspot4.setup(34, 13, 88, 116, 9700, 17, -1);
- _sceneHotspot5.setup(52, 119, 68, 204, 9700, 17, -1);
- _sceneHotspot6.setup(0, 22, 56, 275, 9700, 18, -1);
+ _sceneHotspot1.setDetails(84, 218, 151, 278, 9700, 14, -1);
+ _sceneHotspot2.setDetails(89, 11, 151, 121, 9700, 14, -1);
+ _sceneHotspot3.setDetails(69, 119, 138, 216, 9700, 15, 16);
+ _sceneHotspot4.setDetails(34, 13, 88, 116, 9700, 17, -1);
+ _sceneHotspot5.setDetails(52, 119, 68, 204, 9700, 17, -1);
+ _sceneHotspot6.setDetails(0, 22, 56, 275, 9700, 18, -1);
_object1.postInit();
_object1.hide();
- _globals->_player.postInit();
- if (!_globals->getFlag(97)) {
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ if (!g_globals->getFlag(97)) {
+ g_globals->_player.disableControl();
_sceneMode = 9701;
- setAction(&_sequenceManager, this, 9701, &_globals->_player, &_object1, NULL);
- _globals->setFlag(97);
+ setAction(&_sequenceManager, this, 9701, &g_globals->_player, &_object1, NULL);
+ g_globals->setFlag(97);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9702;
- setAction(&_sequenceManager, this, 9702, &_globals->_player, &_object1, NULL);
+ setAction(&_sequenceManager, this, 9702, &g_globals->_player, &_object1, NULL);
}
}
@@ -1311,10 +1311,10 @@ void Scene9700::postInit(SceneObjectList *OwnerList) {
void Scene9750::signal() {
switch (_sceneMode ++) {
case 9751:
- _globals->_soundHandler.fadeOut(this);
+ g_globals->_soundHandler.fadeOut(this);
break;
case 9752:
- _globals->_sceneManager.changeScene(2100);
+ g_globals->_sceneManager.changeScene(2100);
default:
break;
}
@@ -1329,14 +1329,14 @@ void Scene9750::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(0, 100, 200, 100);
- _globals->_player.postInit();
+ g_globals->_player.postInit();
_object1.postInit();
_object1.hide();
_object2.postInit();
_object2.hide();
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9751;
- setAction(&_sequenceManager, this, 9751, &_globals->_player, &_object1, &_object2, NULL);
+ setAction(&_sequenceManager, this, 9751, &g_globals->_player, &_object1, &_object2, NULL);
}
@@ -1371,19 +1371,19 @@ void Scene9850::Object7::doAction(int action) {
// Hair covered tunic
void Scene9850::Hotspot12::doAction(int action) {
- Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene;
+ Scene9850 *scene = (Scene9850 *)g_globals->_sceneManager._scene;
if (action == CURSOR_USE) {
if (RING_INVENTORY._tunic2._sceneNumber != 1) {
RING_INVENTORY._tunic2._sceneNumber = 1;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 9858;
- scene->setAction(&scene->_sequenceManager, scene, 9858, &_globals->_player, &scene->_objTunic2, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 9858, &g_globals->_player, &scene->_objTunic2, NULL);
} else {
RING_INVENTORY._tunic2._sceneNumber = 9850;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 9861;
- scene->setAction(&scene->_sequenceManager, scene, 9861, &_globals->_player, &scene->_objTunic2, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 9861, &g_globals->_player, &scene->_objTunic2, NULL);
}
} else if ((action != CURSOR_LOOK) || (RING_INVENTORY._tunic2._sceneNumber != 1)) {
NamedHotspot::doAction(action);
@@ -1393,19 +1393,19 @@ void Scene9850::Hotspot12::doAction(int action) {
}
void Scene9850::Hotspot14::doAction(int action) {
- Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene;
+ Scene9850 *scene = (Scene9850 *)g_globals->_sceneManager._scene;
if (action == CURSOR_USE) {
if (RING_INVENTORY._jacket._sceneNumber != 1) {
RING_INVENTORY._jacket._sceneNumber = 1;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 9857;
- scene->setAction(&scene->_sequenceManager, scene, 9857, &_globals->_player, &scene->_objJacket, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 9857, &g_globals->_player, &scene->_objJacket, NULL);
} else {
RING_INVENTORY._jacket._sceneNumber = 9850;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 9860;
- scene->setAction(&scene->_sequenceManager, scene, 9860, &_globals->_player, &scene->_objJacket, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 9860, &g_globals->_player, &scene->_objJacket, NULL);
}
} else if ((action != CURSOR_LOOK) || (RING_INVENTORY._jacket._sceneNumber != 1)) {
NamedHotspot::doAction(action);
@@ -1415,19 +1415,19 @@ void Scene9850::Hotspot14::doAction(int action) {
}
void Scene9850::Hotspot16::doAction(int action) {
- Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene;
+ Scene9850 *scene = (Scene9850 *)g_globals->_sceneManager._scene;
if (action == CURSOR_USE) {
if (RING_INVENTORY._cloak._sceneNumber != 1) {
RING_INVENTORY._cloak._sceneNumber = 1;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 9862;
- scene->setAction(&scene->_sequenceManager, scene, 9862, &_globals->_player, &scene->_objCloak, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 9862, &g_globals->_player, &scene->_objCloak, NULL);
} else {
RING_INVENTORY._cloak._sceneNumber = 9850;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 9859;
- scene->setAction(&scene->_sequenceManager, scene, 9859, &_globals->_player, &scene->_objCloak, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 9859, &g_globals->_player, &scene->_objCloak, NULL);
}
} else if ((action != CURSOR_LOOK) || (RING_INVENTORY._cloak._sceneNumber != 1)) {
NamedHotspot::doAction(action);
@@ -1437,7 +1437,7 @@ void Scene9850::Hotspot16::doAction(int action) {
}
void Scene9850::Hotspot17::doAction(int action) {
- Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene;
+ Scene9850 *scene = (Scene9850 *)g_globals->_sceneManager._scene;
if (action == OBJECT_SCANNER) {
SceneItem::display(9850, 32, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
@@ -1449,7 +1449,7 @@ void Scene9850::Hotspot17::doAction(int action) {
}
void Scene9850::Hotspot18::doAction(int action) {
- Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene;
+ Scene9850 *scene = (Scene9850 *)g_globals->_sceneManager._scene;
if (action == OBJECT_SCANNER) {
SceneItem::display(9850, 32, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
@@ -1461,7 +1461,7 @@ void Scene9850::Hotspot18::doAction(int action) {
}
void Scene9850::Hotspot19::doAction(int action) {
- Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene;
+ Scene9850 *scene = (Scene9850 *)g_globals->_sceneManager._scene;
if (action == OBJECT_SCANNER) {
SceneItem::display(9850, 31, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOR, 7, LIST_END);
@@ -1474,20 +1474,20 @@ void Scene9850::Hotspot19::doAction(int action) {
// Arrow on Statue
void Scene9850::Hotspot20::doAction(int action) {
- Scene9850 *scene = (Scene9850 *)_globals->_sceneManager._scene;
+ Scene9850 *scene = (Scene9850 *)g_globals->_sceneManager._scene;
if (action == CURSOR_USE) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
if (scene->_objSword._state == 0) {
if (RING_INVENTORY._scimitar._sceneNumber == 9850)
scene->_objScimitar.show();
if (RING_INVENTORY._sword._sceneNumber == 9850)
scene->_objSword.show();
scene->_sceneMode = 11;
- setAction(&scene->_sequenceManager, scene, 9853, &_globals->_player, &scene->_objDoor, &scene->_objLever, NULL);
+ setAction(&scene->_sequenceManager, scene, 9853, &g_globals->_player, &scene->_objDoor, &scene->_objLever, NULL);
} else {
scene->_sceneMode = 10;
- setAction(&scene->_sequenceManager, scene, 9854, &_globals->_player, &scene->_objDoor, &scene->_objLever, NULL);
+ setAction(&scene->_sequenceManager, scene, 9854, &g_globals->_player, &scene->_objDoor, &scene->_objLever, NULL);
}
scene->_objSword._state ^= 1;
} else {
@@ -1503,26 +1503,26 @@ void Scene9850::signal() {
_objScimitar.hide();
if (RING_INVENTORY._sword._sceneNumber == 9850)
_objSword.hide();
- _globals->_sceneItems.remove(&_objScimitar);
- _globals->_sceneItems.remove(&_objSword);
- _globals->_sceneItems.addItems(&_hotspot19, NULL);
- _globals->_player.enableControl();
+ g_globals->_sceneItems.remove(&_objScimitar);
+ g_globals->_sceneItems.remove(&_objSword);
+ g_globals->_sceneItems.addItems(&_hotspot19, NULL);
+ g_globals->_player.enableControl();
break;
case 11:
// Hidden closet opened
if (RING_INVENTORY._scimitar._sceneNumber == 9850)
- _globals->_sceneItems.addItems(&_objScimitar, NULL);
+ g_globals->_sceneItems.addItems(&_objScimitar, NULL);
if (RING_INVENTORY._sword._sceneNumber == 9850)
- _globals->_sceneItems.addItems(&_objSword, NULL);
- _globals->_sceneItems.remove(&_hotspot19);
- _globals->_player.enableControl();
+ g_globals->_sceneItems.addItems(&_objSword, NULL);
+ g_globals->_sceneItems.remove(&_hotspot19);
+ g_globals->_player.enableControl();
break;
case 9500:
- _globals->_sceneManager.changeScene(_sceneMode - 1);
+ g_globals->_sceneManager.changeScene(_sceneMode - 1);
break;
case 0:
default:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
}
}
@@ -1531,7 +1531,7 @@ void Scene9850::process(Event &event) {
Scene::process(event);
if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_4)) {
event.handled = true;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
if (_objSword._state == 0) {
_sceneMode = 0;
setAction(&_sequenceManager, this, 9853, &_objLever, &_objDoor, &_objScimitar, &_objSword, NULL);
@@ -1546,10 +1546,10 @@ void Scene9850::process(Event &event) {
void Scene9850::dispatch() {
if (_action) {
_action->dispatch();
- } else if (_globals->_player._position.y >= 198) {
- _globals->_player.disableControl();
+ } else if (g_globals->_player._position.y >= 198) {
+ g_globals->_player.disableControl();
_sceneMode = 9500;
- setAction(&_sequenceManager, this, 9852, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 9852, &g_globals->_player, NULL);
}
}
@@ -1617,31 +1617,31 @@ void Scene9850::postInit(SceneObjectList *OwnerList) {
_objSword.hide();
}
- _spotLever.setup(30, 251, 45, 270, 9850, 26, -1);
- _hotspot1.setup(123, 0, 200, 320, 9850, 0, 1);
- _hotspot2.setup(107, 87, 133, 308, 9850, 0, 1);
- _hotspot3.setup(2, 28, 53, 80, 9850, 2, 3);
- _hotspot4.setup(13, 0, 55, 27, 9850, 2, 3);
- _hotspot5.setup(8, 74, 27, 91, 9850, 4, 5);
- _hotspot17.setup(61, 0, 125, 28, 9850, 6, 7);
- _hotspot18.setup(51, 95, 105, 145, 9850, 6, 7);
- _hotspot19.setup(56, 28, 115, 97, 9850, 6, 8);
- _hotspot6.setup(0, 223, 115, 257, 9850, 9, 10);
- _hotspot7.setup(15, 254, 33, 268, 9850, 9, -1);
- _hotspot8.setup(17, 218, 37, 233, 9850, 9, 10);
- _hotspot9.setup(8, 113, 26, 221, 9850, 11, 12);
- _hotspot10.setup(14, 94, 53, 112, 9850, 13, 14);
- _hotspot11.setup(5, 269, 29, 303, 9850, 15, 16);
- _hotspot12.setup(43, 278, 91, 317, 9850, 17, 18);
- _hotspot13.setup(47, 263, 112, 282, 9850, 19, 20);
- _hotspot14.setup(43, 188, 86, 224, 9850, 21, 22);
- _hotspot15.setup(43, 162, 92, 191, 9850, 23, 24);
- _hotspot16.setup(40, 146, 90, 169, 9850, 25, -1);
-
- _globals->_player.postInit();
- _globals->_player.disableControl();
+ _spotLever.setDetails(30, 251, 45, 270, 9850, 26, -1);
+ _hotspot1.setDetails(123, 0, 200, 320, 9850, 0, 1);
+ _hotspot2.setDetails(107, 87, 133, 308, 9850, 0, 1);
+ _hotspot3.setDetails(2, 28, 53, 80, 9850, 2, 3);
+ _hotspot4.setDetails(13, 0, 55, 27, 9850, 2, 3);
+ _hotspot5.setDetails(8, 74, 27, 91, 9850, 4, 5);
+ _hotspot17.setDetails(61, 0, 125, 28, 9850, 6, 7);
+ _hotspot18.setDetails(51, 95, 105, 145, 9850, 6, 7);
+ _hotspot19.setDetails(56, 28, 115, 97, 9850, 6, 8);
+ _hotspot6.setDetails(0, 223, 115, 257, 9850, 9, 10);
+ _hotspot7.setDetails(15, 254, 33, 268, 9850, 9, -1);
+ _hotspot8.setDetails(17, 218, 37, 233, 9850, 9, 10);
+ _hotspot9.setDetails(8, 113, 26, 221, 9850, 11, 12);
+ _hotspot10.setDetails(14, 94, 53, 112, 9850, 13, 14);
+ _hotspot11.setDetails(5, 269, 29, 303, 9850, 15, 16);
+ _hotspot12.setDetails(43, 278, 91, 317, 9850, 17, 18);
+ _hotspot13.setDetails(47, 263, 112, 282, 9850, 19, 20);
+ _hotspot14.setDetails(43, 188, 86, 224, 9850, 21, 22);
+ _hotspot15.setDetails(43, 162, 92, 191, 9850, 23, 24);
+ _hotspot16.setDetails(40, 146, 90, 169, 9850, 25, -1);
+
+ g_globals->_player.postInit();
+ g_globals->_player.disableControl();
_sceneMode = 0;
- setAction(&_sequenceManager, this, 9851, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 9851, &g_globals->_player, NULL);
}
/*--------------------------------------------------------------------------
@@ -1652,7 +1652,7 @@ void Scene9900::strAction1::signal() {
const byte mask1[3] = {0xff, 0xff, 0xff};
const byte mask2[3] = {0, 0, 0};
- Scene9900 *scene = (Scene9900 *)_globals->_sceneManager._scene;
+ Scene9900 *scene = (Scene9900 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -1664,23 +1664,23 @@ void Scene9900::strAction1::signal() {
_object9.fixPriority(250);
_object9.setPosition(Common::Point(171, 59));
_object9.animate(ANIM_MODE_5, NULL);
- _globals->_scenePalette.addRotation(67, 111, 1, 1, this);
+ g_globals->_scenePalette.addRotation(67, 111, 1, 1, this);
scene->_object2.hide();
break;
case 1:
_palette1.getPalette();
- _globals->_scenePalette.addFader(&mask1[0], 1, 10, this);
+ g_globals->_scenePalette.addFader(&mask1[0], 1, 10, this);
break;
case 2:
_object9.remove();
- _globals->_scenePalette.addFader(&mask2[0], 1, 5, this);
+ g_globals->_scenePalette.addFader(&mask2[0], 1, 5, this);
break;
case 3:
- _globals->_soundHandler.play(377);
+ g_globals->_soundHandler.play(377);
setDelay(120);
break;
case 4:
- _globals->_scenePalette.addFader(_palette1._palette, 256, 1, this);
+ g_globals->_scenePalette.addFader(_palette1._palette, 256, 1, this);
break;
case 5:
remove();
@@ -1702,7 +1702,7 @@ void Scene9900::strAction2::signal() {
_var3 = 0;
// No break on purpose
case 1: {
- Common::String msg = _resourceManager->getMessage(8030, _lineNum++);
+ Common::String msg = g_resourceManager->getMessage(8030, _lineNum++);
if (msg.compareTo("LASTCREDIT")) {
if (_var3) {
// Not used?
@@ -1740,7 +1740,7 @@ void Scene9900::strAction2::signal() {
_txtArray2[_txtArray1Index]._fontNumber = 2;
_txtArray2[_txtArray1Index]._color1 = 23;
- msg = _resourceManager->getMessage(8030, _lineNum++);
+ msg = g_resourceManager->getMessage(8030, _lineNum++);
_txtArray2[_txtArray1Index].setup(msg);
_txtArray2[_txtArray1Index]._moveRate = 20;
_txtArray2[_txtArray1Index]._moveDiff.y = 2;
@@ -1749,7 +1749,7 @@ void Scene9900::strAction2::signal() {
_txtArray2[_txtArray1Index].setPosition(Common::Point((320 - frameWidth) / 2, 200 + frameHeight));
} else {
// WORKAROUND: Fix inventory becoming available at end of credits
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
_actionIndex = 3;
signal();
}
@@ -1804,21 +1804,21 @@ void Scene9900::strAction3::signal() {
case 0:
_palette2.getPalette();
_palette3.loadPalette(2003);
- _globals->_scenePalette.addFader(_palette3._palette, 256, 5, this);
+ g_globals->_scenePalette.addFader(_palette3._palette, 256, 5, this);
break;
case 1:
- _globals->_scenePalette.addFader(&mask3[0], 1, 10, this);
+ g_globals->_scenePalette.addFader(&mask3[0], 1, 10, this);
break;
case 2:
- _globals->_scenePalette.addFader(&mask4[0], 1, 1, this);
+ g_globals->_scenePalette.addFader(&mask4[0], 1, 1, this);
break;
case 3:
_palette2.loadPalette(17);
- _globals->_sceneManager._scene->loadScene(17);
- _globals->_scenePalette.addFader(_palette2._palette, 256, 5, this);
+ g_globals->_sceneManager._scene->loadScene(17);
+ g_globals->_scenePalette.addFader(_palette2._palette, 256, 5, this);
break;
case 4:
- _globals->_game->endGame(9900, 61);
+ g_globals->_game->endGame(9900, 61);
remove();
default:
break;
@@ -1858,40 +1858,40 @@ void Scene9900::signal() {
switch (_sceneMode){
case 150:
- _globals->_soundHandler.play(380);
+ g_globals->_soundHandler.play(380);
_object8.postInit();
_object8.setVisage(2002);
_object8.setStrip(1);
_object8.setFrame(1);
_object8.fixPriority(200);
_object8.setPosition(Common::Point(64, 199));
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9908;
setAction(&_sequenceManager, this, 9908, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
break;
case 162:
warning("TBC: shutdown();");
- _globals->_game->quitGame();
+ g_globals->_game->quitGame();
break;
case 9901:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9906;
setAction(&_sequenceManager, this, 9906, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
- _globals->_player._uiEnabled = true;
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_player._uiEnabled = true;
+ g_globals->_events.setCursor(CURSOR_USE);
break;
case 9902:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9901;
setAction(&_sequenceManager, this, 9901, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
break;
case 9903:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9902;
setAction(&_sequenceManager, this, 9902, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
break;
case 9904:
- _globals->_soundHandler.play(390);
+ g_globals->_soundHandler.play(390);
_sceneMode = 9912;
setAction(&_strAction2, this);
break;
@@ -1901,50 +1901,50 @@ void Scene9900::signal() {
break;
case 9906:
if (_object8._state == 0) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9913;
setAction(&_sequenceManager, this, 9913, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9905;
setAction(&_sequenceManager, this, 9905, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
}
break;
case 9907:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9903;
setAction(&_sequenceManager, this, 9903, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
break;
case 9908:
_object8.remove();
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9904;
setAction(&_sequenceManager, this, 9904, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
break;
case 9909:
- _globals->_soundHandler.play(375);
- _globals->_player.disableControl();
+ g_globals->_soundHandler.play(375);
+ g_globals->_player.disableControl();
_sceneMode = 9907;
setAction(&_sequenceManager, this, 9907, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
break;
case 9910:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9911;
setAction(&_sequenceManager, this, 9911, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
break;
case 9911:
- _globals->_soundHandler.play(367);
- _globals->_player.disableControl();
+ g_globals->_soundHandler.play(367);
+ g_globals->_player.disableControl();
_sceneMode = 9909;
setAction(&_sequenceManager, this, 9909, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
break;
case 9912:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9912;
setAction(&_sequenceManager, this, 9912, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
_sceneMode = 162;
- _globals->_player.enableControl();
- _globals->_player._canWalk = false;
+ g_globals->_player.enableControl();
+ g_globals->_player._canWalk = false;
break;
case 9913:
_sceneMode = 200;
@@ -1960,10 +1960,10 @@ void Scene9900::process(Event &event) {
return;
Scene::process(event);
if (_sceneMode == 9906) {
- if ((event.eventType == EVENT_BUTTON_DOWN) && (_globals->_events.getCursor() == OBJECT_ITEMS)) {
+ if ((event.eventType == EVENT_BUTTON_DOWN) && (g_globals->_events.getCursor() == OBJECT_ITEMS)) {
_object8._state = 1;
RING_INVENTORY._items._sceneNumber = 9900;
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
}
}
}
@@ -1995,7 +1995,7 @@ void Scene9900::postInit(SceneObjectList *OwnerList) {
RING_INVENTORY._items._description = Common::String("One of the items from the stasis ship. The other is on the Lance's bridge.");
_stripManager.addSpeaker(&_speakerMR);
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 9910;
setAction(&_sequenceManager, this, 9910, &_object1, &_object2, &_object3, &_object4, &_object5, &_object6);
}
@@ -2011,7 +2011,7 @@ void Scene9999::Action1::signal() {
setDelay(600);
break;
case 1:
- _globals->_sceneManager.changeScene(3500);
+ g_globals->_sceneManager.changeScene(3500);
break;
default:
break;
@@ -2030,8 +2030,8 @@ void Scene9999::Action2::signal() {
setDelay(300);
break;
case 2:
- _globals->_stripNum = 3600;
- _globals->_sceneManager.changeScene(3600);
+ g_globals->_stripNum = 3600;
+ g_globals->_sceneManager.changeScene(3600);
default:
break;
}
@@ -2047,14 +2047,14 @@ void Scene9999::postInit(SceneObjectList *OwnerList) {
_object1.setStrip2(3);
_object1.setPosition(Common::Point(160, 152));
- _globals->_player.postInit();
- _globals->_player.setVisage(1303);
- _globals->_player.setStrip2(1);
- _globals->_player.fixPriority(250);
- _globals->_player.animate(ANIM_MODE_2, NULL);
- _globals->_player.setPosition(Common::Point(194, 98));
- _globals->_player._numFrames = 20;
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(1303);
+ g_globals->_player.setStrip2(1);
+ g_globals->_player.fixPriority(250);
+ g_globals->_player.animate(ANIM_MODE_2, NULL);
+ g_globals->_player.setPosition(Common::Point(194, 98));
+ g_globals->_player._numFrames = 20;
+ g_globals->_player.disableControl();
_object2.postInit();
_object2.setVisage(1303);
@@ -2070,21 +2070,21 @@ void Scene9999::postInit(SceneObjectList *OwnerList) {
_object3.setPosition(Common::Point(292, 149));
_object3.setAction(&_action3);
- if (_globals->_sceneManager._previousScene == 3500)
+ if (g_globals->_sceneManager._previousScene == 3500)
setAction(&_action2);
else
setAction(&_action1);
- _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position.x, _globals->_player._position.y);
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
+ g_globals->_sceneManager._scene->_sceneBounds.center(g_globals->_player._position.x, g_globals->_player._position.y);
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
- if (_globals->_sceneManager._previousScene == 3500)
- _globals->_stripNum = 2222;
+ if (g_globals->_sceneManager._previousScene == 3500)
+ g_globals->_stripNum = 2222;
else
- _globals->_stripNum = 2121;
+ g_globals->_stripNum = 2121;
- _globals->_soundHandler.play(118);
+ g_globals->_soundHandler.play(118);
}
diff --git a/engines/tsage/ringworld/ringworld_scenes10.h b/engines/tsage/ringworld/ringworld_scenes10.h
index 02c42f3d01..6bca48776b 100644
--- a/engines/tsage/ringworld/ringworld_scenes10.h
+++ b/engines/tsage/ringworld/ringworld_scenes10.h
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
#include "tsage/ringworld/ringworld_logic.h"
+#include "tsage/ringworld/ringworld_speakers.h"
#include "tsage/events.h"
#include "tsage/core.h"
#include "tsage/scenes.h"
diff --git a/engines/tsage/ringworld/ringworld_scenes2.cpp b/engines/tsage/ringworld/ringworld_scenes2.cpp
index cfd3e3d8f7..e07c9253e6 100644
--- a/engines/tsage/ringworld/ringworld_scenes2.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes2.cpp
@@ -36,11 +36,11 @@ namespace Ringworld {
*--------------------------------------------------------------------------*/
void Scene1000::Action1::signal() {
- Scene1000 *scene = (Scene1000 *)_globals->_sceneManager._scene;
+ Scene1000 *scene = (Scene1000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(10);
break;
case 1:
@@ -63,7 +63,7 @@ void Scene1000::Action1::signal() {
break;
}
case 3:
- _globals->_sceneManager.changeScene(1400);
+ g_globals->_sceneManager.changeScene(1400);
break;
}
@@ -72,7 +72,7 @@ void Scene1000::Action1::signal() {
void Scene1000::Action2::signal() {
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(10);
break;
case 1:
@@ -82,7 +82,7 @@ void Scene1000::Action2::signal() {
break;
case 2:
SceneItem::display(0, 0);
- _globals->_sceneManager.changeScene(2000);
+ g_globals->_sceneManager.changeScene(2000);
break;
default:
break;
@@ -90,11 +90,11 @@ void Scene1000::Action2::signal() {
}
void Scene1000::Action3::signal() {
- Scene1000 *scene = (Scene1000 *)_globals->_sceneManager._scene;
+ Scene1000 *scene = (Scene1000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_sceneManager._scene->loadBackground(0, 0);
+ g_globals->_sceneManager._scene->loadBackground(0, 0);
setDelay(60);
break;
case 1: {
@@ -108,11 +108,11 @@ void Scene1000::Action3::signal() {
setDelay(60);
break;
case 4:
- _globals->_player.show();
+ g_globals->_player.show();
setDelay(240);
break;
case 5: {
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
const char *SEEN_INTRO = "seen_intro";
if (!ConfMan.hasKey(SEEN_INTRO) || !ConfMan.getBool(SEEN_INTRO)) {
@@ -123,31 +123,31 @@ void Scene1000::Action3::signal() {
setDelay(1);
} else {
// Prompt user for whether to start play or watch introduction
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
if (MessageDialog::show2(WATCH_INTRO_MSG, START_PLAY_BTN_STRING, INTRODUCTION_BTN_STRING) == 0) {
_actionIndex = 20;
- _globals->_soundHandler.fadeOut(this);
+ g_globals->_soundHandler.fadeOut(this);
} else {
setDelay(1);
}
}
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
break;
}
case 6: {
scene->_object3.remove();
- _globals->_player.setStrip2(2);
+ g_globals->_player.setStrip2(2);
NpcMover *mover = new NpcMover();
Common::Point pt(480, 100);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 7:
- _globals->_scenePalette.loadPalette(1002);
- _globals->_scenePalette.refresh();
- _globals->_scenePalette.addRotation(80, 95, -1);
+ g_globals->_scenePalette.loadPalette(1002);
+ g_globals->_scenePalette.refresh();
+ g_globals->_scenePalette.addRotation(80, 95, -1);
scene->_object3.postInit();
scene->_object3.setVisage(1002);
scene->_object3.setStrip(1);
@@ -216,14 +216,14 @@ void Scene1000::Action3::signal() {
break;
case 18:
zoom(false);
- _globals->_scenePalette.clearListeners();
- _globals->_soundHandler.fadeOut(this);
+ g_globals->_scenePalette.clearListeners();
+ g_globals->_soundHandler.fadeOut(this);
break;
case 19:
- _globals->_sceneManager.changeScene(10);
+ g_globals->_sceneManager.changeScene(10);
break;
case 20:
- _globals->_sceneManager.changeScene(30);
+ g_globals->_sceneManager.changeScene(30);
break;
default:
break;
@@ -231,19 +231,19 @@ void Scene1000::Action3::signal() {
}
void Scene1000::Action3::zoom(bool up) {
- Scene1000 *scene = (Scene1000 *)_globals->_sceneManager._scene;
+ Scene1000 *scene = (Scene1000 *)g_globals->_sceneManager._scene;
if (up) {
- while ((scene->_object3._percent < 100) && !_vm->shouldQuit()) {
+ while ((scene->_object3._percent < 100) && !g_vm->shouldQuit()) {
scene->_object3.changeZoom(MIN(scene->_object3._percent + 5, 100));
- _globals->_sceneObjects->draw();
- _globals->_events.delay(1);
+ g_globals->_sceneObjects->draw();
+ g_globals->_events.delay(1);
}
} else {
- while ((scene->_object3._percent > 0) && !_vm->shouldQuit()) {
+ while ((scene->_object3._percent > 0) && !g_vm->shouldQuit()) {
scene->_object3.changeZoom(MAX(scene->_object3._percent - 5, 0));
- _globals->_sceneObjects->draw();
- _globals->_events.delay(1);
+ g_globals->_sceneObjects->draw();
+ g_globals->_events.delay(1);
}
}
}
@@ -255,7 +255,7 @@ void Scene1000::postInit(SceneObjectList *OwnerList) {
setZoomPercents(0, 100, 200, 100);
loadScene(1000);
- if (_globals->_sceneManager._previousScene == 2000) {
+ if (g_globals->_sceneManager._previousScene == 2000) {
setZoomPercents(150, 10, 180, 100);
_object1.postInit();
_object1.setVisage(1001);
@@ -266,12 +266,12 @@ void Scene1000::postInit(SceneObjectList *OwnerList) {
setAction(&_action2);
- _globals->_sceneManager._scene->_sceneBounds.center(_object1._position.x, _object1._position.y);
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneManager._scene->_sceneBounds.center(_object1._position.x, _object1._position.y);
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
- _globals->_soundHandler.play(114);
- } else if (_globals->_sceneManager._previousScene == 2222) {
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
+ g_globals->_soundHandler.play(114);
+ } else if (g_globals->_sceneManager._previousScene == 2222) {
setZoomPercents(150, 10, 180, 100);
_object1.postInit();
_object1.setVisage(1001);
@@ -280,28 +280,28 @@ void Scene1000::postInit(SceneObjectList *OwnerList) {
_object1._moveDiff = Common::Point(2, 2);
_object1.setPosition(Common::Point(120, 180));
- _globals->_sceneManager._scene->_sceneBounds.center(_object1._position.x, _object1._position.y);
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
+ g_globals->_sceneManager._scene->_sceneBounds.center(_object1._position.x, _object1._position.y);
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
setAction(&_action1);
} else {
- _globals->_soundHandler.play(4);
+ g_globals->_soundHandler.play(4);
setZoomPercents(0, 10, 30, 100);
_object3.postInit();
_object3.setVisage(1050);
_object3.changeZoom(-1);
_object3.setPosition(Common::Point(158, 0));
- _globals->_player.postInit();
- _globals->_player.setVisage(1050);
- _globals->_player.setStrip(3);
- _globals->_player.setPosition(Common::Point(160, 191));
- _globals->_player._moveDiff.x = 12;
- _globals->_player.hide();
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(1050);
+ g_globals->_player.setStrip(3);
+ g_globals->_player.setPosition(Common::Point(160, 191));
+ g_globals->_player._moveDiff.x = 12;
+ g_globals->_player.hide();
+ g_globals->_player.disableControl();
- _globals->_sceneManager._scene->_sceneBounds.center(_object3._position.x, _object3._position.y);
+ g_globals->_sceneManager._scene->_sceneBounds.center(_object3._position.x, _object3._position.y);
setAction(&_action3);
}
@@ -313,7 +313,7 @@ void Scene1000::postInit(SceneObjectList *OwnerList) {
*--------------------------------------------------------------------------*/
void Scene1001::Action1::signal() {
- Scene1001 *scene = (Scene1001 *)_globals->_sceneManager._scene;
+ Scene1001 *scene = (Scene1001 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -478,9 +478,9 @@ void Scene1001::Action1::signal() {
setDelay(30);
break;
case 19: {
- _globals->_soundHandler.play(91);
+ g_globals->_soundHandler.play(91);
byte adjustData[4] = {0xff, 0xff, 0xff, 0};
- _globals->_scenePalette.fade(adjustData, false, 0);
+ g_globals->_scenePalette.fade(adjustData, false, 0);
scene->_object1._strip = 7;
scene->_object1._frame = 1;
@@ -490,8 +490,8 @@ void Scene1001::Action1::signal() {
break;
}
case 20:
- _globals->_scenePalette.loadPalette(16);
- _globals->_scenePalette.refresh();
+ g_globals->_scenePalette.loadPalette(16);
+ g_globals->_scenePalette.refresh();
setDelay(6);
break;
case 21:
@@ -499,14 +499,14 @@ void Scene1001::Action1::signal() {
scene->_object1.animate(ANIM_MODE_5, this);
break;
case 22:
- _globals->_soundHandler.play(92);
+ g_globals->_soundHandler.play(92);
scene->_stripManager.start(111, this);
break;
case 23:
setDelay(60);
break;
case 24:
- _globals->_sceneManager.changeScene(2000);
+ g_globals->_sceneManager.changeScene(2000);
break;
}
}
@@ -529,7 +529,7 @@ void Scene1001::postInit(SceneObjectList *OwnerList) {
_object3.setStrip2(4);
_object3.setPosition(Common::Point(61, 177));
- _globals->_soundHandler.play(85);
+ g_globals->_soundHandler.play(85);
setAction(&_action1);
}
@@ -540,11 +540,11 @@ void Scene1001::postInit(SceneObjectList *OwnerList) {
*--------------------------------------------------------------------------*/
void Scene1250::Action1::signal() {
- Scene1250 *scene = (Scene1250 *)_globals->_sceneManager._scene;
+ Scene1250 *scene = (Scene1250 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- setDelay(_globals->_randomSource.getRandomNumber(120) + 60);
+ setDelay(g_globals->_randomSource.getRandomNumber(120) + 60);
break;
case 1:
scene->_object1.animate(ANIM_MODE_5, this);
@@ -554,11 +554,11 @@ void Scene1250::Action1::signal() {
}
void Scene1250::Action2::signal() {
- Scene1250 *scene = (Scene1250 *)_globals->_sceneManager._scene;
+ Scene1250 *scene = (Scene1250 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- switch (_globals->_randomSource.getRandomNumber(2)) {
+ switch (g_globals->_randomSource.getRandomNumber(2)) {
case 0:
scene->_object2.setPosition(Common::Point(163, 75));
break;
@@ -580,7 +580,7 @@ void Scene1250::Action2::signal() {
}
void Scene1250::Action3::signal() {
- Scene1250 *scene = (Scene1250 *)_globals->_sceneManager._scene;
+ Scene1250 *scene = (Scene1250 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -593,13 +593,13 @@ void Scene1250::Action3::signal() {
setDelay(6);
break;
case 3:
- _globals->_sceneManager.changeScene(1000);
+ g_globals->_sceneManager.changeScene(1000);
break;
}
}
void Scene1250::Action4::signal() {
- Scene1250 *scene = (Scene1250 *)_globals->_sceneManager._scene;
+ Scene1250 *scene = (Scene1250 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -612,7 +612,7 @@ void Scene1250::Action4::signal() {
setDelay(6);
break;
case 3:
- _globals->_sceneManager.changeScene(2000);
+ g_globals->_sceneManager.changeScene(2000);
break;
}
}
@@ -643,14 +643,14 @@ void Scene1250::postInit(SceneObjectList *OwnerList) {
_object2._frame = 1;
_object2.setAction(&_action2);
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
- if ((_globals->_sceneManager._previousScene != 2000) || (_globals->_stripNum != 1250)) {
+ if ((g_globals->_sceneManager._previousScene != 2000) || (g_globals->_stripNum != 1250)) {
setAction(&_action4);
} else {
setAction(&_action3);
- _globals->_soundHandler.play(114);
+ g_globals->_soundHandler.play(114);
}
}
@@ -660,7 +660,7 @@ void Scene1250::postInit(SceneObjectList *OwnerList) {
*--------------------------------------------------------------------------*/
void Scene1400::Action1::signal() {
- Scene1400 *scene = (Scene1400 *)_globals->_sceneManager._scene;
+ Scene1400 *scene = (Scene1400 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -671,23 +671,23 @@ void Scene1400::Action1::signal() {
Common::Point pt(160, 700);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2: {
- _globals->_player.setStrip2(3);
- _globals->_player.changeZoom(100);
+ g_globals->_player.setStrip2(3);
+ g_globals->_player.changeZoom(100);
Common::Point pt(160, 100);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
SceneItem::display(0, 0);
setDelay(360);
break;
}
case 3:
- SceneItem::display(1400, 2, SET_X, 60, SET_Y, _globals->_sceneManager._scene->_sceneBounds.bottom - 80,
+ SceneItem::display(1400, 2, SET_X, 60, SET_Y, g_globals->_sceneManager._scene->_sceneBounds.bottom - 80,
SET_FONT, 2, SET_FG_COLOR, 13, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
setDelay(420);
break;
@@ -696,7 +696,7 @@ void Scene1400::Action1::signal() {
setDelay(360);
break;
case 5:
- SceneItem::display(1400, 3, SET_X, 60, SET_Y, _globals->_sceneManager._scene->_sceneBounds.bottom - 80,
+ SceneItem::display(1400, 3, SET_X, 60, SET_Y, g_globals->_sceneManager._scene->_sceneBounds.bottom - 80,
SET_FONT, 2, SET_FG_COLOR, 23, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
setDelay(360);
break;
@@ -704,25 +704,25 @@ void Scene1400::Action1::signal() {
SceneItem::display(0, 0);
break;
case 7: {
- _globals->_player._frame = 1;
- _globals->_player.setStrip2(1);
- _globals->_player._numFrames = 5;
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player._frame = 1;
+ g_globals->_player.setStrip2(1);
+ g_globals->_player._numFrames = 5;
+ g_globals->_player.animate(ANIM_MODE_5, this);
Common::Point pt(205, 70);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, NULL);
- _globals->_sceneManager._fadeMode = FADEMODE_NONE;
+ g_globals->_player.addMover(mover, &pt, NULL);
+ g_globals->_sceneManager._fadeMode = FADEMODE_NONE;
scene->loadScene(1402);
break;
}
case 8:
- _globals->_player.setStrip2(2);
- _globals->_player._numFrames = 10;
- _globals->_player.animate(ANIM_MODE_2, NULL);
+ g_globals->_player.setStrip2(2);
+ g_globals->_player._numFrames = 10;
+ g_globals->_player.animate(ANIM_MODE_2, NULL);
- SceneItem::display(1400, 4, SET_X, 30, SET_Y, _globals->_player._position.y + 10, SET_FONT, 2,
+ SceneItem::display(1400, 4, SET_X, 30, SET_Y, g_globals->_player._position.y + 10, SET_FONT, 2,
SET_FG_COLOR, 13, SET_POS_MODE, 0, SET_KEEP_ONSCREEN, -1, LIST_END);
setDelay(300);
break;
@@ -730,16 +730,16 @@ void Scene1400::Action1::signal() {
SceneItem::display(0, 0);
Common::Point pt(450, 45);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 10:
- _globals->_sceneManager._scrollerRect = Rect(40, 20, 280, 180);
- _globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
- _globals->_stripNum = 1500;
- _globals->_soundHandler.stop();
+ g_globals->_sceneManager._scrollerRect = Rect(40, 20, 280, 180);
+ g_globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
+ g_globals->_stripNum = 1500;
+ g_globals->_soundHandler.stop();
- _globals->_sceneManager.changeScene(1500);
+ g_globals->_sceneManager.changeScene(1500);
break;
}
}
@@ -748,41 +748,41 @@ void Scene1400::Action1::dispatch() {
Action::dispatch();
if ((_actionIndex > 3) && (_actionIndex < 9))
- _globals->_sceneText.setPosition(Common::Point(60, _globals->_sceneManager._scene->_sceneBounds.bottom - 80));
+ g_globals->_sceneText.setPosition(Common::Point(60, g_globals->_sceneManager._scene->_sceneBounds.bottom - 80));
- if ((_actionIndex <= 2) && (_globals->_player._percent > 22))
- _globals->_player.changeZoom(100 - (800 - _globals->_player._position.y));
+ if ((_actionIndex <= 2) && (g_globals->_player._percent > 22))
+ g_globals->_player.changeZoom(100 - (800 - g_globals->_player._position.y));
- if ((_actionIndex >= 9) && (_globals->_player._percent > 22))
- _globals->_player.changeZoom(100 - (_globals->_player._position.x - 205));
+ if ((_actionIndex >= 9) && (g_globals->_player._percent > 22))
+ g_globals->_player.changeZoom(100 - (g_globals->_player._position.x - 205));
}
/*--------------------------------------------------------------------------*/
void Scene1400::postInit(SceneObjectList *OwnerList) {
- if (_globals->_stripNum != 1400) {
+ if (g_globals->_stripNum != 1400) {
loadScene(1401);
} else {
loadScene(1402);
}
Scene::postInit();
- _globals->_sceneManager._scrollerRect = Rect(40, 90, 280, 180);
- _globals->_player.postInit();
- _globals->_player.setVisage(1401);
- _globals->_player.animate(ANIM_MODE_2, 0);
- _globals->_player.setStrip2(4);
- _globals->_player.fixPriority(4);
- _globals->_player.disableControl();
+ g_globals->_sceneManager._scrollerRect = Rect(40, 90, 280, 180);
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(1401);
+ g_globals->_player.animate(ANIM_MODE_2, 0);
+ g_globals->_player.setStrip2(4);
+ g_globals->_player.fixPriority(4);
+ g_globals->_player.disableControl();
- _globals->_player._moveDiff = Common::Point(4, 2);
- _globals->_player.setPosition(Common::Point(160, 800));
- _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position);
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.y = (_globals->_sceneManager._scene->_sceneBounds.top / 100) * 100;
+ g_globals->_player._moveDiff = Common::Point(4, 2);
+ g_globals->_player.setPosition(Common::Point(160, 800));
+ g_globals->_sceneManager._scene->_sceneBounds.center(g_globals->_player._position);
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.y = (g_globals->_sceneManager._scene->_sceneBounds.top / 100) * 100;
setAction(&_action1);
- _globals->_soundHandler.play(118);
+ g_globals->_soundHandler.play(118);
}
/*--------------------------------------------------------------------------
@@ -791,7 +791,7 @@ void Scene1400::postInit(SceneObjectList *OwnerList) {
*--------------------------------------------------------------------------*/
void Scene1500::Action1::signal() {
- Scene1500 *scene = (Scene1500 *)_globals->_sceneManager._scene;
+ Scene1500 *scene = (Scene1500 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
@@ -856,17 +856,17 @@ void Scene1500::Action1::signal() {
scene->_soundHandler.play(124, this);
break;
case 8:
- _globals->_soundHandler.play(126, this);
+ g_globals->_soundHandler.play(126, this);
break;
case 9:
- _globals->_soundHandler.play(127);
- _globals->_sceneManager.changeScene(2000);
+ g_globals->_soundHandler.play(127);
+ g_globals->_sceneManager.changeScene(2000);
break;
}
}
void Scene1500::Action2::signal() {
- Scene1500 *scene = (Scene1500 *)_globals->_sceneManager._scene;
+ Scene1500 *scene = (Scene1500 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -897,8 +897,8 @@ void Scene1500::Action2::signal() {
}
case 3:
scene->_soundHandler.release();
- _globals->_stripNum = 1505;
- _globals->_sceneManager.changeScene(2400);
+ g_globals->_stripNum = 1505;
+ g_globals->_sceneManager.changeScene(2400);
break;
}
}
@@ -909,8 +909,8 @@ void Scene1500::postInit(SceneObjectList *OwnerList) {
loadScene(1500);
Scene::postInit();
- if ((_globals->_stripNum == 1500) || ((_globals->_stripNum != 1504) && (_globals->_stripNum != 2751))) {
- _globals->_soundHandler.play(120);
+ if ((g_globals->_stripNum == 1500) || ((g_globals->_stripNum != 1504) && (g_globals->_stripNum != 2751))) {
+ g_globals->_soundHandler.play(120);
setZoomPercents(105, 20, 145, 100);
setAction(&_action1);
diff --git a/engines/tsage/ringworld/ringworld_scenes2.h b/engines/tsage/ringworld/ringworld_scenes2.h
index 3502aea15b..382d9d4157 100644
--- a/engines/tsage/ringworld/ringworld_scenes2.h
+++ b/engines/tsage/ringworld/ringworld_scenes2.h
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
#include "tsage/ringworld/ringworld_logic.h"
+#include "tsage/ringworld/ringworld_speakers.h"
#include "tsage/events.h"
#include "tsage/core.h"
#include "tsage/scenes.h"
diff --git a/engines/tsage/ringworld/ringworld_scenes3.cpp b/engines/tsage/ringworld/ringworld_scenes3.cpp
index f744a98c33..7103a48ed9 100644
--- a/engines/tsage/ringworld/ringworld_scenes3.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes3.cpp
@@ -36,7 +36,7 @@ namespace Ringworld {
*--------------------------------------------------------------------------*/
void Scene2000::Action1::signal() {
- Scene2000 *scene = (Scene2000 *)_globals->_sceneManager._scene;
+ Scene2000 *scene = (Scene2000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -49,82 +49,82 @@ void Scene2000::Action1::signal() {
setDelay(4);
break;
case 3:
- _globals->_stripNum = 0;
- _globals->_sceneManager.changeScene(1250);
+ g_globals->_stripNum = 0;
+ g_globals->_sceneManager.changeScene(1250);
break;
}
}
void Scene2000::Action2::signal() {
- Scene2000 *scene = (Scene2000 *)_globals->_sceneManager._scene;
+ Scene2000 *scene = (Scene2000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
scene->_object2.animate(ANIM_MODE_6, NULL);
- setDelay(_globals->_randomSource.getRandomNumber(179) + 60);
+ setDelay(g_globals->_randomSource.getRandomNumber(179) + 60);
break;
case 1:
- setDelay(_globals->_randomSource.getRandomNumber(179) + 60);
- if (_globals->_randomSource.getRandomNumber(4) >= 2)
+ setDelay(g_globals->_randomSource.getRandomNumber(179) + 60);
+ if (g_globals->_randomSource.getRandomNumber(4) >= 2)
_actionIndex = 0;
break;
case 2:
- setDelay(_globals->_randomSource.getRandomNumber(179) + 60);
- _actionIndex = _globals->_randomSource.getRandomNumber(1);
+ setDelay(g_globals->_randomSource.getRandomNumber(179) + 60);
+ _actionIndex = g_globals->_randomSource.getRandomNumber(1);
break;
}
}
void Scene2000::Action3::signal() {
- Scene2000 *scene = (Scene2000 *)_globals->_sceneManager._scene;
+ Scene2000 *scene = (Scene2000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
scene->_object6.animate(ANIM_MODE_5, NULL);
- setDelay(_globals->_randomSource.getRandomNumber(179) + 60);
+ setDelay(g_globals->_randomSource.getRandomNumber(179) + 60);
break;
case 1:
scene->_object6.animate(ANIM_MODE_6, NULL);
- setDelay(_globals->_randomSource.getRandomNumber(179) + 60);
+ setDelay(g_globals->_randomSource.getRandomNumber(179) + 60);
_actionIndex = 0;
break;
}
}
void Scene2000::Action4::signal() {
- Scene2000 *scene = (Scene2000 *)_globals->_sceneManager._scene;
+ Scene2000 *scene = (Scene2000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
scene->_object4.animate(ANIM_MODE_5, NULL);
- setDelay(_globals->_randomSource.getRandomNumber(179) + 60);
+ setDelay(g_globals->_randomSource.getRandomNumber(179) + 60);
break;
case 1:
scene->_object4.animate(ANIM_MODE_6, NULL);
- setDelay(_globals->_randomSource.getRandomNumber(179) + 60);
+ setDelay(g_globals->_randomSource.getRandomNumber(179) + 60);
_actionIndex = 0;
break;
}
}
void Scene2000::Action5::signal() {
- Scene2000 *scene = (Scene2000 *)_globals->_sceneManager._scene;
+ Scene2000 *scene = (Scene2000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
scene->_object3.animate(ANIM_MODE_5, NULL);
- setDelay(_globals->_randomSource.getRandomNumber(125) + 300);
+ setDelay(g_globals->_randomSource.getRandomNumber(125) + 300);
break;
case 1:
scene->_object3.animate(ANIM_MODE_6, NULL);
- setDelay(_globals->_randomSource.getRandomNumber(125) + 300);
+ setDelay(g_globals->_randomSource.getRandomNumber(125) + 300);
_actionIndex = 0;
break;
}
}
void Scene2000::Action6::signal() {
- Scene2000 *scene = (Scene2000 *)_globals->_sceneManager._scene;
+ Scene2000 *scene = (Scene2000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -135,7 +135,7 @@ void Scene2000::Action6::signal() {
scene->_stripManager.start(2000, this);
break;
case 2:
- _globals->_soundHandler.play(81);
+ g_globals->_soundHandler.play(81);
scene->_object6.postInit();
scene->_object6.setVisage(2003);
scene->_object6.setAction(NULL);
@@ -150,15 +150,15 @@ void Scene2000::Action6::signal() {
scene->_object6.animate(ANIM_MODE_6, this);
break;
case 5:
- _globals->_soundHandler.play(80);
+ g_globals->_soundHandler.play(80);
scene->_object6.remove();
- _globals->_sceneManager.changeScene(1001);
+ g_globals->_sceneManager.changeScene(1001);
break;
}
}
void Scene2000::Action7::signal() {
- Scene2000 *scene = (Scene2000 *)_globals->_sceneManager._scene;
+ Scene2000 *scene = (Scene2000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -171,13 +171,13 @@ void Scene2000::Action7::signal() {
setDelay(3);
break;
case 3:
- _globals->_sceneManager.changeScene(2222);
+ g_globals->_sceneManager.changeScene(2222);
break;
}
}
void Scene2000::Action8::signal() {
- Scene2000 *scene = (Scene2000 *)_globals->_sceneManager._scene;
+ Scene2000 *scene = (Scene2000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -190,14 +190,14 @@ void Scene2000::Action8::signal() {
setDelay(10);
break;
case 3:
- _globals->_stripNum = 2005;
- _globals->_sceneManager.changeScene(1000);
+ g_globals->_stripNum = 2005;
+ g_globals->_sceneManager.changeScene(1000);
break;
}
}
void Scene2000::Action9::signal() {
- Scene2000 *scene = (Scene2000 *)_globals->_sceneManager._scene;
+ Scene2000 *scene = (Scene2000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -210,8 +210,8 @@ void Scene2000::Action9::signal() {
setDelay(3);
break;
case 3:
- _globals->_stripNum = 2008;
- _globals->_sceneManager.changeScene(9999);
+ g_globals->_stripNum = 2008;
+ g_globals->_sceneManager.changeScene(9999);
break;
}
}
@@ -230,14 +230,14 @@ void Scene2000::Action10::signal() {
break;
case 3:
SceneItem::display(0, 0);
- _globals->_stripNum = 0;
- _globals->_sceneManager.changeScene(9999);
+ g_globals->_stripNum = 0;
+ g_globals->_sceneManager.changeScene(9999);
break;
}
}
void Scene2000::Action11::signal() {
- Scene2000 *scene = (Scene2000 *)_globals->_sceneManager._scene;
+ Scene2000 *scene = (Scene2000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -250,35 +250,35 @@ void Scene2000::Action11::signal() {
scene->_stripManager.start(2077, this);
break;
case 3:
- _globals->_stripNum = 0;
- _globals->_sceneManager.changeScene(1400);
+ g_globals->_stripNum = 0;
+ g_globals->_sceneManager.changeScene(1400);
break;
}
}
void Scene2000::Action12::signal() {
- Scene2000 *scene = (Scene2000 *)_globals->_sceneManager._scene;
+ Scene2000 *scene = (Scene2000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(60);
break;
case 1:
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start(2020, this);
break;
case 2:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(10);
break;
case 3:
- _globals->_sceneManager.changeScene(2300);
+ g_globals->_sceneManager.changeScene(2300);
break;
}
}
void Scene2000::Action13::signal() {
- Scene2000 *scene = (Scene2000 *)_globals->_sceneManager._scene;
+ Scene2000 *scene = (Scene2000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -289,18 +289,18 @@ void Scene2000::Action13::signal() {
break;
case 2:
SceneItem::display(0, 0);
- _globals->_stripNum = 2751;
- _globals->_sceneManager.changeScene(1500);
+ g_globals->_stripNum = 2751;
+ g_globals->_sceneManager.changeScene(1500);
break;
}
}
void Scene2000::Action14::signal() {
- Scene2000 *scene = (Scene2000 *)_globals->_sceneManager._scene;
+ Scene2000 *scene = (Scene2000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(30);
break;
case 1:
@@ -310,12 +310,12 @@ void Scene2000::Action14::signal() {
setDelay(60);
break;
case 3:
- _globals->_soundHandler.play(99);
+ g_globals->_soundHandler.play(99);
scene->_object8.show();
scene->_object8.animate(ANIM_MODE_5, this);
break;
case 4:
- _globals->_soundHandler.play(12);
+ g_globals->_soundHandler.play(12);
scene->_object8.setStrip(2);
scene->_object8.setFrame(1);
scene->_object9.show();
@@ -326,7 +326,7 @@ void Scene2000::Action14::signal() {
scene->_stripManager.start(2001, this, scene);
break;
case 6:
- _globals->_soundHandler.fadeOut(NULL);
+ g_globals->_soundHandler.fadeOut(NULL);
scene->_object8.setStrip(1);
scene->_object8.setFrame(scene->_object8.getFrameCount());
scene->_object8.animate(ANIM_MODE_6, this);
@@ -335,7 +335,7 @@ void Scene2000::Action14::signal() {
scene->_object10.remove();
break;
case 7:
- _globals->_soundHandler.play(111);
+ g_globals->_soundHandler.play(111);
scene->_object8.remove();
setDelay(5);
break;
@@ -343,8 +343,8 @@ void Scene2000::Action14::signal() {
scene->_stripManager.start(2071, this);
break;
case 9:
- _globals->_stripNum = 1250;
- _globals->_sceneManager.changeScene(1000);
+ g_globals->_stripNum = 1250;
+ g_globals->_sceneManager.changeScene(1000);
break;
}
}
@@ -386,7 +386,7 @@ void Scene2000::postInit(SceneObjectList *OwnerList) {
_object2.setPosition(Common::Point(43, 115));
_object2.setAction(&_action2);
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_object6.postInit();
_object6.setVisage(2003);
@@ -415,7 +415,7 @@ void Scene2000::postInit(SceneObjectList *OwnerList) {
_object10.fixPriority(195);
_object10.hide();
- switch (_globals->_sceneManager._previousScene) {
+ switch (g_globals->_sceneManager._previousScene) {
case 1000:
setAction(&_action7);
break;
@@ -427,11 +427,11 @@ void Scene2000::postInit(SceneObjectList *OwnerList) {
setAction(&_action13);
break;
case 2200:
- _globals->_soundHandler.play(111);
+ g_globals->_soundHandler.play(111);
setAction(&_action14);
break;
case 2222:
- _globals->_soundHandler.play(115);
+ g_globals->_soundHandler.play(115);
setAction(&_action8);
break;
case 3500:
@@ -439,14 +439,14 @@ void Scene2000::postInit(SceneObjectList *OwnerList) {
break;
default:
_object6.remove();
- _globals->_soundHandler.play(80);
+ g_globals->_soundHandler.play(80);
setAction(&_action6);
break;
}
_soundHandler1.play(78);
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
}
void Scene2000::stripCallback(int v) {
@@ -485,22 +485,22 @@ void Scene2000::stripCallback(int v) {
*--------------------------------------------------------------------------*/
void Scene2100::Action1::signal() {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
if (!scene->_sitFl)
setDelay(1);
else {
- setAction(&scene->_sequenceManager, this, 2102, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager, this, 2102, &g_globals->_player, NULL);
scene->_sitFl = 0;
}
break;
case 1: {
Common::Point pt(157, 62);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2:
@@ -510,15 +510,15 @@ void Scene2100::Action1::signal() {
case 3: {
Common::Point pt(157, 56);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 4:
- _globals->_player._strip = 3;
+ g_globals->_player._strip = 3;
setDelay(3);
break;
case 5:
- _globals->_player.fixPriority(1);
+ g_globals->_player.fixPriority(1);
scene->_area1.display();
scene->_area2.display();
scene->_area3.display();
@@ -526,12 +526,12 @@ void Scene2100::Action1::signal() {
scene->_area1.draw(true);
_state = 0;
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
- while (!_state && !_vm->shouldQuit()) {
+ while (!_state && !g_vm->shouldQuit()) {
// Wait for an event
Event event;
- if (!_globals->_events.getEvent(event)) {
+ if (!g_globals->_events.getEvent(event)) {
g_system->updateScreen();
g_system->delayMillis(10);
continue;
@@ -570,37 +570,37 @@ void Scene2100::Action1::signal() {
if (_state == 2100) {
Common::Point pt(157, 65);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
} else {
- _globals->_sceneManager.changeScene(_state);
+ g_globals->_sceneManager.changeScene(_state);
}
break;
case 7:
- _globals->_player.fixPriority(-1);
+ g_globals->_player.fixPriority(-1);
scene->_soundHandler.play(162);
scene->_object1.animate(ANIM_MODE_6, this);
break;
case 8:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene2100::Action2::signal() {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
scene->_object3._numFrames = 5;
- setDelay(_globals->_randomSource.getRandomNumber(59));
+ setDelay(g_globals->_randomSource.getRandomNumber(59));
break;
case 1:
scene->_object3.animate(ANIM_MODE_5, this);
break;
case 2:
- setDelay(_globals->_randomSource.getRandomNumber(59));
+ setDelay(g_globals->_randomSource.getRandomNumber(59));
break;
case 3:
scene->_object3.animate(ANIM_MODE_6, this);
@@ -610,12 +610,12 @@ void Scene2100::Action2::signal() {
}
void Scene2100::Action3::signal() {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
case 2:
- setDelay(_globals->_randomSource.getRandomNumber(119));
+ setDelay(g_globals->_randomSource.getRandomNumber(119));
break;
case 1:
scene->_object2.animate(ANIM_MODE_5, this);
@@ -628,64 +628,64 @@ void Scene2100::Action3::signal() {
}
void Scene2100::Action4::signal() {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
if (!scene->_sitFl)
setDelay(1);
else
- setAction(&scene->_sequenceManager, this, 2102, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager, this, 2102, &g_globals->_player, NULL);
break;
case 1: {
Common::Point pt(80, 66);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2:
- _globals->_player.setVisage(2109);
- _globals->_player._frame = 1;
- _globals->_player._strip = 2;
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(2109);
+ g_globals->_player._frame = 1;
+ g_globals->_player._strip = 2;
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 3:
- _globals->_sceneManager.changeScene(2120);
+ g_globals->_sceneManager.changeScene(2120);
break;
}
}
void Scene2100::Action5::signal() {
// Quinn enters the cokpit after Seeker decided to enter the cave alone
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(30);
break;
case 1:
- setAction(&scene->_sequenceManager, this, 2104, &_globals->_player, &scene->_object1, NULL);
+ setAction(&scene->_sequenceManager, this, 2104, &g_globals->_player, &scene->_object1, NULL);
break;
case 2: {
Common::Point pt(272, 127);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 3:
- _globals->_player.checkAngle(&scene->_object3);
+ g_globals->_player.checkAngle(&scene->_object3);
setDelay(30);
break;
case 4:
- _globals->_sceneManager.changeScene(3700);
+ g_globals->_sceneManager.changeScene(3700);
break;
}
}
void Scene2100::Action6::signal() {
// Seeker stands up and walks to the elevator
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
@@ -717,50 +717,50 @@ void Scene2100::Action6::signal() {
}
void Scene2100::Action7::signal() {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(60);
break;
case 1:
- setAction(&scene->_sequenceManager, this, 2104, &_globals->_player, &scene->_object1, NULL);
+ setAction(&scene->_sequenceManager, this, 2104, &g_globals->_player, &scene->_object1, NULL);
break;
case 2:
- setAction(&scene->_sequenceManager, this, 2104, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager, this, 2104, &g_globals->_player, NULL);
break;
case 3:
- _globals->_sceneManager.changeScene(8100);
+ g_globals->_sceneManager.changeScene(8100);
break;
}
}
void Scene2100::Action8::signal() {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(60);
break;
case 1:
- setAction(&scene->_sequenceManager, this, 2104, &_globals->_player, &scene->_object1, NULL);
+ setAction(&scene->_sequenceManager, this, 2104, &g_globals->_player, &scene->_object1, NULL);
break;
case 2: {
Common::Point pt(200, 174);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 3:
- _globals->_player.checkAngle(&scene->_object3);
+ g_globals->_player.checkAngle(&scene->_object3);
scene->_stripManager.start((RING_INVENTORY._translator._sceneNumber == 1) ? 7720 : 7710, this);
break;
case 4:
if (RING_INVENTORY._translator._sceneNumber != 1)
- _globals->_sceneManager.changeScene(7600);
+ g_globals->_sceneManager.changeScene(7600);
else {
- _globals->setFlag(24);
- _globals->_player.enableControl();
+ g_globals->setFlag(24);
+ g_globals->_player.enableControl();
remove();
}
break;
@@ -768,7 +768,7 @@ void Scene2100::Action8::signal() {
}
void Scene2100::Action9::signal() {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -795,7 +795,7 @@ void Scene2100::Action9::signal() {
break;
case 5:
scene->_object4.hide();
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start(6010, this);
break;
case 6:
@@ -808,20 +808,20 @@ void Scene2100::Action9::signal() {
}
void Scene2100::Action10::signal() {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(60);
break;
case 1:
- setAction(&scene->_sequenceManager, this, 2102, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager, this, 2102, &g_globals->_player, NULL);
break;
case 2: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
Common::Point pt(155, 64);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 3:
@@ -853,10 +853,10 @@ void Scene2100::Action10::signal() {
scene->_object1.animate(ANIM_MODE_5, this);
break;
case 6: {
- _globals->_player.fixPriority(1);
+ g_globals->_player.fixPriority(1);
Common::Point pt(144, 54);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 7: {
@@ -872,8 +872,8 @@ void Scene2100::Action10::signal() {
break;
}
case 8:
- _globals->_player.fixPriority(1);
- _globals->_player.setStrip(1);
+ g_globals->_player.fixPriority(1);
+ g_globals->_player.setStrip(1);
scene->_object3.fixPriority(1);
scene->_object3.setStrip(2);
scene->_object2.fixPriority(2);
@@ -886,16 +886,16 @@ void Scene2100::Action10::signal() {
scene->_object1.animate(ANIM_MODE_6, this);
break;
case 10:
- _globals->setFlag(70);
- _globals->_stripNum = 2101;
- _globals->_sceneManager.changeScene(2320);
+ g_globals->setFlag(70);
+ g_globals->_stripNum = 2101;
+ g_globals->_sceneManager.changeScene(2320);
break;
}
}
void Scene2100::Action11::signal() {
// Miranda stands up and walks to the elevator
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -953,16 +953,16 @@ void Scene2100::Action11::signal() {
case 7:
scene->_object3.remove();
scene->_object2.remove();
- _globals->setFlag(70);
- _globals->_stripNum = 2102;
- _globals->_player.enableControl();
- _globals->_player._canWalk = false;
+ g_globals->setFlag(70);
+ g_globals->_stripNum = 2102;
+ g_globals->_player.enableControl();
+ g_globals->_player._canWalk = false;
break;
}
}
void Scene2100::Action12::signal() {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -978,7 +978,7 @@ void Scene2100::Action12::signal() {
case 3: {
Common::Point pt1(158, 74);
NpcMover *mover1 = new NpcMover();
- _globals->_player.addMover(mover1, &pt1, this);
+ g_globals->_player.addMover(mover1, &pt1, this);
Common::Point pt2(158, 68);
NpcMover *mover2 = new NpcMover();
@@ -989,10 +989,10 @@ void Scene2100::Action12::signal() {
scene->_soundHandler.play(162);
scene->_object1.animate(ANIM_MODE_6, NULL);
- _globals->_player.fixPriority(-1);
+ g_globals->_player.fixPriority(-1);
Common::Point pt1(277, 84);
PlayerMover *mover1 = new PlayerMover();
- _globals->_player.addMover(mover1, &pt1, this);
+ g_globals->_player.addMover(mover1, &pt1, this);
scene->_object2.fixPriority(-1);
Common::Point pt2(255, 76);
@@ -1001,29 +1001,29 @@ void Scene2100::Action12::signal() {
break;
}
case 6:
- _globals->_player.setStrip(4);
+ g_globals->_player.setStrip(4);
scene->_object2.setStrip(4);
setDelay(60);
break;
case 7:
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start(6052, this);
break;
case 8:
if (scene->_stripManager._field2E8 == 320)
- _globals->setFlag(74);
+ g_globals->setFlag(74);
setDelay(30);
break;
case 9:
- _globals->_events.setCursor(OBJECT_STUNNER);
+ g_globals->_events.setCursor(OBJECT_STUNNER);
scene->_object2.setAction(&scene->_action13);
setDelay(60);
break;
case 10:
- if (_globals->getFlag(74))
+ if (g_globals->getFlag(74))
setDelay(1);
else
- setAction(&scene->_sequenceManager, this, 2101, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager, this, 2101, &g_globals->_player, NULL);
break;
case 11:
scene->_stripManager.start(2170, this);
@@ -1032,14 +1032,14 @@ void Scene2100::Action12::signal() {
setDelay(5);
break;
case 13:
- scene->_stripManager.start(_globals->getFlag(74) ? 2172 : 2174, this);
+ scene->_stripManager.start(g_globals->getFlag(74) ? 2172 : 2174, this);
break;
case 14:
- if (_globals->getFlag(74)) {
- _globals->_stripNum = 6100;
- _globals->_sceneManager.changeScene(2320);
+ if (g_globals->getFlag(74)) {
+ g_globals->_stripNum = 6100;
+ g_globals->_sceneManager.changeScene(2320);
} else {
- _globals->_sceneManager.changeScene(6100);
+ g_globals->_sceneManager.changeScene(6100);
}
remove();
break;
@@ -1047,7 +1047,7 @@ void Scene2100::Action12::signal() {
}
void Scene2100::Action13::signal() {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -1082,17 +1082,17 @@ void Scene2100::Action13::signal() {
}
void Scene2100::Action14::signal() {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(6);
break;
case 1:
- setAction(&scene->_sequenceManager, this, 2104, &_globals->_player, &scene->_object1, NULL);
+ setAction(&scene->_sequenceManager, this, 2104, &g_globals->_player, &scene->_object1, NULL);
break;
case 2:
- setAction(&scene->_sequenceManager, this, 2101, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager, this, 2101, &g_globals->_player, NULL);
break;
case 3:
scene->_stripManager.start(6008, this);
@@ -1160,14 +1160,14 @@ void Scene2100::Action14::signal() {
setDelay(90);
break;
case 15:
- _globals->_sceneManager.changeScene(7000);
+ g_globals->_sceneManager.changeScene(7000);
remove();
break;
}
}
void Scene2100::Action15::signal() {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -1232,7 +1232,7 @@ void Scene2100::Action15::signal() {
}
void Scene2100::Action16::signal() {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -1243,13 +1243,13 @@ void Scene2100::Action16::signal() {
scene->_stripManager.start(7001, this);
break;
case 2:
- setAction(&scene->_sequenceManager, this, 2102, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager, this, 2102, &g_globals->_player, NULL);
break;
case 3: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
Common::Point pt(155, 63);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 5:
@@ -1259,12 +1259,12 @@ void Scene2100::Action16::signal() {
case 6: {
Common::Point pt(160, 54);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 7:
- _globals->_player.fixPriority(1);
- _globals->_player.setStrip(3);
+ g_globals->_player.fixPriority(1);
+ g_globals->_player.setStrip(3);
setDelay(45);
break;
case 8:
@@ -1272,26 +1272,26 @@ void Scene2100::Action16::signal() {
scene->_object1.animate(ANIM_MODE_6, this);
break;
case 9:
- _globals->setFlag(15);
- _globals->setFlag(36);
- _globals->_sceneManager.changeScene(7000);
+ g_globals->setFlag(15);
+ g_globals->setFlag(36);
+ g_globals->_sceneManager.changeScene(7000);
remove();
break;
}
}
void Scene2100::Action17::signal() {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(60);
break;
case 1:
- setAction(&scene->_sequenceManager, this, 2104, &_globals->_player, &scene->_object1, NULL);
+ setAction(&scene->_sequenceManager, this, 2104, &g_globals->_player, &scene->_object1, NULL);
break;
case 2:
- setAction(&scene->_sequenceManager, this, 2101, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager, this, 2101, &g_globals->_player, NULL);
break;
case 3:
scene->_stripManager.start(7070, this);
@@ -1317,7 +1317,7 @@ void Scene2100::Action17::signal() {
break;
case 8:
RING_INVENTORY._stasisNegator._sceneNumber = 1;
- _globals->_sceneManager.changeScene(9100);
+ g_globals->_sceneManager.changeScene(9100);
remove();
break;
}
@@ -1326,17 +1326,17 @@ void Scene2100::Action17::signal() {
/*--------------------------------------------------------------------------*/
void Scene2100::Hotspot2::doAction(int action) {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2100, 3);
break;
case CURSOR_USE:
- if (_globals->getFlag(13))
+ if (g_globals->getFlag(13))
SceneItem::display2(2100, 29);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action4);
}
break;
@@ -1348,17 +1348,17 @@ void Scene2100::Hotspot2::doAction(int action) {
void Scene2100::Hotspot3::doAction(int action) {
// Computer, on the left
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2100, 4);
break;
case CURSOR_USE:
- if (_globals->getFlag(13))
+ if (g_globals->getFlag(13))
SceneItem::display2(2100, 29);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action4);
}
break;
@@ -1383,17 +1383,17 @@ void Scene2100::Hotspot4::doAction(int action) {
}
void Scene2100::Hotspot8::doAction(int action) {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2100, 12);
break;
case CURSOR_USE:
- if (_globals->getFlag(13))
+ if (g_globals->getFlag(13))
SceneItem::display2(2100, 29);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action4);
}
break;
@@ -1405,7 +1405,7 @@ void Scene2100::Hotspot8::doAction(int action) {
void Scene2100::Hotspot10::doAction(int action) {
// Quinn's Console
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -1413,15 +1413,15 @@ void Scene2100::Hotspot10::doAction(int action) {
break;
case CURSOR_USE:
if (scene->_sitFl) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 2102;
- scene->setAction(&scene->_sequenceManager, scene, 2102, &_globals->_player, NULL);
- } else if (_globals->getFlag(13)) {
+ scene->setAction(&scene->_sequenceManager, scene, 2102, &g_globals->_player, NULL);
+ } else if (g_globals->getFlag(13)) {
SceneItem::display2(2100, 28);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 2101;
- scene->setAction(&scene->_sequenceManager, scene, 2101, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 2101, &g_globals->_player, NULL);
}
break;
default:
@@ -1433,13 +1433,13 @@ void Scene2100::Hotspot10::doAction(int action) {
void Scene2100::Hotspot14::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(0))
+ if (g_globals->getFlag(0))
SceneItem::display2(2100, 19);
else
SceneItem::display2(2100, 18);
break;
case CURSOR_USE:
- if (_globals->getFlag(1))
+ if (g_globals->getFlag(1))
SceneItem::display2(2100, 21);
else
SceneItem::display2(2100, 20);
@@ -1452,7 +1452,7 @@ void Scene2100::Hotspot14::doAction(int action) {
void Scene2100::Object1::doAction(int action) {
// Elevator
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -1468,29 +1468,29 @@ void Scene2100::Object1::doAction(int action) {
}
void Scene2100::Object2::doAction(int action) {
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2100, 30);
break;
case CURSOR_TALK:
- if (_globals->getFlag(72)) {
- _globals->_player.disableControl();
- if (!_globals->getFlag(52)) {
+ if (g_globals->getFlag(72)) {
+ g_globals->_player.disableControl();
+ if (!g_globals->getFlag(52)) {
scene->_sceneMode = 2111;
scene->setAction(&scene->_sequenceManager, scene, 2111, NULL);
} else {
- scene->_sceneMode = _globals->getFlag(53) ? 2112 : 2110;
+ scene->_sceneMode = g_globals->getFlag(53) ? 2112 : 2110;
scene->setAction(&scene->_sequenceManager, scene, scene->_sceneMode, NULL);
}
- } else if (_globals->getFlag(13)) {
+ } else if (g_globals->getFlag(13)) {
SceneItem::display2(2100, 31);
- } else if (_globals->getFlag(14)) {
+ } else if (g_globals->getFlag(14)) {
SceneItem::display2(2100, 32);
} else {
- _globals->setFlag(14);
- _globals->_player.disableControl();
+ g_globals->setFlag(14);
+ g_globals->_player.disableControl();
scene->_sceneMode = 2108;
scene->setAction(&scene->_sequenceManager, scene, 2109, NULL);
}
@@ -1503,19 +1503,19 @@ void Scene2100::Object2::doAction(int action) {
void Scene2100::Object3::doAction(int action) {
// Miranda
- Scene2100 *scene = (Scene2100 *)_globals->_sceneManager._scene;
+ Scene2100 *scene = (Scene2100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(59))
+ if (g_globals->getFlag(59))
SceneItem::display2(2100, 34);
else
error("***I have no response.");
break;
case CURSOR_TALK:
- if (_globals->getFlag(59)) {
- _globals->_player.disableControl();
+ if (g_globals->getFlag(59)) {
+ g_globals->_player.disableControl();
scene->_sceneMode = 2108;
scene->setAction(&scene->_sequenceManager, scene, 2108, NULL);
} else {
@@ -1566,7 +1566,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerHText);
_stripManager.addSpeaker(&_speakerGameText);
_speakerMText._npc = &_object3;
- _speakerQText._npc = &_globals->_player;
+ _speakerQText._npc = &g_globals->_player;
_speakerSText._npc = &_object2;
_object1.postInit();
@@ -1646,7 +1646,7 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_hotspot15.setBounds(Rect(14, 90, 46, 107));
_hotspot1.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- if (!_globals->getFlag(36) && !_globals->getFlag(70) && !_globals->getFlag(43)) {
+ if (!g_globals->getFlag(36) && !g_globals->getFlag(70) && !g_globals->getFlag(43)) {
_object3.postInit();
_object3.setPosition(Common::Point(246, 156));
_object3.animate(ANIM_MODE_NONE, NULL);
@@ -1655,10 +1655,10 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_object3.setVisage(2107);
_object3.setStrip(1);
_object3.setAction(&_action2);
- _globals->_sceneItems.push_back(&_object3);
+ g_globals->_sceneItems.push_back(&_object3);
}
- if (!_globals->getFlag(59) && !_globals->getFlag(70) && !_globals->getFlag(37) && !_globals->getFlag(114)) {
+ if (!g_globals->getFlag(59) && !g_globals->getFlag(70) && !g_globals->getFlag(37) && !g_globals->getFlag(114)) {
_object2.postInit();
_object2.setVisage(2108);
_object2._strip = 3;
@@ -1667,50 +1667,50 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_object2.changeZoom(100);
_object2.fixPriority(113);
_object2.setAction(&_action3);
- _globals->_sceneItems.push_back(&_object2);
+ g_globals->_sceneItems.push_back(&_object2);
}
- _globals->_sceneItems.addItems(&_hotspot15, &_hotspot11, &_hotspot10, &_hotspot9, &_hotspot14,
+ g_globals->_sceneItems.addItems(&_hotspot15, &_hotspot11, &_hotspot10, &_hotspot9, &_hotspot14,
&_hotspot13, &_hotspot12, &_hotspot8, &_object1, &_hotspot2, &_hotspot3, &_hotspot4, &_hotspot5,
&_hotspot6, &_hotspot7, &_hotspot1, NULL);
- _globals->_player.postInit();
- if (_globals->getFlag(13)) {
- _globals->_player.setVisage(2170);
- _globals->_player._moveDiff.y = 1;
+ g_globals->_player.postInit();
+ if (g_globals->getFlag(13)) {
+ g_globals->_player.setVisage(2170);
+ g_globals->_player._moveDiff.y = 1;
} else {
- _globals->_player.setVisage(0);
- _globals->_player._moveDiff.y = 3;
+ g_globals->_player.setVisage(0);
+ g_globals->_player._moveDiff.y = 3;
}
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player._moveDiff.x = 4;
- _globals->_player.changeZoom(-1);
- _globals->_player.disableControl();
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player._moveDiff.x = 4;
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player.disableControl();
_sitFl = 0;
- switch (_globals->_sceneManager._previousScene) {
+ switch (g_globals->_sceneManager._previousScene) {
case 2120:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
_object1.fixPriority(-1);
- _globals->_player.fixPriority(-1);
- _globals->_player.setPosition(Common::Point(80, 66));
- _globals->_player.enableControl();
+ g_globals->_player.fixPriority(-1);
+ g_globals->_player.setPosition(Common::Point(80, 66));
+ g_globals->_player.enableControl();
break;
case 2150:
- _globals->_player.fixPriority(1);
- _globals->_player.setPosition(Common::Point(157, 56));
+ g_globals->_player.fixPriority(1);
+ g_globals->_player.setPosition(Common::Point(157, 56));
_sceneMode = 2104;
- setAction(&_sequenceManager, this, 2104, &_globals->_player, &_object1, NULL);
+ setAction(&_sequenceManager, this, 2104, &g_globals->_player, &_object1, NULL);
break;
case 2222:
- if (_globals->_sceneObjects->contains(&_object3))
+ if (g_globals->_sceneObjects->contains(&_object3))
_object3.remove();
- _globals->_player.fixPriority(1);
- _globals->_player.setPosition(Common::Point(144, 55));
+ g_globals->_player.fixPriority(1);
+ g_globals->_player.setPosition(Common::Point(144, 55));
_object2.setVisage(2806);
_object2.changeZoom(-1);
@@ -1723,12 +1723,12 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
setAction(&_action12);
break;
case 2320:
- if (_globals->_stripNum == 2321) {
- if (_globals->_sceneObjects->contains(&_object3))
+ if (g_globals->_stripNum == 2321) {
+ if (g_globals->_sceneObjects->contains(&_object3))
_object3.remove();
- _globals->_player.fixPriority(1);
- _globals->_player.setPosition(Common::Point(144, 55));
+ g_globals->_player.fixPriority(1);
+ g_globals->_player.setPosition(Common::Point(144, 55));
_object2.postInit();
_object2.setVisage(2806);
@@ -1741,9 +1741,9 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
_object2.animate(ANIM_MODE_1, NULL);
setAction(&_action12);
- } else if (_globals->_stripNum == 6100) {
- _globals->_player.setPosition(Common::Point(157, 56));
- _globals->_player.fixPriority(1);
+ } else if (g_globals->_stripNum == 6100) {
+ g_globals->_player.setPosition(Common::Point(157, 56));
+ g_globals->_player.fixPriority(1);
_object4.postInit();
_object4.setVisage(2102);
@@ -1752,27 +1752,27 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
setAction(&_action14);
} else {
- _globals->_player.disableControl();
- _globals->_player.fixPriority(1);
- _globals->_player.setPosition(Common::Point(157, 56));
+ g_globals->_player.disableControl();
+ g_globals->_player.fixPriority(1);
+ g_globals->_player.setPosition(Common::Point(157, 56));
_sceneMode = 2104;
- setAction(&_sequenceManager, this, 2104, &_globals->_player, &_object1, NULL);
+ setAction(&_sequenceManager, this, 2104, &g_globals->_player, &_object1, NULL);
}
break;
case 3700:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
Scene::setZoomPercents(80, 75, 100, 90);
- if (_globals->_sceneObjects->contains(&_object2))
+ if (g_globals->_sceneObjects->contains(&_object2))
_object2.remove();
- _globals->_player._angle = 225;
- _globals->_player.setStrip(6);
- _globals->_player.setFrame(1);
- _globals->_player.fixPriority(-1);
- _globals->_player.setPosition(Common::Point(272, 127));
+ g_globals->_player._angle = 225;
+ g_globals->_player.setStrip(6);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.fixPriority(-1);
+ g_globals->_player.setPosition(Common::Point(272, 127));
_object3.setPosition(Common::Point(246, 156));
_object3.fixPriority(156);
@@ -1780,15 +1780,15 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
setAction(&_sequenceManager, this, 2105, &_object3, NULL);
break;
case 4250:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
- _globals->clearFlag(43);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
+ g_globals->clearFlag(43);
- _globals->_player.setVisage(2104);
- _globals->_player.setFrame(1);
- _globals->_player.setPosition(Common::Point(65, 149));
- _globals->_player.fixPriority(152);
- _globals->_player.setStrip(2);
+ g_globals->_player.setVisage(2104);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.setPosition(Common::Point(65, 149));
+ g_globals->_player.fixPriority(152);
+ g_globals->_player.setStrip(2);
_object4.postInit();
_object4.setVisage(2102);
@@ -1799,16 +1799,16 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
setAction(&_sequenceManager, this, 2107, &_object4, NULL);
break;
case 5000:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
- if (_globals->_sceneObjects->contains(&_object2))
+ if (g_globals->_sceneObjects->contains(&_object2))
_object2.remove();
- _globals->_player.setStrip(3);
- _globals->_player.setFrame(1);
- _globals->_player.fixPriority(1);
- _globals->_player.setPosition(Common::Point(157, 56));
+ g_globals->_player.setStrip(3);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.fixPriority(1);
+ g_globals->_player.setPosition(Common::Point(157, 56));
_object3.setPosition(Common::Point(246, 156));
_object3.fixPriority(156);
@@ -1816,13 +1816,13 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
setAction(&_action5);
break;
case 5100:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
- _globals->_player.setVisage(2104);
- _globals->_player.setFrame(1);
- _globals->_player.setPosition(Common::Point(65, 149));
- _globals->_player.fixPriority(152);
- _globals->_player.setStrip(2);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
+ g_globals->_player.setVisage(2104);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.setPosition(Common::Point(65, 149));
+ g_globals->_player.fixPriority(152);
+ g_globals->_player.setStrip(2);
_sitFl = 1;
@@ -1835,67 +1835,67 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
setAction(&_action9);
break;
case 7000:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
if (RING_INVENTORY._stasisBox2._sceneNumber == 1) {
- _globals->_player.fixPriority(1);
- _globals->_player.setPosition(Common::Point(157, 56));
+ g_globals->_player.fixPriority(1);
+ g_globals->_player.setPosition(Common::Point(157, 56));
_object4.postInit();
_object4.setVisage(2102);
_object4.setPosition(Common::Point(160, 199));
_object4.hide();
- _globals->clearFlag(15);
- _globals->clearFlag(109);
- _globals->clearFlag(72);
+ g_globals->clearFlag(15);
+ g_globals->clearFlag(109);
+ g_globals->clearFlag(72);
setAction(&_action17);
} else {
- _globals->_player.setVisage(2104);
- _globals->_player.setFrame(1);
- _globals->_player.setPosition(Common::Point(65, 149));
- _globals->_player.fixPriority(152);
- _globals->_player.setStrip(2);
+ g_globals->_player.setVisage(2104);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.setPosition(Common::Point(65, 149));
+ g_globals->_player.fixPriority(152);
+ g_globals->_player.setStrip(2);
_sitFl = 1;
setAction(&_action16);
}
break;
case 7600:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
- if (_globals->_sceneObjects->contains(&_object2))
+ if (g_globals->_sceneObjects->contains(&_object2))
_object2.remove();
- _globals->_player.fixPriority(1);
- _globals->_player.setPosition(Common::Point(157, 56));
+ g_globals->_player.fixPriority(1);
+ g_globals->_player.setPosition(Common::Point(157, 56));
setAction(&_action8);
break;
case 8100:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
- _globals->_player.setVisage(2104);
- _globals->_player.setFrame(1);
- _globals->_player.setPosition(Common::Point(65, 149));
- _globals->_player.fixPriority(152);
- _globals->_player.setStrip(2);
+ g_globals->_player.setVisage(2104);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.setPosition(Common::Point(65, 149));
+ g_globals->_player.fixPriority(152);
+ g_globals->_player.setStrip(2);
_sceneMode = 2106;
setAction(&_sequenceManager, this, 2106, NULL);
break;
case 9750:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
- _globals->_player.setVisage(2104);
- _globals->_player.setFrame(1);
- _globals->_player.setPosition(Common::Point(65, 149));
- _globals->_player.fixPriority(152);
- _globals->_player.setStrip(2);
+ g_globals->_player.setVisage(2104);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.setPosition(Common::Point(65, 149));
+ g_globals->_player.fixPriority(152);
+ g_globals->_player.setStrip(2);
_object4.postInit();
_object4.setVisage(2102);
@@ -1906,15 +1906,15 @@ void Scene2100::postInit(SceneObjectList *OwnerList) {
setAction(&_sequenceManager, this, 2103, &_object4, NULL);
break;
default:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
- _globals->_player._uiEnabled = true;
+ g_globals->_player._uiEnabled = true;
break;
}
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
}
void Scene2100::stripCallback(int v) {
@@ -1933,22 +1933,22 @@ void Scene2100::signal() {
switch (_sceneMode) {
case 2101:
_sitFl = 1;
- _globals->_player._uiEnabled = true;
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_player._uiEnabled = true;
+ g_globals->_events.setCursor(CURSOR_USE);
break;
case 2102:
_sitFl = 0;
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 2103:
- _globals->_stripNum = 9000;
- _globals->_sceneManager.changeScene(4000);
+ g_globals->_stripNum = 9000;
+ g_globals->_sceneManager.changeScene(4000);
break;
case 2106:
- _globals->_sceneManager.changeScene(7000);
+ g_globals->_sceneManager.changeScene(7000);
break;
case 2107:
- _globals->_sceneManager.changeScene(5000);
+ g_globals->_sceneManager.changeScene(5000);
break;
case 2104:
case 2105:
@@ -1956,7 +1956,7 @@ void Scene2100::signal() {
case 2110:
case 2111:
case 2112:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
}
}
@@ -2009,12 +2009,12 @@ Scene2120::Action1::Action1() {
}
void Scene2120::Action1::signal() {
- Scene2120 *scene = (Scene2120 *)_globals->_sceneManager._scene;
+ Scene2120 *scene = (Scene2120 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(30);
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
break;
case 1:
// First page of index
@@ -2047,10 +2047,10 @@ void Scene2120::Action1::signal() {
}
void Scene2120::Action1::dispatch() {
- Scene2120 *scene = (Scene2120 *)_globals->_sceneManager._scene;
+ Scene2120 *scene = (Scene2120 *)g_globals->_sceneManager._scene;
Event event;
- if (_globals->_events.getEvent(event) && (event.eventType == EVENT_BUTTON_DOWN)) {
+ if (g_globals->_events.getEvent(event) && (event.eventType == EVENT_BUTTON_DOWN)) {
if (scene->_listRect.contains(event.mousePos) && (scene->_dbMode != 2)) {
scene->_topicArrowHotspot.setPosition(Common::Point(scene->_topicArrowHotspot._position.x, event.mousePos.y));
}
@@ -2066,8 +2066,8 @@ void Scene2120::Action1::dispatch() {
else
scene->_subjectIndex = (scene->_topicArrowHotspot._position.y - 44) / 8 + 16;
- if ((scene->_subjectIndex == 27) && _globals->getFlag(70))
- _globals->setFlag(75);
+ if ((scene->_subjectIndex == 27) && g_globals->getFlag(70))
+ g_globals->setFlag(75);
scene->_topicArrowHotspot.hide();
scene->_prevDbMode = scene->_dbMode;
@@ -2144,9 +2144,9 @@ void Scene2120::Action1::dispatch() {
setAction(NULL);
SceneItem::display(0, 0);
- _globals->_gfxManagerInstance._font.setFontNumber(2);
- _globals->_sceneText._fontNumber = 2;
- _globals->_sceneManager.changeScene(_globals->_sceneManager._previousScene);
+ g_globals->_gfxManagerInstance._font.setFontNumber(2);
+ g_globals->_sceneText._fontNumber = 2;
+ g_globals->_sceneManager.changeScene(g_globals->_sceneManager._previousScene);
} else {
// Exit out of topic display to index
SceneItem::display(0, 0);
@@ -2184,7 +2184,7 @@ Scene2120::Scene2120(): Scene() {
void Scene2120::postInit(SceneObjectList *OwnerList) {
loadScene(2120);
setZoomPercents(0, 100, 200, 100);
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_subjectButton.setBounds(Rect(266, 13, 320, 56));
_nextPageButton.setBounds(Rect(266, 56, 320, 98));
@@ -2203,8 +2203,8 @@ void Scene2120::postInit(SceneObjectList *OwnerList) {
_arrowHotspot.setPosition(Common::Point(400, 200));
setAction(&_action1);
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
}
void Scene2120::synchronize(Serializer &s) {
@@ -2223,14 +2223,14 @@ void Scene2120::synchronize(Serializer &s) {
*--------------------------------------------------------------------------*/
void Scene2150::Action1::signal() {
- Scene2150 *scene = (Scene2150 *)_globals->_sceneManager._scene;
+ Scene2150 *scene = (Scene2150 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
Common::Point pt(158, 103);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 1:
@@ -2238,15 +2238,15 @@ void Scene2150::Action1::signal() {
scene->_hotspot1.animate(ANIM_MODE_5, this);
break;
case 2: {
- _globals->_player.setStrip2(4);
+ g_globals->_player.setStrip2(4);
Common::Point pt(158, 95);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 3:
- _globals->_player.setStrip2(-1);
- _globals->_player._strip = 3;
+ g_globals->_player.setStrip2(-1);
+ g_globals->_player._strip = 3;
setDelay(10);
break;
case 4:
@@ -2257,12 +2257,12 @@ void Scene2150::Action1::signal() {
scene->_area2.draw(true);
_state = 0;
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
- while (!_state && !_vm->shouldQuit()) {
+ while (!_state && !g_vm->shouldQuit()) {
// Wait for an event
Event event;
- if (!_globals->_events.getEvent(event)) {
+ if (!g_globals->_events.getEvent(event)) {
g_system->updateScreen();
g_system->delayMillis(10);
continue;
@@ -2301,10 +2301,10 @@ void Scene2150::Action1::signal() {
if (_state == 2150) {
Common::Point pt(158, 103);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
} else {
- _globals->_sceneManager.changeScene(_state);
+ g_globals->_sceneManager.changeScene(_state);
}
break;
case 6:
@@ -2312,28 +2312,28 @@ void Scene2150::Action1::signal() {
scene->_hotspot1.animate(ANIM_MODE_6, this);
break;
case 7:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene2150::Action2::signal() {
- Scene2150 *scene = (Scene2150 *)_globals->_sceneManager._scene;
+ Scene2150 *scene = (Scene2150 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
Common::Point pt(47, 85);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 1:
- _globals->_player.setVisage(2152);
- _globals->_player.setFrame(1);
- _globals->_player.setStrip(8);
- _globals->_player.animate(ANIM_MODE_8, 1, this);
+ g_globals->_player.setVisage(2152);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.setStrip(8);
+ g_globals->_player.animate(ANIM_MODE_8, 1, this);
scene->_soundHandler.play(163);
break;
@@ -2342,7 +2342,7 @@ void Scene2150::Action2::signal() {
scene->_hotspot10.animate(ANIM_MODE_5, this);
break;
case 3:
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start((RING_INVENTORY._ale._sceneNumber == 2150) ? 2151 : 2152, this);
break;
case 4:
@@ -2358,21 +2358,21 @@ void Scene2150::Action2::signal() {
scene->_hotspot14.setFrame(scene->_stripManager._field2E8 - 5);
}
- _globals->_player.setFrame(1);
- _globals->_player.setStrip(7);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.setStrip(7);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 5:
scene->_soundHandler.play(164);
scene->_hotspot10.animate(ANIM_MODE_6, NULL);
scene->_hotspot14.remove();
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 6:
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.enableControl();
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.enableControl();
remove();
break;
@@ -2382,7 +2382,7 @@ void Scene2150::Action2::signal() {
/*--------------------------------------------------------------------------*/
void Scene2150::Hotspot1::doAction(int action) {
- Scene2150 *scene = (Scene2150 *)_globals->_sceneManager._scene;
+ Scene2150 *scene = (Scene2150 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -2398,16 +2398,16 @@ void Scene2150::Hotspot1::doAction(int action) {
}
void Scene2150::Hotspot2::doAction(int action) {
- Scene2150 *scene = (Scene2150 *)_globals->_sceneManager._scene;
+ Scene2150 *scene = (Scene2150 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2150, 1);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 2156;
- scene->setAction(&scene->_sequenceManager, scene, 2156, &_globals->_player, this, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 2156, &g_globals->_player, this, NULL);
break;
default:
SceneHotspot::doAction(action);
@@ -2416,16 +2416,16 @@ void Scene2150::Hotspot2::doAction(int action) {
}
void Scene2150::Hotspot4::doAction(int action) {
- Scene2150 *scene = (Scene2150 *)_globals->_sceneManager._scene;
+ Scene2150 *scene = (Scene2150 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2150, 3);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 2155;
- scene->setAction(&scene->_sequenceManager, scene, 2155, &_globals->_player, &scene->_hotspot4, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 2155, &g_globals->_player, &scene->_hotspot4, NULL);
break;
default:
SceneHotspot::doAction(action);
@@ -2434,19 +2434,19 @@ void Scene2150::Hotspot4::doAction(int action) {
}
void Scene2150::Hotspot7::doAction(int action) {
- Scene2150 *scene = (Scene2150 *)_globals->_sceneManager._scene;
+ Scene2150 *scene = (Scene2150 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2150, 7);
break;
case CURSOR_USE:
- if (_globals->getFlag(13))
+ if (g_globals->getFlag(13))
SceneItem::display2(2150, 19);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 2154;
- scene->setAction(&scene->_sequenceManager, scene, 2154, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 2154, &g_globals->_player, NULL);
}
break;
default:
@@ -2456,14 +2456,14 @@ void Scene2150::Hotspot7::doAction(int action) {
}
void Scene2150::Hotspot10::doAction(int action) {
- Scene2150 *scene = (Scene2150 *)_globals->_sceneManager._scene;
+ Scene2150 *scene = (Scene2150 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2150, 10);
break;
case CURSOR_USE:
- if (_globals->getFlag(13))
+ if (g_globals->getFlag(13))
SceneItem::display2(2150, 19);
else
scene->setAction(&scene->_action2);
@@ -2544,60 +2544,60 @@ void Scene2150::postInit(SceneObjectList *OwnerList) {
_hotspot10.setStrip(5);
_hotspot10.setPosition(Common::Point(59, 56));
- _globals->_player.postInit();
- _globals->_player.setVisage(_globals->getFlag(13) ? 2170 : 0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.fixPriority(-1);
- _globals->_player.changeZoom(-1);
- _globals->_player._moveDiff.y = 3;
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(g_globals->getFlag(13) ? 2170 : 0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.fixPriority(-1);
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player._moveDiff.y = 3;
_hotspot8.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
_hotspot9.setBounds(Rect(133, 0, 198, 91));
_hotspot11.setBounds(Rect(142, 119, 176, 158));
- _globals->_sceneItems.addItems(&_hotspot1, &_hotspot2, &_hotspot3, &_hotspot4, &_hotspot5,
+ g_globals->_sceneItems.addItems(&_hotspot1, &_hotspot2, &_hotspot3, &_hotspot4, &_hotspot5,
&_hotspot6, &_hotspot7, &_hotspot10, &_hotspot9, &_hotspot11, &_hotspot8, NULL);
- switch (_globals->_sceneManager._previousScene) {
+ switch (g_globals->_sceneManager._previousScene) {
case 2120:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
- _globals->_player.setPosition(Common::Point(108, 99));
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
+ g_globals->_player.setPosition(Common::Point(108, 99));
break;
case 2200:
- _globals->_player.disableControl();
- _globals->_player.setPosition(Common::Point(159, 240));
+ g_globals->_player.disableControl();
+ g_globals->_player.setPosition(Common::Point(159, 240));
_sceneMode = 2152;
- setAction(&_sequenceManager, this, 2152, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 2152, &g_globals->_player, NULL);
break;
case 2280:
- _globals->_player.disableControl();
- _globals->_player._angle = 180;
- _globals->_player.setPosition(Common::Point(265, 80));
+ g_globals->_player.disableControl();
+ g_globals->_player._angle = 180;
+ g_globals->_player.setPosition(Common::Point(265, 80));
_hotspot2._frame = _hotspot2.getFrameCount();
_sceneMode = 2157;
setAction(&_sequenceManager, this, 2157, &_hotspot2, NULL);
break;
case 2230:
- _globals->_events.setCursor(CURSOR_WALK);
- _globals->_player._strip = 4;
- _globals->_player.setPosition(Common::Point(229, 139));
+ g_globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_player._strip = 4;
+ g_globals->_player.setPosition(Common::Point(229, 139));
break;
case 2100:
default:
- _globals->_player.disableControl();
- _globals->_player.setPosition(Common::Point(158, 95));
- _globals->_player.setStrip(3);
+ g_globals->_player.disableControl();
+ g_globals->_player.setPosition(Common::Point(158, 95));
+ g_globals->_player.setStrip(3);
_sceneMode = 2151;
- setAction(&_sequenceManager, this, 2151, &_globals->_player, &_hotspot1, NULL);
+ setAction(&_sequenceManager, this, 2151, &g_globals->_player, &_hotspot1, NULL);
break;
}
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
}
void Scene2150::synchronize(Serializer &s) {
@@ -2609,22 +2609,22 @@ void Scene2150::synchronize(Serializer &s) {
void Scene2150::signal() {
switch (_sceneMode) {
case 2151:
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.enableControl();
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.enableControl();
break;
case 2152:
case 2153:
case 2157:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 2154:
- _globals->_sceneManager.changeScene(2120);
+ g_globals->_sceneManager.changeScene(2120);
break;
case 2155:
- _globals->_sceneManager.changeScene(2230);
+ g_globals->_sceneManager.changeScene(2230);
break;
case 2156:
- _globals->_sceneManager.changeScene(2280);
+ g_globals->_sceneManager.changeScene(2280);
break;
}
}
@@ -2633,22 +2633,22 @@ void Scene2150::dispatch() {
Scene::dispatch();
if (!_action) {
- if (_rect1.contains(_globals->_player._position)) {
- _globals->_player.disableControl();
+ if (_rect1.contains(g_globals->_player._position)) {
+ g_globals->_player.disableControl();
_sceneMode = 2156;
- setAction(&_sequenceManager, this, 2156, &_globals->_player, &_hotspot2, NULL);
+ setAction(&_sequenceManager, this, 2156, &g_globals->_player, &_hotspot2, NULL);
}
- if (_rect2.contains(_globals->_player._position)) {
- _globals->_player.disableControl();
+ if (_rect2.contains(g_globals->_player._position)) {
+ g_globals->_player.disableControl();
_sceneMode = 2155;
- setAction(&_sequenceManager, this, 2155, &_globals->_player, &_hotspot4, NULL);
+ setAction(&_sequenceManager, this, 2155, &g_globals->_player, &_hotspot4, NULL);
}
- if (_globals->_player._position.y >= 196) {
- _globals->_player.disableControl();
+ if (g_globals->_player._position.y >= 196) {
+ g_globals->_player.disableControl();
SceneItem::display2(2150, 20);
_sceneMode = 2153;
- setAction(&_sequenceManager, this, 2153, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 2153, &g_globals->_player, NULL);
}
}
}
@@ -2659,7 +2659,7 @@ void Scene2150::dispatch() {
*--------------------------------------------------------------------------*/
void Scene2200::Action1::signal() {
- Scene2200 *scene = (Scene2200 *)_globals->_sceneManager._scene;
+ Scene2200 *scene = (Scene2200 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -2670,14 +2670,14 @@ void Scene2200::Action1::signal() {
break;
case 2:
SceneItem::display2(2200, 7);
- _globals->_sceneManager.changeScene(2150);
+ g_globals->_sceneManager.changeScene(2150);
remove();
break;
}
}
void Scene2200::Action2::signal() {
- Scene2200 *scene = (Scene2200 *)_globals->_sceneManager._scene;
+ Scene2200 *scene = (Scene2200 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -2694,20 +2694,20 @@ void Scene2200::Action2::signal() {
setDelay(30);
break;
case 4:
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start(2040, this, scene);
break;
case 5:
scene->_hotspot4.setStrip(4);
scene->_hotspot4.animate(ANIM_MODE_NONE, NULL);
- _globals->_player._uiEnabled = true;
+ g_globals->_player._uiEnabled = true;
remove();
break;
}
}
void Scene2200::Action3::signal() {
- Scene2200 *scene = (Scene2200 *)_globals->_sceneManager._scene;
+ Scene2200 *scene = (Scene2200 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
@@ -2715,7 +2715,7 @@ void Scene2200::Action3::signal() {
scene->_hotspot4.setStrip(4);
scene->_hotspot4.animate(ANIM_MODE_NONE, NULL);
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_hotspot2.postInit();
scene->_hotspot2.setVisage(2201);
@@ -2734,16 +2734,16 @@ void Scene2200::Action3::signal() {
setDelay(120);
break;
case 2:
- if (_globals->getFlag(83)) {
+ if (g_globals->getFlag(83)) {
_actionIndex = 8;
setDelay(5);
} else {
- for (SynchronizedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin();
- i != _globals->_sceneObjects->end(); ++i) {
+ for (SynchronizedList<SceneObject *>::iterator i = g_globals->_sceneObjects->begin();
+ i != g_globals->_sceneObjects->end(); ++i) {
(*i)->hide();
}
- _globals->_sceneManager._scene->loadScene(66);
+ g_globals->_sceneManager._scene->loadScene(66);
scene->_hotspot6.postInit();
scene->_hotspot6.setVisage(66);
@@ -2775,12 +2775,12 @@ void Scene2200::Action3::signal() {
setDelay(5);
break;
case 7:
- for (SynchronizedList<SceneObject *>::iterator i = _globals->_sceneObjects->begin();
- i != _globals->_sceneObjects->end(); ++i)
+ for (SynchronizedList<SceneObject *>::iterator i = g_globals->_sceneObjects->begin();
+ i != g_globals->_sceneObjects->end(); ++i)
(*i)->show();
scene->_hotspot6.remove();
- _globals->_sceneManager._scene->loadScene(2200);
+ g_globals->_sceneManager._scene->loadScene(2200);
setDelay(5);
break;
case 8:
@@ -2791,7 +2791,7 @@ void Scene2200::Action3::signal() {
scene->_hotspot4.animate(ANIM_MODE_NONE, NULL);
break;
case 10:
- _globals->_sceneManager.changeScene(2000);
+ g_globals->_sceneManager.changeScene(2000);
remove();
break;
}
@@ -2808,7 +2808,7 @@ void Scene2200::Action3::process(Event &event) {
}
void Scene2200::Action4::signal() {
- Scene2200 *scene = (Scene2200 *)_globals->_sceneManager._scene;
+ Scene2200 *scene = (Scene2200 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -2823,7 +2823,7 @@ void Scene2200::Action4::signal() {
setDelay(10);
break;
case 3:
- _globals->_player._uiEnabled = true;
+ g_globals->_player._uiEnabled = true;
remove();
break;
}
@@ -2832,7 +2832,7 @@ void Scene2200::Action4::signal() {
/*--------------------------------------------------------------------------*/
void Scene2200::Hotspot3::doAction(int action) {
- Scene2200 *scene = (Scene2200 *)_globals->_sceneManager._scene;
+ Scene2200 *scene = (Scene2200 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -2842,7 +2842,7 @@ void Scene2200::Hotspot3::doAction(int action) {
SceneItem::display2(2200, 11);
break;
case CURSOR_TALK:
- _globals->_player._uiEnabled = false;
+ g_globals->_player._uiEnabled = false;
scene->setAction(&scene->_action4);
break;
default:
@@ -2852,7 +2852,7 @@ void Scene2200::Hotspot3::doAction(int action) {
}
void Scene2200::Hotspot5::doAction(int action) {
- Scene2200 *scene = (Scene2200 *)_globals->_sceneManager._scene;
+ Scene2200 *scene = (Scene2200 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -2863,7 +2863,7 @@ void Scene2200::Hotspot5::doAction(int action) {
break;
case CURSOR_TALK:
scene->_sceneMode = 2201;
- _globals->_player._uiEnabled = false;
+ g_globals->_player._uiEnabled = false;
scene->setAction(&scene->_sequenceManager, scene, 2201, NULL);
break;
default:
@@ -2873,19 +2873,19 @@ void Scene2200::Hotspot5::doAction(int action) {
}
void Scene2200::Hotspot9::doAction(int action) {
- Scene2200 *scene = (Scene2200 *)_globals->_sceneManager._scene;
+ Scene2200 *scene = (Scene2200 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
- SceneItem::display2(2200, _globals->getFlag(8) ? 1 : 0);
+ SceneItem::display2(2200, g_globals->getFlag(8) ? 1 : 0);
break;
case CURSOR_USE:
SceneItem::display2(2200, 3);
break;
case OBJECT_INFODISK:
- if (_globals->_sceneManager._previousScene == 2310) {
+ if (g_globals->_sceneManager._previousScene == 2310) {
scene->_soundHandler2.play(35);
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action3);
}
break;
@@ -2917,7 +2917,7 @@ void Scene2200::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerMR);
_stripManager.addSpeaker(&_speakerGameText);
- _speakerQText._npc = &_globals->_player;
+ _speakerQText._npc = &g_globals->_player;
_speakerSText._npc = &_hotspot5;
_speakerMText._npc = &_hotspot3;
@@ -2933,21 +2933,21 @@ void Scene2200::postInit(SceneObjectList *OwnerList) {
_hotspot8.setPosition(Common::Point(96, 184));
_hotspot8.fixPriority(236);
- _globals->_player.postInit();
- _globals->_player.setVisage(2640);
- _globals->_player.setFrame2(3);
- _globals->_player.setPosition(Common::Point(110, 233));
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(2640);
+ g_globals->_player.setFrame2(3);
+ g_globals->_player.setPosition(Common::Point(110, 233));
+ g_globals->_player.disableControl();
- switch (_globals->_sceneManager._previousScene) {
+ switch (g_globals->_sceneManager._previousScene) {
case 2150:
_hotspot5.remove();
_hotspot8.remove();
break;
case 4000:
- _globals->_soundHandler.play(100);
- _globals->_soundHandler.holdAt(true);
- _globals->_player.remove();
+ g_globals->_soundHandler.play(100);
+ g_globals->_soundHandler.holdAt(true);
+ g_globals->_player.remove();
_hotspot5.remove();
_hotspot8.remove();
@@ -2977,20 +2977,20 @@ void Scene2200::postInit(SceneObjectList *OwnerList) {
_hotspot3.postInit();
_hotspot3.setVisage(2215);
_hotspot3.setPosition(Common::Point(144, 132));
- _globals->_sceneItems.push_back(&_hotspot3);
+ g_globals->_sceneItems.push_back(&_hotspot3);
_hotspot4.postInit();
_hotspot4.setVisage(2215);
_hotspot4._strip = 2;
_hotspot4.setPosition(Common::Point(120, 78));
_hotspot4.fixPriority(255);
- _globals->_sceneItems.push_back(&_hotspot4);
+ g_globals->_sceneItems.push_back(&_hotspot4);
_soundHandler1.play(101);
_soundHandler2.play(100);
- _globals->_soundHandler.holdAt(true);
+ g_globals->_soundHandler.holdAt(true);
- _globals->_sceneItems.push_back(&_hotspot5);
+ g_globals->_sceneItems.push_back(&_hotspot5);
setAction(&_action2);
break;
}
@@ -2999,9 +2999,9 @@ void Scene2200::postInit(SceneObjectList *OwnerList) {
_hotspot9.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
_hotspot10.setBounds(Rect(87, 43, 149, 109));
- _globals->_sceneItems.addItems(&_hotspot10, &_hotspot9, NULL);
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
+ g_globals->_sceneItems.addItems(&_hotspot10, &_hotspot9, NULL);
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
}
void Scene2200::stripCallback(int v) {
@@ -3024,15 +3024,15 @@ void Scene2200::synchronize(Serializer &s) {
void Scene2200::signal() {
if ((_sceneMode == 2201) || (_sceneMode == 2202))
- _globals->_player._uiEnabled = true;
+ g_globals->_player._uiEnabled = true;
}
void Scene2200::dispatch() {
Scene::dispatch();
if (!_action) {
- if (_exitRect.contains(_globals->_player._position))
- _globals->_sceneManager.changeScene(2150);
+ if (_exitRect.contains(g_globals->_player._position))
+ g_globals->_sceneManager.changeScene(2150);
}
}
@@ -3042,7 +3042,7 @@ void Scene2200::dispatch() {
*--------------------------------------------------------------------------*/
void Scene2222::Action1::signal() {
- Scene2222 *scene = (Scene2222 *)_globals->_sceneManager._scene;
+ Scene2222 *scene = (Scene2222 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -3055,13 +3055,13 @@ void Scene2222::Action1::signal() {
setDelay(30);
break;
case 3:
- _globals->_sceneManager.changeScene(1000);
+ g_globals->_sceneManager.changeScene(1000);
break;
}
}
void Scene2222::Action2::signal() {
- Scene2222 *scene = (Scene2222 *)_globals->_sceneManager._scene;
+ Scene2222 *scene = (Scene2222 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -3074,8 +3074,8 @@ void Scene2222::Action2::signal() {
setDelay(120);
break;
case 3:
- _globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
- _globals->_sceneManager.changeScene(2100);
+ g_globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
+ g_globals->_sceneManager.changeScene(2100);
break;
}
}
@@ -3083,7 +3083,7 @@ void Scene2222::Action2::signal() {
/*--------------------------------------------------------------------------*/
void Scene2222::postInit(SceneObjectList *OwnerList) {
- loadScene((_globals->_sceneManager._previousScene == 2000) ? 3400 : 3450);
+ loadScene((g_globals->_sceneManager._previousScene == 2000) ? 3400 : 3450);
Scene::postInit();
setZoomPercents(0, 100, 200, 100);
@@ -3123,7 +3123,7 @@ void Scene2222::postInit(SceneObjectList *OwnerList) {
_hotspot5.setFrame(5);
_hotspot5.animate(ANIM_MODE_2, 0);
- if (_globals->_sceneManager._previousScene == 2100) {
+ if (g_globals->_sceneManager._previousScene == 2100) {
_hotspot1.setPosition(Common::Point(61, 101));
_hotspot2.setPosition(Common::Point(239, 149));
_hotspot3.setPosition(Common::Point(184, 85));
@@ -3142,10 +3142,10 @@ void Scene2222::postInit(SceneObjectList *OwnerList) {
}
_soundHandler.play(116);
- _globals->_sceneManager._scene->_sceneBounds.center(_hotspot1._position);
+ g_globals->_sceneManager._scene->_sceneBounds.center(_hotspot1._position);
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
}
@@ -3155,7 +3155,7 @@ void Scene2222::postInit(SceneObjectList *OwnerList) {
*--------------------------------------------------------------------------*/
void Scene2230::Action1::signal() {
- Scene2230 *scene = (Scene2230 *)_globals->_sceneManager._scene;
+ Scene2230 *scene = (Scene2230 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -3174,7 +3174,7 @@ void Scene2230::Action1::signal() {
case 1: {
Common::Point pt(84, 74);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2:
@@ -3183,20 +3183,20 @@ void Scene2230::Action1::signal() {
case 3: {
Common::Point pt(63, 60);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 4:
scene->_hotspot1.animate(ANIM_MODE_6, this);
break;
case 5:
- _globals->_sceneManager.changeScene(2150);
+ g_globals->_sceneManager.changeScene(2150);
break;
}
}
void Scene2230::Action2::signal() {
- Scene2230 *scene = (Scene2230 *)_globals->_sceneManager._scene;
+ Scene2230 *scene = (Scene2230 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -3210,67 +3210,67 @@ void Scene2230::Action2::signal() {
}
break;
case 1: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_field30A = 1;
- _globals->_player._regionBitList |= ~0x80;
+ g_globals->_player._regionBitList |= ~0x80;
Common::Point pt(160, 96);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2:
- _globals->_player.setVisage(2235);
- _globals->_player.setStrip2(1);
- _globals->_player.fixPriority(100);
- _globals->_player._frame = 1;
- _globals->_player.setPosition(Common::Point(200, 68));
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(2235);
+ g_globals->_player.setStrip2(1);
+ g_globals->_player.fixPriority(100);
+ g_globals->_player._frame = 1;
+ g_globals->_player.setPosition(Common::Point(200, 68));
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 3:
scene->_soundHandler.play(157);
- _globals->_player._moveDiff = Common::Point(1, 1);
- _globals->_player.setAction(&scene->_action4);
- _globals->_player._uiEnabled = true;
+ g_globals->_player._moveDiff = Common::Point(1, 1);
+ g_globals->_player.setAction(&scene->_action4);
+ g_globals->_player._uiEnabled = true;
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
remove();
break;
}
}
void Scene2230::Action3::signal() {
- Scene2230 *scene = (Scene2230 *)_globals->_sceneManager._scene;
+ Scene2230 *scene = (Scene2230 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
- _globals->_player.setAction(NULL);
- _globals->_player._moveDiff = Common::Point(5, 3);
- _globals->_player.setStrip2(_globals->_player._strip);
+ g_globals->_player.setAction(NULL);
+ g_globals->_player._moveDiff = Common::Point(5, 3);
+ g_globals->_player.setStrip2(g_globals->_player._strip);
Common::Point pt(190, 74);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
scene->_soundHandler.stop();
break;
}
case 1:
- _globals->_player._strip = 3;
- _globals->_player._frame = 1;
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player._strip = 3;
+ g_globals->_player._frame = 1;
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 2:
- _globals->_player._regionBitList |= 0x80;
+ g_globals->_player._regionBitList |= 0x80;
scene->_field30A = 0;
- _globals->_player.setVisage(0);
- _globals->_player.setStrip2(-1);
- _globals->_player.fixPriority(-1);
- _globals->_player.setPosition(Common::Point(164, 96));
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player._canWalk = true;
+ g_globals->_player.setVisage(0);
+ g_globals->_player.setStrip2(-1);
+ g_globals->_player.fixPriority(-1);
+ g_globals->_player.setPosition(Common::Point(164, 96));
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player._canWalk = true;
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
remove();
}
}
@@ -3278,16 +3278,16 @@ void Scene2230::Action3::signal() {
void Scene2230::Action4::signal() {
switch (_actionIndex++) {
case 0:
- Common::Point pt(190 + _globals->_randomSource.getRandomNumber(9), 68);
+ Common::Point pt(190 + g_globals->_randomSource.getRandomNumber(9), 68);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
_actionIndex = 0;
break;
}
}
void Scene2230::Action5::signal() {
- Scene2230 *scene = (Scene2230 *)_globals->_sceneManager._scene;
+ Scene2230 *scene = (Scene2230 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -3301,22 +3301,22 @@ void Scene2230::Action5::signal() {
}
break;
case 1: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
Common::Point pt(209, 124);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2:
- _globals->_player.fixPriority(1430);
- _globals->_player.setVisage(2232);
- _globals->_player._strip = 1;
- _globals->_player._frame = 1;
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.fixPriority(1430);
+ g_globals->_player.setVisage(2232);
+ g_globals->_player._strip = 1;
+ g_globals->_player._frame = 1;
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 3:
- _globals->_events.setCursor(CURSOR_USE);
- _globals->_player._uiEnabled = true;
+ g_globals->_events.setCursor(CURSOR_USE);
+ g_globals->_player._uiEnabled = true;
scene->_field30A = 2;
remove();
break;
@@ -3324,32 +3324,32 @@ void Scene2230::Action5::signal() {
}
void Scene2230::Action6::signal() {
- Scene2230 *scene = (Scene2230 *)_globals->_sceneManager._scene;
+ Scene2230 *scene = (Scene2230 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player._strip = 2;
- _globals->_player._frame = 1;
- _globals->_player.fixPriority(-1);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player._strip = 2;
+ g_globals->_player._frame = 1;
+ g_globals->_player.fixPriority(-1);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 1:
scene->_field30A = 0;
- _globals->_player.setVisage(0);
- _globals->_player._strip = 1;
- _globals->_player._canWalk = true;
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setVisage(0);
+ g_globals->_player._strip = 1;
+ g_globals->_player._canWalk = true;
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
remove();
break;
}
}
void Scene2230::Action7::signal() {
- Scene2230 *scene = (Scene2230 *)_globals->_sceneManager._scene;
+ Scene2230 *scene = (Scene2230 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
switch (scene->_field30A) {
case 1:
@@ -3366,7 +3366,7 @@ void Scene2230::Action7::signal() {
case 1: {
Common::Point pt(140, 119);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2: {
@@ -3389,23 +3389,23 @@ void Scene2230::Action7::signal() {
scene->_hotspot8._frame = 2;
break;
case 4:
- _globals->_sceneItems.push_front(&scene->_hotspot10);
- _globals->_sceneItems.push_front(&scene->_hotspot11);
- _globals->_sceneItems.push_front(&scene->_hotspot12);
+ g_globals->_sceneItems.push_front(&scene->_hotspot10);
+ g_globals->_sceneItems.push_front(&scene->_hotspot11);
+ g_globals->_sceneItems.push_front(&scene->_hotspot12);
scene->_hotspot2.remove();
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene2230::Action8::signal() {
- Scene2230 *scene = (Scene2230 *)_globals->_sceneManager._scene;
+ Scene2230 *scene = (Scene2230 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
switch (scene->_field30A) {
case 1:
@@ -3422,13 +3422,13 @@ void Scene2230::Action8::signal() {
case 1: {
Common::Point pt(140, 119);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2: {
- _globals->_sceneItems.remove(&scene->_hotspot10);
- _globals->_sceneItems.remove(&scene->_hotspot11);
- _globals->_sceneItems.remove(&scene->_hotspot12);
+ g_globals->_sceneItems.remove(&scene->_hotspot10);
+ g_globals->_sceneItems.remove(&scene->_hotspot11);
+ g_globals->_sceneItems.remove(&scene->_hotspot12);
switch (scene->_field30A) {
case 1:
@@ -3464,7 +3464,7 @@ void Scene2230::Action8::signal() {
}
case 5:
scene->_hotspot8.setStrip2(1);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
@@ -3475,7 +3475,7 @@ void Scene2230::Action8::signal() {
/*--------------------------------------------------------------------------*/
void Scene2230::Hotspot1::doAction(int action) {
- Scene2230 *scene = (Scene2230 *)_globals->_sceneManager._scene;
+ Scene2230 *scene = (Scene2230 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -3493,13 +3493,13 @@ void Scene2230::Hotspot1::doAction(int action) {
void Scene2230::Hotspot3::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(4))
+ if (g_globals->getFlag(4))
SceneItem::display2(2230, 1);
else {
SceneItem::display2(2230, 1);
SceneItem::display2(2230, 2);
SceneItem::display2(2230, 3);
- _globals->setFlag(4);
+ g_globals->setFlag(4);
}
break;
default:
@@ -3511,14 +3511,14 @@ void Scene2230::Hotspot3::doAction(int action) {
void Scene2230::Hotspot4::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(30))
+ if (g_globals->getFlag(30))
SceneItem::display2(2230, 6);
- else if (_globals->getFlag(29)) {
+ else if (g_globals->getFlag(29)) {
SceneItem::display2(2230, 5);
- _globals->setFlag(30);
+ g_globals->setFlag(30);
} else {
SceneItem::display2(2230, 4);
- _globals->setFlag(29);
+ g_globals->setFlag(29);
}
break;
case CURSOR_USE:
@@ -3533,10 +3533,10 @@ void Scene2230::Hotspot4::doAction(int action) {
void Scene2230::Hotspot5::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(5))
+ if (g_globals->getFlag(5))
SceneItem::display2(2230, 9);
else {
- _globals->setFlag(5);
+ g_globals->setFlag(5);
SceneItem::display2(2230, 8);
}
break;
@@ -3547,21 +3547,21 @@ void Scene2230::Hotspot5::doAction(int action) {
}
void Scene2230::Hotspot6::doAction(int action) {
- Scene2230 *scene = (Scene2230 *)_globals->_sceneManager._scene;
+ Scene2230 *scene = (Scene2230 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(6))
+ if (g_globals->getFlag(6))
SceneItem::display2(2230, 11);
else {
- _globals->setFlag(6);
+ g_globals->setFlag(6);
SceneItem::display2(2230, 10);
}
break;
case CURSOR_USE:
if (scene->_field30A == 1)
scene->setAction(&scene->_action3);
- else if (_globals->getFlag(13))
+ else if (g_globals->getFlag(13))
SceneItem::display2(2230, 28);
else
scene->setAction(&scene->_action2);
@@ -3573,21 +3573,21 @@ void Scene2230::Hotspot6::doAction(int action) {
}
void Scene2230::Hotspot7::doAction(int action) {
- Scene2230 *scene = (Scene2230 *)_globals->_sceneManager._scene;
+ Scene2230 *scene = (Scene2230 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(7))
+ if (g_globals->getFlag(7))
SceneItem::display2(2230, 13);
else {
- _globals->setFlag(6);
+ g_globals->setFlag(6);
SceneItem::display2(2230, 12);
}
break;
case CURSOR_USE:
if (scene->_field30A == 2)
scene->setAction(&scene->_action6);
- else if (_globals->getFlag(13))
+ else if (g_globals->getFlag(13))
SceneItem::display2(2230, 29);
else
scene->setAction(&scene->_action5);
@@ -3599,22 +3599,22 @@ void Scene2230::Hotspot7::doAction(int action) {
}
void Scene2230::Hotspot8::doAction(int action) {
- Scene2230 *scene = (Scene2230 *)_globals->_sceneManager._scene;
+ Scene2230 *scene = (Scene2230 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
if (scene->_hotspot8._strip == 1) {
- if (_globals->getFlag(22))
+ if (g_globals->getFlag(22))
SceneItem::display2(2230, 19);
else {
- _globals->setFlag(22);
+ g_globals->setFlag(22);
SceneItem::display2(2230, 14);
}
} else {
- if (_globals->getFlag(25))
+ if (g_globals->getFlag(25))
SceneItem::display2(2230, 21);
else {
- _globals->setFlag(25);
+ g_globals->setFlag(25);
SceneItem::display2(2230, 20);
}
}
@@ -3634,10 +3634,10 @@ void Scene2230::Hotspot8::doAction(int action) {
void Scene2230::Hotspot10::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(26))
+ if (g_globals->getFlag(26))
SceneItem::display2(2230, 25);
else {
- _globals->setFlag(26);
+ g_globals->setFlag(26);
SceneItem::display2(2230, 24);
}
break;
@@ -3653,10 +3653,10 @@ void Scene2230::Hotspot10::doAction(int action) {
void Scene2230::Hotspot11::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(27))
+ if (g_globals->getFlag(27))
SceneItem::display2(2230, 23);
else {
- _globals->setFlag(27);
+ g_globals->setFlag(27);
SceneItem::display2(2230, 22);
}
break;
@@ -3672,10 +3672,10 @@ void Scene2230::Hotspot11::doAction(int action) {
void Scene2230::Hotspot12::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(28))
+ if (g_globals->getFlag(28))
SceneItem::display2(2230, 27);
else {
- _globals->setFlag(28);
+ g_globals->setFlag(28);
SceneItem::display2(2230, 26);
}
break;
@@ -3716,17 +3716,17 @@ void Scene2230::postInit(SceneObjectList *OwnerList) {
_rect1 = Rect(59, 64, 89, 74);
- _globals->_player.postInit();
- _globals->_player.setVisage(_globals->getFlag(13) ? 2170 : 0);
- _globals->_player.animate(ANIM_MODE_1, 0);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setPosition(Common::Point(80, 80));
- _globals->_player._moveDiff.y = 3;
- _globals->_player._regionBitList |= 0x80;
- _globals->_player.changeZoom(-1);
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(g_globals->getFlag(13) ? 2170 : 0);
+ g_globals->_player.animate(ANIM_MODE_1, 0);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setPosition(Common::Point(80, 80));
+ g_globals->_player._moveDiff.y = 3;
+ g_globals->_player._regionBitList |= 0x80;
+ g_globals->_player.changeZoom(-1);
_field30A = 0;
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
_hotspot5.setBounds(Rect(108, 34, 142, 76));
_hotspot4.setBounds(Rect(92, 14, 106, 57));
@@ -3737,11 +3737,11 @@ void Scene2230::postInit(SceneObjectList *OwnerList) {
_hotspot11.setBounds(Rect(158, 109, 164, 115));
_hotspot12.setBounds(Rect(170, 109, 177, 115));
- _globals->_sceneItems.addItems(&_hotspot8, &_hotspot5, &_hotspot4, &_hotspot6, &_hotspot7,
+ g_globals->_sceneItems.addItems(&_hotspot8, &_hotspot5, &_hotspot4, &_hotspot6, &_hotspot7,
&_hotspot1, &_hotspot3, NULL);
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
}
void Scene2230::synchronize(Serializer &s) {
@@ -3754,7 +3754,7 @@ void Scene2230::dispatch() {
Scene::dispatch();
if (!_action) {
- if (_rect1.contains(_globals->_player._position))
+ if (_rect1.contains(g_globals->_player._position))
setAction(&_action1);
}
}
@@ -3765,14 +3765,14 @@ void Scene2230::dispatch() {
*--------------------------------------------------------------------------*/
void Scene2280::Action1::signal() {
- Scene2280 *scene = (Scene2280 *)_globals->_sceneManager._scene;
+ Scene2280 *scene = (Scene2280 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
Common::Point pt(192, 97);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 1:
@@ -3782,90 +3782,90 @@ void Scene2280::Action1::signal() {
case 2: {
Common::Point pt(218, 87);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 3:
- _globals->_player.setStrip(3);
+ g_globals->_player.setStrip(3);
setDelay(10);
break;
case 4:
- _globals->_player.fixPriority(1);
+ g_globals->_player.fixPriority(1);
scene->_soundHandler.play(162);
scene->_hotspot16.animate(ANIM_MODE_6, this);
break;
case 5:
- _globals->_sceneManager.changeScene(7000);
+ g_globals->_sceneManager.changeScene(7000);
break;
}
}
void Scene2280::Action2::signal() {
- Scene2280 *scene = (Scene2280 *)_globals->_sceneManager._scene;
+ Scene2280 *scene = (Scene2280 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
Common::Point pt(94, 117);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 1:
scene->_soundHandler.play(265);
- _globals->_player.setVisage(2162);
- _globals->_player._frame = 1;
- _globals->_player._strip = 1;
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(2162);
+ g_globals->_player._frame = 1;
+ g_globals->_player._strip = 1;
+ g_globals->_player.animate(ANIM_MODE_5, this);
scene->_hotspot8.remove();
scene->_hotspot10.remove();
break;
case 2:
- _globals->_player._frame = 1;
- _globals->_player._strip = 2;
- _globals->_player.animate(ANIM_MODE_4, 3, 1, this);
+ g_globals->_player._frame = 1;
+ g_globals->_player._strip = 2;
+ g_globals->_player.animate(ANIM_MODE_4, 3, 1, this);
break;
case 3:
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.animate(ANIM_MODE_5, this);
scene->_hotspot12.remove();
break;
case 4:
scene->_soundHandler.play(266);
- _globals->_player.setVisage(2170);
- _globals->_player._frame = 1;
- _globals->_player._strip = 4;
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player._moveDiff = Common::Point(4, 1);
+ g_globals->_player.setVisage(2170);
+ g_globals->_player._frame = 1;
+ g_globals->_player._strip = 4;
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player._moveDiff = Common::Point(4, 1);
- _globals->setFlag(13);
+ g_globals->setFlag(13);
SceneItem::display2(2280, 37);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene2280::Action3::signal() {
- Scene2280 *scene = (Scene2280 *)_globals->_sceneManager._scene;
+ Scene2280 *scene = (Scene2280 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
Common::Point pt(94, 117);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 1:
scene->_soundHandler.play(265);
- _globals->_player.setVisage(2162);
- _globals->_player._frame = 6;
- _globals->_player._strip = 2;
- _globals->_player.animate(ANIM_MODE_4, 3, -1, this);
+ g_globals->_player.setVisage(2162);
+ g_globals->_player._frame = 6;
+ g_globals->_player._strip = 2;
+ g_globals->_player.animate(ANIM_MODE_4, 3, -1, this);
break;
case 2:
scene->_hotspot12.postInit();
@@ -3875,13 +3875,13 @@ void Scene2280::Action3::signal() {
scene->_hotspot12.setPosition(Common::Point(88, 76));
scene->_hotspot12.fixPriority(1);
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 3:
- _globals->_player._strip = 1;
- _globals->_player._frame = 12;
+ g_globals->_player._strip = 1;
+ g_globals->_player._frame = 12;
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 4:
scene->_hotspot8.postInit();
@@ -3902,22 +3902,22 @@ void Scene2280::Action3::signal() {
scene->_hotspot10.changeZoom(100);
scene->_hotspot10.fixPriority(1);
- _globals->clearFlag(13);
+ g_globals->clearFlag(13);
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player._strip = 4;
- _globals->_player._moveDiff = Common::Point(3, 5);
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player._strip = 4;
+ g_globals->_player._moveDiff = Common::Point(3, 5);
SceneItem::display2(2280, 38);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene2280::Action4::signal() {
- Scene2280 *scene = (Scene2280 *)_globals->_sceneManager._scene;
+ Scene2280 *scene = (Scene2280 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
@@ -3926,24 +3926,24 @@ void Scene2280::Action4::signal() {
case 51: {
Common::Point pt(163, 67);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 6:
case 50: {
Common::Point pt(173, 63);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
}
break;
}
case 1:
- _globals->_player.setVisage(2161);
- _globals->_player._strip = 1;
- _globals->_player._frame = 1;
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(2161);
+ g_globals->_player._strip = 1;
+ g_globals->_player._frame = 1;
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 2:
switch (_state) {
@@ -3966,7 +3966,7 @@ void Scene2280::Action4::signal() {
scene->_hotspot17.fixPriority(1);
RING_INVENTORY._medkit._sceneNumber = 2280;
- _globals->_sceneItems.push_front(&scene->_hotspot17);
+ g_globals->_sceneItems.push_front(&scene->_hotspot17);
break;
case 51:
scene->_hotspot18.postInit();
@@ -3979,17 +3979,17 @@ void Scene2280::Action4::signal() {
scene->_hotspot18.fixPriority(1);
RING_INVENTORY._scanner._sceneNumber = 2280;
- _globals->_sceneItems.push_front(&scene->_hotspot18);
+ g_globals->_sceneItems.push_front(&scene->_hotspot18);
break;
}
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 3:
- _globals->_player.enableControl();
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player._strip = 2;
+ g_globals->_player.enableControl();
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player._strip = 2;
remove();
break;
@@ -3999,24 +3999,24 @@ void Scene2280::Action4::signal() {
/*--------------------------------------------------------------------------*/
void Scene2280::Hotspot1::doAction(int action) {
- Scene2280 *scene = (Scene2280 *)_globals->_sceneManager._scene;
+ Scene2280 *scene = (Scene2280 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(16))
+ if (g_globals->getFlag(16))
SceneItem::display2(2280, 22);
else {
- _globals->setFlag(16);
+ g_globals->setFlag(16);
SceneItem::display2(2230, 21);
}
break;
case CURSOR_USE:
- if (!_globals->getFlag(15))
+ if (!g_globals->getFlag(15))
SceneItem::display2(2280, 23);
- else if (!_globals->getFlag(13))
+ else if (!g_globals->getFlag(13))
SceneItem::display2(2280, 46);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action1);
}
break;
@@ -4029,10 +4029,10 @@ void Scene2280::Hotspot1::doAction(int action) {
void Scene2280::Hotspot2::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(2))
+ if (g_globals->getFlag(2))
SceneItem::display2(2280, 1);
else {
- _globals->setFlag(2);
+ g_globals->setFlag(2);
SceneItem::display2(2280, 0);
}
break;
@@ -4048,10 +4048,10 @@ void Scene2280::Hotspot2::doAction(int action) {
void Scene2280::Hotspot4::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(21))
+ if (g_globals->getFlag(21))
SceneItem::display2(2280, 33);
else {
- _globals->setFlag(21);
+ g_globals->setFlag(21);
SceneItem::display2(2280, 32);
}
break;
@@ -4065,31 +4065,31 @@ void Scene2280::Hotspot4::doAction(int action) {
}
void Scene2280::Hotspot7::doAction(int action) {
- Scene2280 *scene = (Scene2280 *)_globals->_sceneManager._scene;
+ Scene2280 *scene = (Scene2280 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2280, 24);
break;
case OBJECT_SCANNER:
- if (_globals->getFlag(13))
+ if (g_globals->getFlag(13))
SceneItem::display2(2280, 43);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_action4._state = 51;
- _globals->_events.setCursor(CURSOR_WALK);
- _globals->_events._currentCursor = CURSOR_700;
+ g_globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events._currentCursor = CURSOR_700;
scene->setAction(&scene->_action4);
}
break;
case OBJECT_MEDKIT:
- if (_globals->getFlag(13))
+ if (g_globals->getFlag(13))
SceneItem::display2(2280, 43);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_action4._state = 50;
- _globals->_events.setCursor(CURSOR_WALK);
- _globals->_events._currentCursor = CURSOR_700;
+ g_globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events._currentCursor = CURSOR_700;
scene->setAction(&scene->_action4);
}
break;
@@ -4100,14 +4100,14 @@ void Scene2280::Hotspot7::doAction(int action) {
}
void Scene2280::Hotspot8::doAction(int action) {
- Scene2280 *scene = (Scene2280 *)_globals->_sceneManager._scene;
+ Scene2280 *scene = (Scene2280 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2280, 3);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action2);
break;
default:
@@ -4117,14 +4117,14 @@ void Scene2280::Hotspot8::doAction(int action) {
}
void Scene2280::Hotspot10::doAction(int action) {
- Scene2280 *scene = (Scene2280 *)_globals->_sceneManager._scene;
+ Scene2280 *scene = (Scene2280 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2280, 4);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action2);
break;
default:
@@ -4134,14 +4134,14 @@ void Scene2280::Hotspot10::doAction(int action) {
}
void Scene2280::Hotspot12::doAction(int action) {
- Scene2280 *scene = (Scene2280 *)_globals->_sceneManager._scene;
+ Scene2280 *scene = (Scene2280 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2280, 11);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action2);
break;
default:
@@ -4151,15 +4151,15 @@ void Scene2280::Hotspot12::doAction(int action) {
}
void Scene2280::Hotspot14::doAction(int action) {
- Scene2280 *scene = (Scene2280 *)_globals->_sceneManager._scene;
+ Scene2280 *scene = (Scene2280 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2280, 3);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
- if (_globals->getFlag(13))
+ g_globals->_player.disableControl();
+ if (g_globals->getFlag(13))
scene->setAction(&scene->_action3);
else
scene->setAction(&scene->_action2);
@@ -4171,22 +4171,22 @@ void Scene2280::Hotspot14::doAction(int action) {
}
void Scene2280::Hotspot17::doAction(int action) {
- Scene2280 *scene = (Scene2280 *)_globals->_sceneManager._scene;
+ Scene2280 *scene = (Scene2280 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(18))
+ if (g_globals->getFlag(18))
SceneItem::display2(2280, 26);
else {
- _globals->setFlag(18);
+ g_globals->setFlag(18);
SceneItem::display2(2280, 25);
}
break;
case CURSOR_USE:
- if (_globals->getFlag(13))
+ if (g_globals->getFlag(13))
SceneItem::display2(2280, 29);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_action4._state = 6;
scene->setAction(&scene->_action4);
}
@@ -4198,22 +4198,22 @@ void Scene2280::Hotspot17::doAction(int action) {
}
void Scene2280::Hotspot18::doAction(int action) {
- Scene2280 *scene = (Scene2280 *)_globals->_sceneManager._scene;
+ Scene2280 *scene = (Scene2280 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(19))
+ if (g_globals->getFlag(19))
SceneItem::display2(2280, 28);
else {
- _globals->setFlag(19);
+ g_globals->setFlag(19);
SceneItem::display2(2280, 27);
}
break;
case CURSOR_USE:
- if (_globals->getFlag(13))
+ if (g_globals->getFlag(13))
SceneItem::display2(2280, 29);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_action4._state = 1;
scene->setAction(&scene->_action4);
}
@@ -4254,7 +4254,7 @@ void Scene2280::postInit(SceneObjectList *OwnerList) {
_hotspot17.setPosition(Common::Point(162, 39));
_hotspot17.fixPriority(1);
- _globals->_sceneItems.push_back(&_hotspot17);
+ g_globals->_sceneItems.push_back(&_hotspot17);
}
if (RING_INVENTORY._scanner._sceneNumber == 2280) {
@@ -4265,10 +4265,10 @@ void Scene2280::postInit(SceneObjectList *OwnerList) {
_hotspot17.setPosition(Common::Point(152, 43));
_hotspot17.fixPriority(1);
- _globals->_sceneItems.push_back(&_hotspot17);
+ g_globals->_sceneItems.push_back(&_hotspot17);
}
- if (!_globals->getFlag(13)) {
+ if (!g_globals->getFlag(13)) {
_hotspot8.postInit();
_hotspot8.setVisage(2280);
_hotspot8._strip = 2;
@@ -4289,7 +4289,7 @@ void Scene2280::postInit(SceneObjectList *OwnerList) {
_hotspot12.setPosition(Common::Point(88, 76));
_hotspot12.fixPriority(1);
- _globals->_sceneItems.addItems(&_hotspot8, &_hotspot10, &_hotspot12, NULL);
+ g_globals->_sceneItems.addItems(&_hotspot8, &_hotspot10, &_hotspot12, NULL);
}
_hotspot14.setBounds(Rect(70, 50, 90, 104));
@@ -4322,47 +4322,47 @@ void Scene2280::postInit(SceneObjectList *OwnerList) {
_exitRect = Rect(145, 180, 195, 195);
- _globals->_player.postInit();
- _globals->_player.setVisage(_globals->getFlag(13) ? 2170 : 0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setPosition(Common::Point(146, 161));
- _globals->_player.changeZoom(-1);
- _globals->_player._moveDiff = Common::Point(4, 3);
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(g_globals->getFlag(13) ? 2170 : 0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setPosition(Common::Point(146, 161));
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player._moveDiff = Common::Point(4, 3);
- if ((_globals->_sceneManager._previousScene != 7300) && (_globals->_sceneManager._previousScene != 7000)) {
- _globals->_player.enableControl();
+ if ((g_globals->_sceneManager._previousScene != 7300) && (g_globals->_sceneManager._previousScene != 7000)) {
+ g_globals->_player.enableControl();
} else {
- _globals->setFlag(109);
- _globals->_player.fixPriority(76);
- _globals->_player.disableControl();
+ g_globals->setFlag(109);
+ g_globals->_player.fixPriority(76);
+ g_globals->_player.disableControl();
_sceneMode = 2281;
- setAction(&_sequenceManager, this, 2281, &_globals->_player, &_hotspot16, NULL);
+ setAction(&_sequenceManager, this, 2281, &g_globals->_player, &_hotspot16, NULL);
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
}
- _globals->_sceneItems.addItems(&_hotspot13, &_hotspot11, &_hotspot9, &_hotspot14, &_hotspot7,
+ g_globals->_sceneItems.addItems(&_hotspot13, &_hotspot11, &_hotspot9, &_hotspot14, &_hotspot7,
&_hotspot6, &_hotspot2, &_hotspot3, &_hotspot4, &_hotspot5, &_hotspot1, &_hotspot16, &_hotspot15, NULL);
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
}
void Scene2280::signal() {
if (_sceneMode == 2281) {
- _globals->_player.fixPriority(-1);
- _globals->_player.enableControl();
+ g_globals->_player.fixPriority(-1);
+ g_globals->_player.enableControl();
}
}
void Scene2280::dispatch() {
Scene::dispatch();
if (!_action) {
- if (_exitRect.contains(_globals->_player._position))
- _globals->_sceneManager.changeScene(2150);
+ if (_exitRect.contains(g_globals->_player._position))
+ g_globals->_sceneManager.changeScene(2150);
}
}
@@ -4378,7 +4378,7 @@ void Scene2280::synchronize(Serializer &s) {
void Scene2300::Action1::signal() {
// Quinn and Seeker
- Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene;
+ Scene2300 *scene = (Scene2300 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -4405,8 +4405,8 @@ void Scene2300::Action1::signal() {
}
case 3:
setDelay(2);
- _globals->_player._uiEnabled = true;
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_player._uiEnabled = true;
+ g_globals->_events.setCursor(CURSOR_WALK);
break;
case 4: {
scene->_hotspot5.setVisage(93);
@@ -4431,23 +4431,23 @@ void Scene2300::Action1::signal() {
}
case 6:
scene->_soundHandler1.play(28);
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_hotspot2.setVisage(40);
scene->_hotspot2.setStrip(4);
scene->_hotspot2.setFrame(1);
scene->_hotspot2.animate(ANIM_MODE_5, NULL);
- _globals->_player.setVisage(40);
- _globals->_player.setStrip(2);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(40);
+ g_globals->_player.setStrip(2);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 7:
- _globals->_soundHandler.play(77, this);
+ g_globals->_soundHandler.play(77, this);
break;
case 8:
- _globals->_game->endGame(2300, 0);
+ g_globals->_game->endGame(2300, 0);
remove();
break;
case 9:
@@ -4459,17 +4459,17 @@ void Scene2300::Action1::signal() {
scene->_hotspot5.animate(ANIM_MODE_NONE, NULL);
scene->_hotspot6.animate(ANIM_MODE_NONE, NULL);
- _globals->_player.disableControl();
- _globals->_player.setVisage(2672);
- _globals->_player._strip = 5;
- _globals->_player._frame = 1;
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.disableControl();
+ g_globals->_player.setVisage(2672);
+ g_globals->_player._strip = 5;
+ g_globals->_player._frame = 1;
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 10:
- _globals->_player.setVisage(2674);
- _globals->_player._strip = 5;
- _globals->_player._frame = 1;
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(2674);
+ g_globals->_player._strip = 5;
+ g_globals->_player._frame = 1;
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 11:
scene->_soundHandler1.play(28);
@@ -4483,17 +4483,17 @@ void Scene2300::Action1::signal() {
scene->_hotspot5.fixPriority(20);
scene->_hotspot6.fixPriority(20);
- _globals->_player.setVisage(2672);
- _globals->_player._strip = 5;
- _globals->_player._frame = _globals->_player.getFrameCount();
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_player.setVisage(2672);
+ g_globals->_player._strip = 5;
+ g_globals->_player._frame = g_globals->_player.getFrameCount();
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 12:
scene->_soundHandler1.play(77);
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setStrip(4);
- _globals->_player._uiEnabled = false;
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setStrip(4);
+ g_globals->_player._uiEnabled = false;
setDelay(60);
break;
case 13:
@@ -4506,7 +4506,7 @@ void Scene2300::Action1::signal() {
case 15: {
Common::Point pt1(101, 148);
PlayerMover *mover1 = new PlayerMover();
- _globals->_player.addMover(mover1, &pt1, this);
+ g_globals->_player.addMover(mover1, &pt1, this);
Common::Point pt2(scene->_hotspot5._position.x + 5, scene->_hotspot5._position.y + 5);
NpcMover *mover2 = new NpcMover();
@@ -4514,7 +4514,7 @@ void Scene2300::Action1::signal() {
break;
}
case 16:
- _globals->_sceneManager.changeScene(2000);
+ g_globals->_sceneManager.changeScene(2000);
remove();
break;
}
@@ -4522,29 +4522,29 @@ void Scene2300::Action1::signal() {
void Scene2300::Action2::signal() {
// Miranda tearing cables
- Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene;
+ Scene2300 *scene = (Scene2300 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(30);
break;
case 1: {
Common::Point pt(153, 135);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2:
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start(2030, this);
break;
case 3:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
setDelay(600);
break;
case 4: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_hotspot2.postInit();
scene->_hotspot2.setVisage(2801);
@@ -4582,34 +4582,34 @@ void Scene2300::Action2::signal() {
scene->_stripManager.start(2035, this);
break;
case 10:
- _globals->_sceneManager.changeScene(2310);
+ g_globals->_sceneManager.changeScene(2310);
break;
}
}
void Scene2300::Action3::signal() {
// Stunned Miranda
- Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene;
+ Scene2300 *scene = (Scene2300 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
Common::Point pt(153, 135);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 1:
- _globals->_player.disableControl();
- _globals->_player.setVisage(2672);
- _globals->_player._strip = 2;
- _globals->_player._frame = 1;
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.disableControl();
+ g_globals->_player.setVisage(2672);
+ g_globals->_player._strip = 2;
+ g_globals->_player._frame = 1;
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 2:
- _globals->_player.setVisage(2674);
- _globals->_player._strip = 2;
- _globals->_player._frame = 1;
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(2674);
+ g_globals->_player._strip = 2;
+ g_globals->_player._frame = 1;
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 3:
scene->_soundHandler1.play(97);
@@ -4619,30 +4619,30 @@ void Scene2300::Action3::signal() {
scene->_hotspot7._frame = 1;
scene->_hotspot7.animate(ANIM_MODE_5, this);
- _globals->_player.setVisage(2672);
- _globals->_player._strip = 2;
- _globals->_player._frame = _globals->_player.getFrameCount();
- _globals->_player.animate(ANIM_MODE_6, NULL);
+ g_globals->_player.setVisage(2672);
+ g_globals->_player._strip = 2;
+ g_globals->_player._frame = g_globals->_player.getFrameCount();
+ g_globals->_player.animate(ANIM_MODE_6, NULL);
break;
case 4:
scene->_soundHandler2.play(97);
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setStrip(1);
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setStrip(1);
scene->_stripManager.start(2034, this);
break;
case 5:
setDelay(10);
break;
case 6:
- _globals->_sceneManager.changeScene(2310);
+ g_globals->_sceneManager.changeScene(2310);
break;
}
}
void Scene2300::Action4::signal() {
// Ennemies coming
- Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene;
+ Scene2300 *scene = (Scene2300 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -4681,12 +4681,12 @@ void Scene2300::Action4::signal() {
void Scene2300::Hotspot5::doAction(int action) {
// Ennemies
- Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene;
+ Scene2300 *scene = (Scene2300 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_STUNNER:
- _globals->_player.disableControl();
- _globals->_player.addMover(NULL);
+ g_globals->_player.disableControl();
+ g_globals->_player.addMover(NULL);
scene->_action1.setActionIndex(9);
scene->_action1.setDelay(1);
break;
@@ -4704,7 +4704,7 @@ void Scene2300::Hotspot5::doAction(int action) {
void Scene2300::Hotspot7::doAction(int action) {
// Miranda
- Scene2300 *scene = (Scene2300 *)_globals->_sceneManager._scene;
+ Scene2300 *scene = (Scene2300 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_STUNNER:
@@ -4749,8 +4749,8 @@ void Scene2300::postInit(SceneObjectList *OwnerList) {
_hotspot8.setVisage(2301);
_hotspot8.setPosition(Common::Point(288, 74));
- _globals->_soundHandler.play(96);
- if (_globals->_sceneManager._previousScene == 2000) {
+ g_globals->_soundHandler.play(96);
+ if (g_globals->_sceneManager._previousScene == 2000) {
_hotspot8.remove();
_hotspot9.postInit();
@@ -4766,13 +4766,13 @@ void Scene2300::postInit(SceneObjectList *OwnerList) {
_hotspot10._frame = _hotspot10.getFrameCount();
_hotspot10.setPosition(Common::Point(292, 113));
- _globals->_player.postInit();
- _globals->_player.setVisage(0);
- _globals->_player.setPosition(Common::Point(109, 139));
- _globals->_player.changeZoom(40);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(0);
+ g_globals->_player.setPosition(Common::Point(109, 139));
+ g_globals->_player.changeZoom(40);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.disableControl();
_hotspot7.postInit();
_hotspot7.setVisage(2302);
@@ -4782,7 +4782,7 @@ void Scene2300::postInit(SceneObjectList *OwnerList) {
_soundHandler1.play(95);
_soundHandler2.play(96);
- _globals->_sceneItems.push_back(&_hotspot7);
+ g_globals->_sceneItems.push_back(&_hotspot7);
setAction(&_action2);
} else {
@@ -4807,13 +4807,13 @@ void Scene2300::postInit(SceneObjectList *OwnerList) {
_hotspot1.setPosition(Common::Point(255, 190));
_hotspot1.changeZoom(40);
- _globals->_player.postInit();
- _globals->_player.setVisage(0);
- _globals->_player.setPosition(Common::Point(203, 191));
- _globals->_player.changeZoom(40);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(0);
+ g_globals->_player.setPosition(Common::Point(203, 191));
+ g_globals->_player.changeZoom(40);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.disableControl();
_hotspot5.postInit();
_hotspot5.setVisage(91);
@@ -4829,7 +4829,7 @@ void Scene2300::postInit(SceneObjectList *OwnerList) {
_hotspot6.changeZoom(40);
_hotspot6.setObjectWrapper(new SceneObjectWrapper());
- _globals->_sceneItems.push_back(&_hotspot5);
+ g_globals->_sceneItems.push_back(&_hotspot5);
setAction(&_action1);
}
@@ -4839,7 +4839,7 @@ void Scene2300::postInit(SceneObjectList *OwnerList) {
_hotspot14._sceneRegionId = 11;
_hotspot15.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- _globals->_sceneItems.addItems(&_hotspot12, &_hotspot11, &_hotspot13, &_hotspot14, &_hotspot15, NULL);
+ g_globals->_sceneItems.addItems(&_hotspot12, &_hotspot11, &_hotspot13, &_hotspot14, &_hotspot15, NULL);
}
/*--------------------------------------------------------------------------
@@ -4893,20 +4893,20 @@ void Scene2310::postInit(SceneObjectList *OwnerList) {
_wireList[idx].setPosition(pointList[idx]);
}
- _globals->_player.disableControl();
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_player.disableControl();
+ g_globals->_events.setCursor(CURSOR_WALK);
- if (_vm->getFeatures() & GF_CD)
- _pageIndex = _globals->_randomSource.getRandomNumber(14) + 2;
+ if (g_vm->getFeatures() & GF_CD)
+ _pageIndex = g_globals->_randomSource.getRandomNumber(14) + 2;
else
- _pageIndex = _globals->_randomSource.getRandomNumber(19) + 1;
+ _pageIndex = g_globals->_randomSource.getRandomNumber(19) + 1;
signal();
}
void Scene2310::signal() {
switch (_sceneMode++) {
case 0: {
- Common::String fmtString = _resourceManager->getMessage(2300, 22);
+ Common::String fmtString = g_resourceManager->getMessage(2300, 22);
Common::String msg = Common::String::format(fmtString.c_str(), _pageList[_pageIndex]._pageNumber);
_sceneText._width = 280;
@@ -4919,18 +4919,18 @@ void Scene2310::signal() {
break;
}
case 1: {
- Common::String msg = _resourceManager->getMessage(2300, 23);
+ Common::String msg = g_resourceManager->getMessage(2300, 23);
_sceneText.setup(msg);
_sceneText.fixPriority(255);
_sceneText.setPosition(Common::Point(30, 170));
- _globals->_sceneObjects->draw();
- _globals->_events.waitForPress();
+ g_globals->_sceneObjects->draw();
+ g_globals->_events.waitForPress();
_sceneText.hide();
- _globals->_sceneObjects->draw();
+ g_globals->_sceneObjects->draw();
- _globals->_sceneManager.changeScene(2200);
+ g_globals->_sceneManager.changeScene(2200);
break;
}
}
@@ -4966,11 +4966,11 @@ void Scene2310::process(Event &event) {
if (idx != 5) {
_wireList[idx].hide();
- _globals->_sceneObjects->draw();
+ g_globals->_sceneObjects->draw();
_wireList[idx].setFrame(frameNum);
_wireList[idx].show();
- _globals->_sceneObjects->draw();
+ g_globals->_sceneObjects->draw();
}
} else {
// End the moving of the currently active wire
@@ -5003,7 +5003,7 @@ void Scene2310::process(Event &event) {
void Scene2310::dispatch() {
if (_wireIndex != 5) {
for (int idx = 0; idx < 5; ++idx) {
- if (_rectList[idx].contains(_globals->_events._mousePos)) {
+ if (_rectList[idx].contains(g_globals->_events._mousePos)) {
_wireList[_wireIndex].setFrame(idx + 2);
return;
}
@@ -5028,12 +5028,12 @@ int Scene2310::findObject(int objIndex) {
*--------------------------------------------------------------------------*/
void Scene2320::Action1::signal() {
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(10);
- if (_globals->_sceneManager._previousScene == 2120)
+ if (g_globals->_sceneManager._previousScene == 2120)
_actionIndex = 3;
break;
case 1: {
@@ -5060,7 +5060,7 @@ void Scene2320::Action1::signal() {
}
void Scene2320::Action2::signal() {
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
@@ -5080,13 +5080,13 @@ void Scene2320::Action2::signal() {
}
void Scene2320::Action3::signal() {
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
Common::Point pt(320, 86);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 1:
@@ -5096,12 +5096,12 @@ void Scene2320::Action3::signal() {
case 2: {
Common::Point pt(320, 79);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 3:
- _globals->_player.fixPriority(scene->_hotspot6._priority - 1);
- _globals->_player._strip = 3;
+ g_globals->_player.fixPriority(scene->_hotspot6._priority - 1);
+ g_globals->_player._strip = 3;
setDelay(10);
break;
case 4:
@@ -5112,12 +5112,12 @@ void Scene2320::Action3::signal() {
scene->_area3.draw(true);
_state = 0;
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
- while (!_state && !_vm->shouldQuit()) {
+ while (!_state && !g_vm->shouldQuit()) {
// Wait for an event
Event event;
- if (!_globals->_events.getEvent(event)) {
+ if (!g_globals->_events.getEvent(event)) {
g_system->updateScreen();
g_system->delayMillis(10);
continue;
@@ -5154,13 +5154,13 @@ void Scene2320::Action3::signal() {
break;
case 5: {
if (_state == 2320)
- _globals->_player.fixPriority(-1);
+ g_globals->_player.fixPriority(-1);
else
- _globals->_sceneManager.changeScene(_state);
+ g_globals->_sceneManager.changeScene(_state);
Common::Point pt(320, 86);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 6:
@@ -5168,7 +5168,7 @@ void Scene2320::Action3::signal() {
scene->_hotspot6.animate(ANIM_MODE_6, this);
break;
case 7:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -5176,28 +5176,28 @@ void Scene2320::Action3::signal() {
void Scene2320::Action4::signal() {
// Fly Cycle actions
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(3);
break;
case 1: {
Common::Point pt(213, 84);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2:
case 16:
- _globals->_player.setVisage(2109);
- _globals->_player.setStrip(2);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(2109);
+ g_globals->_player.setStrip(2);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 3:
- _globals->_player.animate(ANIM_MODE_6, NULL);
+ g_globals->_player.animate(ANIM_MODE_6, NULL);
setAction(&scene->_action2, this);
break;
case 4: {
@@ -5222,63 +5222,63 @@ void Scene2320::Action4::signal() {
}
case 6: {
scene->_hotspot16.fixPriority(-1);
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
Common::Point pt(233, 176);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 7: {
Common::Point pt(291, 194);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 8:
- _globals->_player.setStrip(5);
- _globals->_player.setFrame(1);
+ g_globals->_player.setStrip(5);
+ g_globals->_player.setFrame(1);
setDelay(13);
break;
case 9:
// Quinn sits in the flycycle
scene->_hotspot16.hide();
- _globals->_player.setVisage(2323);
- _globals->_player.setPosition(Common::Point(303, 176));
- _globals->_player.setStrip(2);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(2323);
+ g_globals->_player.setPosition(Common::Point(303, 176));
+ g_globals->_player.setStrip(2);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 10:
- if (_globals->getFlag(109)) {
- _globals->_soundHandler.play(40);
- _globals->_soundHandler.holdAt(true);
+ if (g_globals->getFlag(109)) {
+ g_globals->_soundHandler.play(40);
+ g_globals->_soundHandler.holdAt(true);
Common::Point pt(303, 240);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
} else {
setDelay(3);
}
break;
case 11:
- if (_globals->getFlag(109)) {
- _globals->_sceneManager.changeScene(7600);
+ if (g_globals->getFlag(109)) {
+ g_globals->_sceneManager.changeScene(7600);
} else {
SceneItem::display2(2320, 19);
setDelay(3);
}
break;
case 12:
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 13:
- _globals->_player.setVisage(0);
- _globals->_player.setPosition(Common::Point(291, 194));
- _globals->_player.setStrip(5);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setVisage(0);
+ g_globals->_player.setPosition(Common::Point(291, 194));
+ g_globals->_player.setStrip(5);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
scene->_hotspot16.show();
setDelay(3);
@@ -5286,17 +5286,17 @@ void Scene2320::Action4::signal() {
case 14: {
Common::Point pt(233, 176);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 15: {
Common::Point pt(213, 85);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 17: {
- _globals->_player.animate(ANIM_MODE_6, NULL);
+ g_globals->_player.animate(ANIM_MODE_6, NULL);
scene->_hotspot16.fixPriority(160);
Common::Point pt(320, 121);
@@ -5322,9 +5322,9 @@ void Scene2320::Action4::signal() {
break;
}
case 20:
- _globals->_player.enableControl();
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.enableControl();
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
scene->_hotspot13.fixPriority(1);
remove();
@@ -5333,11 +5333,11 @@ void Scene2320::Action4::signal() {
}
void Scene2320::Action5::signal() {
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
ADD_PLAYER_MOVER(163, 126);
break;
case 1:
@@ -5347,29 +5347,29 @@ void Scene2320::Action5::signal() {
setDelay(2);
break;
case 3:
- if (!_globals->getFlag(59))
+ if (!g_globals->getFlag(59))
setDelay(10);
else
scene->_stripManager.start(2323, this);
break;
case 4:
- _globals->_player.setVisage(2347);
- _globals->_player.setStrip(1);
- _globals->_player.setFrame(1);
- _globals->_player.fixPriority(137);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(2347);
+ g_globals->_player.setStrip(1);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.fixPriority(137);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 5:
- _globals->_player.setStrip(2);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setStrip(2);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 6:
- if (_globals->getFlag(72))
- _globals->_sceneManager.changeScene(7000);
- else if (_globals->getFlag(59))
- _globals->_sceneManager.changeScene(5000);
- else if (!_globals->getFlag(43) || (RING_INVENTORY._ale._sceneNumber != 1))
+ if (g_globals->getFlag(72))
+ g_globals->_sceneManager.changeScene(7000);
+ else if (g_globals->getFlag(59))
+ g_globals->_sceneManager.changeScene(5000);
+ else if (!g_globals->getFlag(43) || (RING_INVENTORY._ale._sceneNumber != 1))
setDelay(10);
else {
scene->_hotspot11.setAction(NULL);
@@ -5381,7 +5381,7 @@ void Scene2320::Action5::signal() {
NpcMover *mover = new NpcMover();
scene->_hotspot11.addMover(mover, &pt, NULL);
- _globals->clearFlag(43);
+ g_globals->clearFlag(43);
scene->_stripManager.start(2325, this);
}
break;
@@ -5389,82 +5389,82 @@ void Scene2320::Action5::signal() {
setDelay(10);
break;
case 8:
- _globals->_sceneManager.changeScene(4000);
+ g_globals->_sceneManager.changeScene(4000);
break;
}
}
void Scene2320::Action6::signal() {
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(30);
break;
case 1:
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 2:
- _globals->_player.setStrip(1);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_player.setStrip(1);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 3:
- _globals->_player.setVisage(0);
- _globals->_player.setStrip(3);
- _globals->_player.fixPriority(-1);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setVisage(0);
+ g_globals->_player.setStrip(3);
+ g_globals->_player.fixPriority(-1);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
setDelay(60);
break;
case 4:
- if ((_globals->_sceneManager._previousScene != 4000) || _globals->getFlag(43))
+ if ((g_globals->_sceneManager._previousScene != 4000) || g_globals->getFlag(43))
setDelay(3);
- else if (_globals->getFlag(35)) {
- _globals->setFlag(43);
+ else if (g_globals->getFlag(35)) {
+ g_globals->setFlag(43);
scene->_stripManager.start(4200, this);
- _globals->setFlag(69);
- } else if (_globals->getFlag(36)) {
+ g_globals->setFlag(69);
+ } else if (g_globals->getFlag(36)) {
setDelay(3);
} else {
- _globals->setFlag(43);
+ g_globals->setFlag(43);
scene->_stripManager.start(4210, this);
break;
}
break;
case 5:
- if (_globals->_sceneObjects->contains(&scene->_hotspot11)) {
+ if (g_globals->_sceneObjects->contains(&scene->_hotspot11)) {
scene->_hotspot11.setAction(&scene->_action1);
- if (_globals->_sceneObjects->contains(&scene->_hotspot10)) {
+ if (g_globals->_sceneObjects->contains(&scene->_hotspot10)) {
ADD_MOVER(scene->_hotspot10, 491, 160);
} else {
setDelay(60);
}
- _globals->_sceneItems.push_front(&scene->_hotspot11);
+ g_globals->_sceneItems.push_front(&scene->_hotspot11);
} else {
setDelay(3);
}
break;
case 6:
- _globals->_events.setCursor(CURSOR_WALK);
- _globals->_player.enableControl();
+ g_globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene2320::Action7::signal() {
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(30);
break;
case 1:
- _globals->_soundHandler.play(162);
+ g_globals->_soundHandler.play(162);
scene->_hotspot6.animate(ANIM_MODE_5, this);
break;
case 2:
@@ -5473,8 +5473,8 @@ void Scene2320::Action7::signal() {
scene->_hotspot11.fixPriority(-1);
ADD_MOVER_NULL(scene->_hotspot11, 346, 85);
- _globals->_player.fixPriority(-1);
- ADD_MOVER(_globals->_player, 297, 89);
+ g_globals->_player.fixPriority(-1);
+ ADD_MOVER(g_globals->_player, 297, 89);
break;
case 3:
ADD_PLAYER_MOVER(462, 182);
@@ -5485,17 +5485,17 @@ void Scene2320::Action7::signal() {
case 5:
ADD_MOVER(scene->_hotspot11, 500, 164);
ADD_MOVER(scene->_hotspot10, 382, 93);
- _globals->_player.setStrip(3);
+ g_globals->_player.setStrip(3);
break;
case 6:
ADD_MOVER_NULL(scene->_hotspot10, 491, 160);
- ADD_MOVER(_globals->_player, 391, 88);
+ ADD_MOVER(g_globals->_player, 391, 88);
break;
case 7:
ADD_PLAYER_MOVER(462, 182);
break;
case 8:
- _globals->_player.setStrip(7);
+ g_globals->_player.setStrip(7);
setDelay(15);
break;
case 9:
@@ -5508,14 +5508,14 @@ void Scene2320::Action7::signal() {
scene->_stripManager.start(6022, this);
break;
case 12:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
RING_INVENTORY._stasisBox._sceneNumber = 2320;
break;
}
}
void Scene2320::Action8::signal() {
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -5525,24 +5525,24 @@ void Scene2320::Action8::signal() {
ADD_PLAYER_MOVER(462, 182);
break;
case 2:
- _globals->_player.setStrip(7);
+ g_globals->_player.setStrip(7);
setDelay(5);
break;
case 3:
- scene->_speakerGameText.setTextPos(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + 30, 10));
- scene->_stripManager.start(_globals->getFlag(75) ? 6030 : 2320, this);
+ scene->_speakerGameText.setTextPos(Common::Point(g_globals->_sceneManager._scene->_sceneBounds.left + 30, 10));
+ scene->_stripManager.start(g_globals->getFlag(75) ? 6030 : 2320, this);
break;
case 4:
- if (_globals->getFlag(75))
+ if (g_globals->getFlag(75))
setDelay(3);
else
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 5:
RING_INVENTORY._stasisBox._sceneNumber = 2320;
scene->_sceneMode = 2326;
- scene->_speakerGameText.setTextPos(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + 30, 10));
- scene->setAction(&scene->_sequenceManager1, scene, 2326, &_globals->_player, &scene->_hotspot11, NULL);
+ scene->_speakerGameText.setTextPos(Common::Point(g_globals->_sceneManager._scene->_sceneBounds.left + 30, 10));
+ scene->setAction(&scene->_sequenceManager1, scene, 2326, &g_globals->_player, &scene->_hotspot11, NULL);
break;
}
}
@@ -5550,16 +5550,16 @@ void Scene2320::Action8::signal() {
/*--------------------------------------------------------------------------*/
void Scene2320::Hotspot5::doAction(int action) {
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2320, 13);
break;
case CURSOR_USE:
- if (_globals->getFlag(70))
+ if (g_globals->getFlag(70))
SceneItem::display2(2320, 33);
- else if (_globals->getFlag(13))
+ else if (g_globals->getFlag(13))
SceneItem::display2(2320, 18);
else
scene->setAction(&scene->_action5);
@@ -5571,14 +5571,14 @@ void Scene2320::Hotspot5::doAction(int action) {
}
void Scene2320::Hotspot6::doAction(int action) {
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2320, 2);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action3);
break;
default:
@@ -5588,7 +5588,7 @@ void Scene2320::Hotspot6::doAction(int action) {
}
void Scene2320::Hotspot8::doAction(int action) {
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -5596,7 +5596,7 @@ void Scene2320::Hotspot8::doAction(int action) {
break;
case CURSOR_USE:
scene->_sceneMode = 2336;
- scene->setAction(&scene->_sequenceManager1, scene, 2336, &_globals->_player, this, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 2336, &g_globals->_player, this, NULL);
break;
default:
SceneHotspot::doAction(action);
@@ -5606,21 +5606,21 @@ void Scene2320::Hotspot8::doAction(int action) {
void Scene2320::Hotspot10::doAction(int action) {
// Seeker
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2320, 26);
break;
case CURSOR_TALK:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 2329;
- if (_globals->getFlag(13)) {
+ if (g_globals->getFlag(13)) {
scene->_stripManager.start(2337, scene);
- } else if (_globals->getFlag(70)) {
+ } else if (g_globals->getFlag(70)) {
scene->setAction(&scene->_action8);
- } else if (_globals->getFlag(109)) {
+ } else if (g_globals->getFlag(109)) {
scene->setAction(&scene->_sequenceManager1, scene, 2337, NULL);
} else if (!_state) {
++_state;
@@ -5636,29 +5636,29 @@ void Scene2320::Hotspot10::doAction(int action) {
}
void Scene2320::Hotspot11::doAction(int action) {
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2320, 25);
break;
case CURSOR_TALK:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 2329;
- if (_globals->getFlag(13)) {
- _globals->_player.disableControl();
+ if (g_globals->getFlag(13)) {
+ g_globals->_player.disableControl();
scene->_sceneMode = 5000;
scene->_stripManager.start(2336, scene);
- } else if (_globals->getFlag(70)) {
+ } else if (g_globals->getFlag(70)) {
scene->setAction(&scene->_action8);
} else {
scene->_sceneMode = 2329;
if (RING_INVENTORY._ale._sceneNumber == 1) {
scene->setAction(&scene->_sequenceManager1, scene, 2329, NULL);
- } else if (!_globals->getFlag(110)) {
- _globals->setFlag(110);
+ } else if (!g_globals->getFlag(110)) {
+ g_globals->setFlag(110);
scene->setAction(&scene->_sequenceManager1, scene, 2330, NULL);
} else if (RING_INVENTORY._peg._sceneNumber != 1) {
scene->setAction(&scene->_sequenceManager1, scene, 2331, NULL);
@@ -5677,19 +5677,19 @@ void Scene2320::Hotspot11::doAction(int action) {
}
void Scene2320::Hotspot12::doAction(int action) {
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2320, 5);
break;
case CURSOR_USE:
- if (_globals->getFlag(13))
+ if (g_globals->getFlag(13))
SceneItem::display2(2320, 24);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 2322;
- scene->setAction(&scene->_sequenceManager1, scene, 2322, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 2322, &g_globals->_player, NULL);
}
break;
default:
@@ -5700,23 +5700,23 @@ void Scene2320::Hotspot12::doAction(int action) {
void Scene2320::Hotspot14::doAction(int action) {
// Right Console
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2320, 17);
break;
case CURSOR_USE:
- if (_globals->getFlag(24)) {
- _globals->clearFlag(24);
- _globals->_player.disableControl();
+ if (g_globals->getFlag(24)) {
+ g_globals->clearFlag(24);
+ g_globals->_player.disableControl();
scene->_hotspot8.postInit();
scene->_hotspot8.setVisage(2345);
scene->_hotspot8.setPosition(Common::Point(634, 65));
scene->_hotspot8.hide();
- _globals->_sceneItems.push_front(&scene->_hotspot8);
+ g_globals->_sceneItems.push_front(&scene->_hotspot8);
RING_INVENTORY._waldos._sceneNumber = 2320;
scene->_hotspot9.postInit();
@@ -5733,11 +5733,11 @@ void Scene2320::Hotspot14::doAction(int action) {
scene->_hotspot16.hide();
scene->_sceneMode = 2324;
- scene->setAction(&scene->_sequenceManager1, scene, 2324, &_globals->_player, &scene->_hotspot7,
+ scene->setAction(&scene->_sequenceManager1, scene, 2324, &g_globals->_player, &scene->_hotspot7,
&scene->_hotspot8, &scene->_hotspot9, &scene->_hotspot16, NULL);
- } else if (_globals->getFlag(13)) {
+ } else if (g_globals->getFlag(13)) {
SceneItem::display2(2320, 24);
- } else if (!_globals->getFlag(76)) {
+ } else if (!g_globals->getFlag(76)) {
SceneItem::display2(2320, 28);
} else if (!RING_INVENTORY._waldos._sceneNumber) {
SceneItem::display2(2320, 27);
@@ -5753,14 +5753,14 @@ void Scene2320::Hotspot14::doAction(int action) {
void Scene2320::Hotspot15::doAction(int action) {
// Left console (Flycycle console)
- Scene2320 *scene = (Scene2320 *)_globals->_sceneManager._scene;
+ Scene2320 *scene = (Scene2320 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(2320, 16);
break;
case CURSOR_USE:
- if (_globals->getFlag(13))
+ if (g_globals->getFlag(13))
SceneItem::display2(2320, 24);
else
scene->setAction(&scene->_action4);
@@ -5808,7 +5808,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerGameText);
_speakerMText._npc = &_hotspot11;
- _speakerQText._npc = &_globals->_player;
+ _speakerQText._npc = &g_globals->_player;
_hotspotPtr = &_hotspot10;
_hotspot6.postInit();
@@ -5838,33 +5838,33 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_hotspot8.setPosition(Common::Point(541, 103));
_hotspot8.fixPriority(201);
- _globals->_sceneItems.push_back(&_hotspot8);
+ g_globals->_sceneItems.push_back(&_hotspot8);
}
- if (_globals->getFlag(43)) {
+ if (g_globals->getFlag(43)) {
_hotspot11.postInit();
_hotspot11.setVisage(2705);
_hotspot11._strip = 3;
_hotspot11.setPosition(Common::Point(510, 156));
- _globals->_sceneItems.push_back(&_hotspot11);
+ g_globals->_sceneItems.push_back(&_hotspot11);
_hotspot11._state = 0;
_hotspot11.setAction(&_action1);
}
- _globals->_player.postInit();
- if (_globals->getFlag(13))
- _globals->_player.setVisage(2170);
+ g_globals->_player.postInit();
+ if (g_globals->getFlag(13))
+ g_globals->_player.setVisage(2170);
else
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setPosition(Common::Point(320, 79));
- _globals->_player.fixPriority(10);
- _globals->_player.changeZoom(-1);
- _globals->_player._moveDiff.y = 3;
- _globals->_player.disableControl();
-
- if (_globals->getFlag(114)) {
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setPosition(Common::Point(320, 79));
+ g_globals->_player.fixPriority(10);
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player._moveDiff.y = 3;
+ g_globals->_player.disableControl();
+
+ if (g_globals->getFlag(114)) {
_hotspot10.postInit();
_hotspot10.setVisage(2806);
_hotspot10.setPosition(Common::Point(481, 162));
@@ -5872,10 +5872,10 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_hotspot10.setStrip(5);
_hotspot10._state = 0;
- _globals->_sceneItems.push_back(&_hotspot10);
+ g_globals->_sceneItems.push_back(&_hotspot10);
}
- if (_globals->getFlag(70)) {
+ if (g_globals->getFlag(70)) {
_hotspot11.postInit();
_hotspot11.setVisage(2705);
_hotspot11.setPosition(Common::Point(500, 164));
@@ -5886,20 +5886,20 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_hotspot10.changeZoom(-1);
_hotspot10.setStrip(5);
- _globals->_sceneItems.addItems(&_hotspot11, &_hotspot10, NULL);
+ g_globals->_sceneItems.addItems(&_hotspot11, &_hotspot10, NULL);
}
- switch (_globals->_sceneManager._previousScene) {
+ switch (g_globals->_sceneManager._previousScene) {
case 2120:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
- _globals->_player.fixPriority(-1);
- _globals->_player.setPosition(Common::Point(389, 72));
- _globals->_player.enableControl();
+ g_globals->_player.fixPriority(-1);
+ g_globals->_player.setPosition(Common::Point(389, 72));
+ g_globals->_player.enableControl();
break;
case 4000:
- if (!_globals->getFlag(36) && !_globals->getFlag(43)) {
+ if (!g_globals->getFlag(36) && !g_globals->getFlag(43)) {
_hotspot11.postInit();
_hotspot11.setVisage(2705);
_hotspot11.setPosition(Common::Point(178, 118));
@@ -5909,25 +5909,25 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
case 4250:
case 5000:
case 7000:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
- if ((_globals->_sceneManager._previousScene == 7000) && !_globals->getFlag(80))
- _globals->setFlag(36);
-
- _globals->_player.disableControl();
- _globals->_player.animate(ANIM_MODE_NONE, NULL);
- _globals->_player.setObjectWrapper(NULL);
- _globals->_player.setVisage(2347);
- _globals->_player.setStrip(2);
- _globals->_player.setFrame(5);
- _globals->_player.fixPriority(137);
- _globals->_player.setPosition(Common::Point(165, 132));
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
+ if ((g_globals->_sceneManager._previousScene == 7000) && !g_globals->getFlag(80))
+ g_globals->setFlag(36);
+
+ g_globals->_player.disableControl();
+ g_globals->_player.animate(ANIM_MODE_NONE, NULL);
+ g_globals->_player.setObjectWrapper(NULL);
+ g_globals->_player.setVisage(2347);
+ g_globals->_player.setStrip(2);
+ g_globals->_player.setFrame(5);
+ g_globals->_player.fixPriority(137);
+ g_globals->_player.setPosition(Common::Point(165, 132));
setAction(&_action6);
break;
case 6100:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
_hotspot8.postInit();
_hotspot8.setVisage(2345);
@@ -5935,19 +5935,19 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_hotspot8.hide();
_sceneMode = 2325;
- setAction(&_sequenceManager1, this, 2325, &_globals->_player, &_hotspot6, &_hotspot8, &_hotspot7, NULL);
+ setAction(&_sequenceManager1, this, 2325, &g_globals->_player, &_hotspot6, &_hotspot8, &_hotspot7, NULL);
break;
case 7600:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
_soundHandler.play(21);
- _globals->_player.setVisage(2323);
- _globals->_player.setStrip(2);
- _globals->_player.setFrame(_globals->_player.getFrameCount());
- _globals->_player.setPosition(Common::Point(303, 176));
- _globals->_player.fixPriority(-1);
- _globals->_player.disableControl();
+ g_globals->_player.setVisage(2323);
+ g_globals->_player.setStrip(2);
+ g_globals->_player.setFrame(g_globals->_player.getFrameCount());
+ g_globals->_player.setPosition(Common::Point(303, 176));
+ g_globals->_player.fixPriority(-1);
+ g_globals->_player.disableControl();
_hotspot13.setPosition(Common::Point(319, 199));
@@ -5959,14 +5959,14 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_hotspot16.hide();
_sceneMode = 2338;
- setAction(&_sequenceManager1, this, 2338, &_globals->_player, &_hotspot16, &_hotspot13, NULL);
+ setAction(&_sequenceManager1, this, 2338, &g_globals->_player, &_hotspot16, &_hotspot13, NULL);
break;
default:
- switch (_globals->_stripNum) {
+ switch (g_globals->_stripNum) {
case 2101:
- _globals->_player.disableControl();
- _globals->_player.setStrip(3);
- _globals->_player.setPosition(Common::Point(307, 84));
+ g_globals->_player.disableControl();
+ g_globals->_player.setStrip(3);
+ g_globals->_player.setPosition(Common::Point(307, 84));
_hotspot11.postInit();
_hotspot11.setVisage(2705);
@@ -5994,21 +5994,21 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_hotspot8.hide();
_sceneMode = 2325;
- setAction(&_sequenceManager1, this, 2325, &_globals->_player, &_hotspot6, &_hotspot8, &_hotspot7, NULL);
+ setAction(&_sequenceManager1, this, 2325, &g_globals->_player, &_hotspot6, &_hotspot8, &_hotspot7, NULL);
break;
default:
- _globals->_soundHandler.play(160);
- _globals->_soundHandler.holdAt(true);
+ g_globals->_soundHandler.play(160);
+ g_globals->_soundHandler.holdAt(true);
_sceneMode = 2321;
- _globals->_player.setStrip(3);
- setAction(&_sequenceManager1, this, 2321, &_globals->_player, &_hotspot6, NULL);
+ g_globals->_player.setStrip(3);
+ setAction(&_sequenceManager1, this, 2321, &g_globals->_player, &_hotspot6, NULL);
break;
}
}
- _globals->_stripNum = 0;
- _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position);
+ g_globals->_stripNum = 0;
+ g_globals->_sceneManager._scene->_sceneBounds.center(g_globals->_player._position);
loadScene(2320);
_hotspot14._sceneRegionId = 8;
@@ -6019,7 +6019,7 @@ void Scene2320::postInit(SceneObjectList *OwnerList) {
_hotspot5.setBounds(Rect(104, 122, 174, 157));
_hotspot15.setBounds(Rect(191, 53, 205, 63));
- _globals->_sceneItems.addItems(&_hotspot14, &_hotspot15, &_hotspot5, &_hotspot6, &_hotspot12,
+ g_globals->_sceneItems.addItems(&_hotspot14, &_hotspot15, &_hotspot5, &_hotspot6, &_hotspot12,
&_hotspot13, &_hotspot4, &_hotspot3, &_hotspot2, &_hotspot1, NULL);
}
@@ -6033,40 +6033,40 @@ void Scene2320::signal() {
case 2321:
case 2327:
case 2329:
- if (_globals->getFlag(43) && !_hotspot11._action)
+ if (g_globals->getFlag(43) && !_hotspot11._action)
_hotspot11.setAction(&_action1);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 2322:
- _globals->_sceneManager.changeScene(2120);
+ g_globals->_sceneManager.changeScene(2120);
break;
case 2323:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
break;
case 2338:
case 2324:
_hotspot16.remove();
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 2325:
- _globals->setFlag(76);
- _globals->clearFlag(70);
- _globals->_stripNum = 6100;
- _globals->_sceneManager.changeScene(2100);
+ g_globals->setFlag(76);
+ g_globals->clearFlag(70);
+ g_globals->_stripNum = 6100;
+ g_globals->_sceneManager.changeScene(2100);
break;
case 2326:
- _globals->clearFlag(70);
+ g_globals->clearFlag(70);
RING_INVENTORY._nullifier._sceneNumber = 1;
- _globals->_stripNum = 2321;
- _globals->_sceneManager.changeScene(2100);
+ g_globals->_stripNum = 2321;
+ g_globals->_sceneManager.changeScene(2100);
break;
case 2336:
- _globals->setFlag(77);
+ g_globals->setFlag(77);
RING_INVENTORY._waldos._sceneNumber = 1;
_hotspot8.remove();
break;
case 5000:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
}
}
@@ -6082,32 +6082,32 @@ void Scene2400::Action1::signal() {
setDelay(60);
break;
case 1:
- ADD_MOVER(_globals->_player, 160, 71);
+ ADD_MOVER(g_globals->_player, 160, 71);
break;
case 2:
- ADD_MOVER(_globals->_player, 160, 360);
+ ADD_MOVER(g_globals->_player, 160, 360);
break;
case 3:
- _globals->_player._moveDiff = Common::Point(1, 1);
- ADD_MOVER(_globals->_player, 140, 375);
+ g_globals->_player._moveDiff = Common::Point(1, 1);
+ ADD_MOVER(g_globals->_player, 140, 375);
break;
case 4:
- ADD_MOVER(_globals->_player, 87, 338);
+ ADD_MOVER(g_globals->_player, 87, 338);
break;
case 5:
- _globals->_player.hide();
+ g_globals->_player.hide();
setDelay(60);
break;
case 6:
- _globals->_sceneManager.changeScene(4000);
+ g_globals->_sceneManager.changeScene(4000);
break;
}
}
void Scene2400::Action1::dispatch() {
Action::dispatch();
- if ((_actionIndex == 4) && (_globals->_player._percent > 5))
- _globals->_player.changeZoom(_globals->_player._percent - 2);
+ if ((_actionIndex == 4) && (g_globals->_player._percent > 5))
+ g_globals->_player.changeZoom(g_globals->_player._percent - 2);
}
/*--------------------------------------------------------------------------*/
@@ -6117,19 +6117,19 @@ void Scene2400::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(0, 100, 200, 100);
- _globals->_player.postInit();
- _globals->_player.setVisage(2410);
- _globals->_player.setPosition(Common::Point(340, -10));
- _globals->_player.animate(ANIM_MODE_2, NULL);
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(2410);
+ g_globals->_player.setPosition(Common::Point(340, -10));
+ g_globals->_player.animate(ANIM_MODE_2, NULL);
+ g_globals->_player.disableControl();
setAction(&_action1);
- _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position.x, _globals->_player._position.y);
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
+ g_globals->_sceneManager._scene->_sceneBounds.center(g_globals->_player._position.x, g_globals->_player._position.y);
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.left / 160) * 160;
- _globals->_soundHandler.play(153);
+ g_globals->_soundHandler.play(153);
}
} // End of namespace Ringworld
diff --git a/engines/tsage/ringworld/ringworld_scenes3.h b/engines/tsage/ringworld/ringworld_scenes3.h
index 2dbdc27211..682ef44fc6 100644
--- a/engines/tsage/ringworld/ringworld_scenes3.h
+++ b/engines/tsage/ringworld/ringworld_scenes3.h
@@ -27,6 +27,7 @@
#include "tsage/core.h"
#include "tsage/converse.h"
#include "tsage/ringworld/ringworld_logic.h"
+#include "tsage/ringworld/ringworld_speakers.h"
namespace TsAGE {
diff --git a/engines/tsage/ringworld/ringworld_scenes4.cpp b/engines/tsage/ringworld/ringworld_scenes4.cpp
index 0f4c3e49a0..98bf0158e7 100644
--- a/engines/tsage/ringworld/ringworld_scenes4.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes4.cpp
@@ -36,7 +36,7 @@ namespace Ringworld {
*--------------------------------------------------------------------------*/
void Scene3500::Action1::signal() {
- Scene3500 *scene = (Scene3500 *)_globals->_sceneManager._scene;
+ Scene3500 *scene = (Scene3500 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -49,13 +49,13 @@ void Scene3500::Action1::signal() {
setDelay(3);
break;
case 3:
- _globals->_sceneManager.changeScene(9999);
+ g_globals->_sceneManager.changeScene(9999);
break;
}
}
void Scene3500::Action2::signal() {
- Scene3500 *scene = (Scene3500 *)_globals->_sceneManager._scene;
+ Scene3500 *scene = (Scene3500 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -68,7 +68,7 @@ void Scene3500::Action2::signal() {
setDelay(3);
break;
case 3:
- _globals->_sceneManager.changeScene(2012);
+ g_globals->_sceneManager.changeScene(2012);
break;
}
}
@@ -76,17 +76,17 @@ void Scene3500::Action2::signal() {
/*--------------------------------------------------------------------------*/
void Scene3500::postInit(SceneObjectList *OwnerList) {
- loadScene((_globals->_stripNum == 3600) ? 3600 : 3500);
+ loadScene((g_globals->_stripNum == 3600) ? 3600 : 3500);
Scene::postInit();
_stripManager.addSpeaker(&_speakerQText);
_stripManager.addSpeaker(&_speakerMText);
_stripManager.addSpeaker(&_speakerSText);
- _globals->_sceneManager._scene->_sceneBounds.contain(_globals->_sceneManager._scene->_backgroundBounds);
- _globals->_sceneOffset.x = (_globals->_sceneManager._scene->_sceneBounds.top / 160) * 160;
+ g_globals->_sceneManager._scene->_sceneBounds.contain(g_globals->_sceneManager._scene->_backgroundBounds);
+ g_globals->_sceneOffset.x = (g_globals->_sceneManager._scene->_sceneBounds.top / 160) * 160;
- setAction((_globals->_stripNum == 3600) ? (Action *)&_action2 : (Action *)&_action1);
+ setAction((g_globals->_stripNum == 3600) ? (Action *)&_action2 : (Action *)&_action1);
}
/*--------------------------------------------------------------------------
@@ -102,7 +102,7 @@ Scene3700::Viewer::Viewer() {
_frameList[0] = 1;
for (int idx = 1; idx <= 3; ++idx)
- _frameList[idx] = _globals->_randomSource.getRandomNumber(4) + 1;
+ _frameList[idx] = g_globals->_randomSource.getRandomNumber(4) + 1;
_active = true;
_countdownCtr = 0;
@@ -132,7 +132,7 @@ void Scene3700::Viewer::dispatch() {
int newFrame;
do {
- newFrame = _globals->_randomSource.getRandomNumber(4) + 1;
+ newFrame = g_globals->_randomSource.getRandomNumber(4) + 1;
} while (newFrame == _frameList[2]);
_frameList[1] = newFrame;
@@ -146,27 +146,27 @@ void Scene3700::Viewer::reposition() {
}
void Scene3700::Viewer::draw() {
- Region *priorityRegion = _globals->_sceneManager._scene->_priorities.find(1);
+ Region *priorityRegion = g_globals->_sceneManager._scene->_priorities.find(1);
for (int idx = 0; idx < 4; ++idx) {
Visage &v = (idx == 0) ? _images1 : _images2;
GfxSurface img = v.getFrame(_frameList[idx]);
Rect destRect = img.getBounds();
- destRect.resize(img, (_position.x - _globals->_sceneOffset.x),
- (_position.y - _globals->_sceneOffset.y - _yDiff), _percentList[idx]);
+ destRect.resize(img, (_position.x - g_globals->_sceneOffset.x),
+ (_position.y - g_globals->_sceneOffset.y - _yDiff), _percentList[idx]);
- destRect.translate(-_globals->_sceneManager._scene->_sceneBounds.left,
- -_globals->_sceneManager._scene->_sceneBounds.top);
+ destRect.translate(-g_globals->_sceneManager._scene->_sceneBounds.left,
+ -g_globals->_sceneManager._scene->_sceneBounds.top);
- _globals->gfxManager().copyFrom(img, destRect, priorityRegion);
+ g_globals->gfxManager().copyFrom(img, destRect, priorityRegion);
}
}
/*--------------------------------------------------------------------------*/
void Scene3700::Action1::signal() {
- Scene3700 *scene = (Scene3700 *)_globals->_sceneManager._scene;
+ Scene3700 *scene = (Scene3700 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -218,11 +218,11 @@ void Scene3700::Action1::signal() {
case 8:
scene->_hotspot1.remove();
scene->_hotspot2.show();
- _globals->setFlag(59);
+ g_globals->setFlag(59);
setDelay(30);
break;
case 9:
- _globals->_sceneManager.changeScene(2100);
+ g_globals->_sceneManager.changeScene(2100);
break;
}
}
@@ -246,7 +246,7 @@ void Scene3700::postInit(TsAGE::SceneObjectList *OwnerList) {
_viewer.setPosition(Common::Point(195, 83));
setAction(&_action1);
- _globals->_soundHandler.play(195);
+ g_globals->_soundHandler.play(195);
}
} // End of namespace Ringworld
diff --git a/engines/tsage/ringworld/ringworld_scenes4.h b/engines/tsage/ringworld/ringworld_scenes4.h
index af31de84b9..64706805bc 100644
--- a/engines/tsage/ringworld/ringworld_scenes4.h
+++ b/engines/tsage/ringworld/ringworld_scenes4.h
@@ -27,6 +27,7 @@
#include "tsage/core.h"
#include "tsage/converse.h"
#include "tsage/ringworld/ringworld_logic.h"
+#include "tsage/ringworld/ringworld_speakers.h"
namespace TsAGE {
diff --git a/engines/tsage/ringworld/ringworld_scenes5.cpp b/engines/tsage/ringworld/ringworld_scenes5.cpp
index 58f47d7f82..3cf1207e9e 100644
--- a/engines/tsage/ringworld/ringworld_scenes5.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes5.cpp
@@ -37,7 +37,7 @@ namespace Ringworld {
void Scene4000::Action1::signal() {
// Quinn has the peg. Everybody enter the screen.
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
@@ -52,10 +52,10 @@ void Scene4000::Action1::signal() {
scene->_hotspot5.addMover(mover, &pt, this);
RING_INVENTORY._ale._sceneNumber = 0;
- _globals->clearFlag(42);
- _globals->clearFlag(36);
- _globals->clearFlag(43);
- _globals->clearFlag(37);
+ g_globals->clearFlag(42);
+ g_globals->clearFlag(36);
+ g_globals->clearFlag(43);
+ g_globals->clearFlag(37);
break;
}
case 1: {
@@ -85,7 +85,7 @@ void Scene4000::Action1::signal() {
ADD_PLAYER_MOVER_THIS(scene->_miranda, 266, 169);
- ADD_PLAYER_MOVER_NULL(_globals->_player, 241, 155);
+ ADD_PLAYER_MOVER_NULL(g_globals->_player, 241, 155);
break;
}
case 2:
@@ -104,14 +104,14 @@ void Scene4000::Action1::signal() {
ADD_MOVER_NULL(scene->_hotspot5, -40, 86);
break;
case 5:
- _globals->_soundHandler.play(155);
- _globals->setFlag(43);
- _globals->setFlag(114);
+ g_globals->_soundHandler.play(155);
+ g_globals->setFlag(43);
+ g_globals->setFlag(114);
scene->_stripManager.start(4430, this);
break;
case 6:
ADD_PLAYER_MOVER_THIS(scene->_olo, 277, 175);
- ADD_PLAYER_MOVER_NULL(_globals->_player, 258, 187);
+ ADD_PLAYER_MOVER_NULL(g_globals->_player, 258, 187);
break;
case 7:
scene->_stripManager.start(4440, this);
@@ -120,8 +120,8 @@ void Scene4000::Action1::signal() {
setDelay(30);
break;
case 9:
- _globals->setFlag(96);
- _globals->_sceneManager.changeScene(4025);
+ g_globals->setFlag(96);
+ g_globals->_sceneManager.changeScene(4025);
break;
}
}
@@ -129,11 +129,11 @@ void Scene4000::Action1::signal() {
void Scene4000::Action2::signal() {
// Quinn, Seeker and Miranda walks down to the village
// Then, they talk to Rock, and enter the priest hut
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- setAction(&scene->_sequenceManager1, this, 4001, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager1, this, 4001, &g_globals->_player, NULL);
scene->_hotspot5.postInit();
scene->_hotspot5.setVisage(2801);
@@ -146,13 +146,13 @@ void Scene4000::Action2::signal() {
scene->_miranda.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_miranda, NULL);
break;
case 1:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_lander.remove();
ADD_MOVER(scene->_guardRock, scene->_hotspot5._position.x + 30, scene->_hotspot5._position.y - 10);
break;
case 2:
- _globals->_player.checkAngle(&scene->_guardRock);
+ g_globals->_player.checkAngle(&scene->_guardRock);
scene->_hotspot5.checkAngle(&scene->_guardRock);
scene->_miranda.checkAngle(&scene->_guardRock);
scene->_stripManager.start(4000, this);
@@ -165,7 +165,7 @@ void Scene4000::Action2::signal() {
ADD_MOVER(scene->_hotspot2, 116, 160);
ADD_MOVER(scene->_hotspot5, 116, 160);
- _globals->setFlag(37);
+ g_globals->setFlag(37);
break;
case 4:
break;
@@ -178,14 +178,14 @@ void Scene4000::Action2::signal() {
ADD_PLAYER_MOVER_NULL(scene->_miranda, 210, 133);
break;
case 7:
- _globals->_sceneManager.changeScene(4045);
+ g_globals->_sceneManager.changeScene(4045);
break;
}
}
void Scene4000::Action3::signal() {
// The guard walks to the left and exits the screen
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -204,19 +204,19 @@ void Scene4000::Action3::signal() {
void Scene4000::Action4::signal() {
// Quinn ties the rope to the rock
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player._uiEnabled = false;
- ADD_MOVER(_globals->_player, 257, 57);
+ g_globals->_player._uiEnabled = false;
+ ADD_MOVER(g_globals->_player, 257, 57);
break;
case 1:
- _globals->_player.setVisage(4008);
- _globals->_player.setPosition(Common::Point(258, 83));
- _globals->_player._frame = 1;
- _globals->_player._strip = 3;
- _globals->_player.animate(ANIM_MODE_4, 2, 1, this);
+ g_globals->_player.setVisage(4008);
+ g_globals->_player.setPosition(Common::Point(258, 83));
+ g_globals->_player._frame = 1;
+ g_globals->_player._strip = 3;
+ g_globals->_player.animate(ANIM_MODE_4, 2, 1, this);
break;
case 2:
scene->_rope.postInit();
@@ -226,16 +226,16 @@ void Scene4000::Action4::signal() {
scene->_rope.setPosition(Common::Point(268, 44));
RING_INVENTORY._rope._sceneNumber = 4000;
- _globals->_events.setCursor(CURSOR_USE);
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_events.setCursor(CURSOR_USE);
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 3:
- _globals->_player.setVisage(2602);
- _globals->_player.setPosition(Common::Point(257, 57));
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player._uiEnabled = true;
+ g_globals->_player.setVisage(2602);
+ g_globals->_player.setPosition(Common::Point(257, 57));
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player._uiEnabled = true;
- _globals->setFlag(41);
+ g_globals->setFlag(41);
remove();
break;
}
@@ -243,15 +243,15 @@ void Scene4000::Action4::signal() {
void Scene4000::Action5::signal() {
// Chat with Miranda
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(15);
break;
case 1:
- scene->_stripManager.start(_globals->_stripNum, this);
+ scene->_stripManager.start(g_globals->_stripNum, this);
break;
case 2:
setDelay(10);
@@ -262,7 +262,7 @@ void Scene4000::Action5::signal() {
scene->_hotspot8.setFrame2(-1);
scene->_hotspot8.setAction(&scene->_action3);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -271,102 +271,102 @@ void Scene4000::Action5::signal() {
void Scene4000::Action6::signal() {
// Quinn and Miranda enter the screen and walk to the village.
// Rock comes and notices the alcohol. They all enter his hut.
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(30);
break;
case 1:
- setAction(&scene->_sequenceManager1, this, 4001, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager1, this, 4001, &g_globals->_player, NULL);
- if (!_globals->getFlag(36))
+ if (!g_globals->getFlag(36))
scene->_miranda.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_miranda, NULL);
break;
case 2:
- _globals->_player.disableControl();
- ADD_MOVER(scene->_guardRock, _globals->_player._position.x + 30, _globals->_player._position.y - 5);
+ g_globals->_player.disableControl();
+ ADD_MOVER(scene->_guardRock, g_globals->_player._position.x + 30, g_globals->_player._position.y - 5);
break;
case 3:
- scene->_stripManager.start(_globals->getFlag(35) ? 4500 : 4502, this);
+ scene->_stripManager.start(g_globals->getFlag(35) ? 4500 : 4502, this);
break;
case 4:
- _globals->clearFlag(35);
+ g_globals->clearFlag(35);
ADD_MOVER_NULL(scene->_guardRock, 292, 138);
ADD_PLAYER_MOVER(283, 147);
- if (!_globals->getFlag(36))
+ if (!g_globals->getFlag(36))
ADD_PLAYER_MOVER_NULL(scene->_miranda, 280, 150);
RING_INVENTORY._ale._sceneNumber = 4100;
break;
case 5:
- _globals->_sceneManager.changeScene(4100);
+ g_globals->_sceneManager.changeScene(4100);
break;
}
}
void Scene4000::Action7::signal() {
// Climb down left Chimney using a rope
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_rope.setFrame(1);
- ADD_MOVER(_globals->_player, 247, 53);
+ ADD_MOVER(g_globals->_player, 247, 53);
break;
case 1:
- _globals->_player.setVisage(4008);
- _globals->_player.setStrip(4);
- _globals->_player.setFrame(1);
- _globals->_player.fixPriority(16);
- _globals->_player.setPosition(Common::Point(260, 55));
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(4008);
+ g_globals->_player.setStrip(4);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.fixPriority(16);
+ g_globals->_player.setPosition(Common::Point(260, 55));
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 2:
- _globals->_sceneManager.changeScene(4050);
+ g_globals->_sceneManager.changeScene(4050);
break;
}
}
void Scene4000::Action8::signal() {
// Climb down right Chimney using a rope
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
- if (_globals->getFlag(41))
+ g_globals->_player.disableControl();
+ if (g_globals->getFlag(41))
scene->_rope.setFrame(2);
- ADD_MOVER(_globals->_player, 289, 53);
+ ADD_MOVER(g_globals->_player, 289, 53);
break;
case 1:
- _globals->_player.setVisage(4008);
- _globals->_player.setStrip(5);
- _globals->_player.fixPriority(16);
- _globals->_player.setFrame(1);
- _globals->_player.setPosition(Common::Point(283, 52));
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(4008);
+ g_globals->_player.setStrip(5);
+ g_globals->_player.fixPriority(16);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.setPosition(Common::Point(283, 52));
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 2:
- _globals->_player.remove();
+ g_globals->_player.remove();
setDelay(60);
break;
case 3:
- _globals->_soundHandler.play(170);
+ g_globals->_soundHandler.play(170);
scene->_smoke2.setVisage(4000);
scene->_smoke2.setStrip(6);
scene->_smoke2.animate(ANIM_MODE_2, NULL);
setDelay(60);
break;
case 4:
- _globals->_soundHandler.play(77, this);
+ g_globals->_soundHandler.play(77, this);
break;
case 5:
- _globals->_game->endGame(4000, 15);
+ g_globals->_game->endGame(4000, 15);
remove();
break;
}
@@ -376,7 +376,7 @@ void Scene4000::Action9::signal() {
// Villager animations
switch (_actionIndex++) {
case 0:
- setDelay(_globals->_randomSource.getRandomNumber(119) + 240);
+ setDelay(g_globals->_randomSource.getRandomNumber(119) + 240);
break;
case 1:
static_cast<SceneObject *>(_owner)->animate(ANIM_MODE_8, 1, this);
@@ -389,7 +389,7 @@ void Scene4000::Action10::signal() {
// Villager animations
switch (_actionIndex++) {
case 0:
- setDelay(_globals->_randomSource.getRandomNumber(119) + 240);
+ setDelay(g_globals->_randomSource.getRandomNumber(119) + 240);
break;
case 1:
static_cast<SceneObject *>(_owner)->animate(ANIM_MODE_8, 1, this);
@@ -399,11 +399,11 @@ void Scene4000::Action10::signal() {
}
void Scene4000::Action11::signal() {
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
ADD_MOVER(scene->_lander, -30, 70);
break;
case 1:
@@ -417,7 +417,7 @@ void Scene4000::Action11::signal() {
scene->_hotspot5._moveDiff.x = 4;
scene->_hotspot5.setPosition(Common::Point(-8, 88));
- setAction(&scene->_sequenceManager1, this, 4001, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager1, this, 4001, &g_globals->_player, NULL);
scene->_miranda.setPosition(Common::Point(-210, 139));
scene->_miranda.setAction(&scene->_sequenceManager2, NULL, 4002, &scene->_miranda, NULL);
@@ -434,33 +434,33 @@ void Scene4000::Action11::signal() {
scene->_soundHandler1.stop();
scene->_forceField.remove();
- ADD_MOVER(_globals->_player, 340, 163);
+ ADD_MOVER(g_globals->_player, 340, 163);
ADD_MOVER_NULL(scene->_miranda, 340, 169);
ADD_MOVER_NULL(scene->_hotspot5, 340, 165);
break;
case 6:
- _globals->_sceneManager.changeScene(4250);
+ g_globals->_sceneManager.changeScene(4250);
break;
}
}
void Scene4000::Action12::signal() {
// Quinn enter Rock's hut
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(5);
break;
case 1:
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start(4015, this);
break;
case 2:
- _globals->setFlag(32);
+ g_globals->setFlag(32);
if (scene->_stripManager._field2E8 == 275) {
- _globals->setFlag(82);
+ g_globals->setFlag(82);
ADD_MOVER_NULL(scene->_guardRock, 292, 138);
ADD_PLAYER_MOVER(283, 147);
} else {
@@ -469,7 +469,7 @@ void Scene4000::Action12::signal() {
break;
case 3:
if (scene->_stripManager._field2E8 == 275) {
- _globals->_sceneManager.changeScene(4100);
+ g_globals->_sceneManager.changeScene(4100);
} else {
ADD_PLAYER_MOVER_THIS(scene->_guardRock, 300, 132);
}
@@ -479,8 +479,8 @@ void Scene4000::Action12::signal() {
scene->_stripManager.start(4020, this);
break;
case 5:
- _globals->setFlag(35);
- _globals->_player.enableControl();
+ g_globals->setFlag(35);
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -488,11 +488,11 @@ void Scene4000::Action12::signal() {
void Scene4000::Action13::signal() {
// Lander is landing
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(3);
break;
case 1:
@@ -502,7 +502,7 @@ void Scene4000::Action13::signal() {
break;
case 2:
scene->_soundHandler2.release();
- _globals->_sceneManager.changeScene(4010);
+ g_globals->_sceneManager.changeScene(4010);
break;
}
}
@@ -510,7 +510,7 @@ void Scene4000::Action13::signal() {
/*--------------------------------------------------------------------------*/
void Scene4000::Miranda::doAction(int action) {
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_STUNNER:
@@ -520,28 +520,28 @@ void Scene4000::Miranda::doAction(int action) {
SceneItem::display2(4000, 29);
break;
case CURSOR_TALK:
- if (_globals->getFlag(31)) {
- if (!_globals->getFlag(111)) {
- _globals->setFlag(111);
- _globals->_stripNum = 4070;
- } else if (!_globals->getFlag(33))
- _globals->_stripNum = 4094;
- else if (!_globals->getFlag(112)) {
- _globals->setFlag(112);
- _globals->_stripNum = 4300;
- } else if (!_globals->getFlag(113)) {
- _globals->setFlag(113);
- _globals->_stripNum = 4093;
+ if (g_globals->getFlag(31)) {
+ if (!g_globals->getFlag(111)) {
+ g_globals->setFlag(111);
+ g_globals->_stripNum = 4070;
+ } else if (!g_globals->getFlag(33))
+ g_globals->_stripNum = 4094;
+ else if (!g_globals->getFlag(112)) {
+ g_globals->setFlag(112);
+ g_globals->_stripNum = 4300;
+ } else if (!g_globals->getFlag(113)) {
+ g_globals->setFlag(113);
+ g_globals->_stripNum = 4093;
} else
- _globals->_stripNum = 4094;
+ g_globals->_stripNum = 4094;
} else {
- if (!_globals->getFlag(33))
- _globals->_stripNum = 4094;
- else if (!_globals->getFlag(112)) {
- _globals->setFlag(112);
- _globals->_stripNum = 4300;
+ if (!g_globals->getFlag(33))
+ g_globals->_stripNum = 4094;
+ else if (!g_globals->getFlag(112)) {
+ g_globals->setFlag(112);
+ g_globals->_stripNum = 4300;
} else
- _globals->_stripNum = 4094;
+ g_globals->_stripNum = 4094;
}
scene->setAction(&scene->_action5);
@@ -554,7 +554,7 @@ void Scene4000::Miranda::doAction(int action) {
void Scene4000::Hotspot8::doAction(int action) {
// Guard
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_STUNNER:
@@ -569,20 +569,20 @@ void Scene4000::Hotspot8::doAction(int action) {
else {
switch (_ctr) {
case 0:
- _globals->_stripNum = 4090;
+ g_globals->_stripNum = 4090;
break;
case 1:
- _globals->_stripNum = 4091;
+ g_globals->_stripNum = 4091;
break;
case 2:
- _globals->_stripNum = 4092;
+ g_globals->_stripNum = 4092;
break;
default:
SceneItem::display2(4000, 34);
break;
}
- if (_globals->_stripNum) {
+ if (g_globals->_stripNum) {
setAction(NULL);
addMover(NULL);
++_ctr;
@@ -614,20 +614,20 @@ void Scene4000::GuardRock::doAction(int action) {
}
void Scene4000::Ladder::doAction(int action) {
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(4000, 30);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
- if (_globals->getFlag(40)) {
+ g_globals->_player.disableControl();
+ if (g_globals->getFlag(40)) {
scene->_sceneMode = 4005;
- scene->setAction(&scene->_sequenceManager1, scene, 4005, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 4005, &g_globals->_player, NULL);
} else {
scene->_sceneMode = 4004;
- scene->setAction(&scene->_sequenceManager1, scene, 4004, &_globals->_player, &scene->_ladder, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 4004, &g_globals->_player, &scene->_ladder, NULL);
}
break;
default:
@@ -637,7 +637,7 @@ void Scene4000::Ladder::doAction(int action) {
}
void Scene4000::TheTech::doAction(int action) {
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -650,15 +650,15 @@ void Scene4000::TheTech::doAction(int action) {
SceneItem::display2(4000, 20);
break;
case CURSOR_USE:
- if (_globals->getFlag(40))
+ if (g_globals->getFlag(40))
SceneItem::display2(4000, 37);
else {
- _globals->_player.disableControl();
- if (_globals->_sceneObjects->contains(&scene->_miranda))
- _globals->clearFlag(96);
+ g_globals->_player.disableControl();
+ if (g_globals->_sceneObjects->contains(&scene->_miranda))
+ g_globals->clearFlag(96);
scene->_sceneMode = 4012;
- scene->setAction(&scene->_sequenceManager1, scene, 4012, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 4012, &g_globals->_player, NULL);
}
break;
default:
@@ -669,14 +669,14 @@ void Scene4000::TheTech::doAction(int action) {
void Scene4000::Hotspot13::doAction(int action) {
// Rock between the two chimneys
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(4000, 21);
break;
case OBJECT_ROPE:
- if (_globals->getFlag(40))
+ if (g_globals->getFlag(40))
scene->setAction(&scene->_action4);
else
SceneItem::display2(4000, 22);
@@ -689,7 +689,7 @@ void Scene4000::Hotspot13::doAction(int action) {
void Scene4000::Hotspot::doAction(int action) {
// Wall between the two doors
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -702,16 +702,16 @@ void Scene4000::Hotspot::doAction(int action) {
SceneItem::display2(4000, 18);
break;
case OBJECT_LADDER: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_ladder.postInit();
scene->_ladder.setVisage(4000);
scene->_ladder.setStrip(5);
scene->_ladder.setPosition(Common::Point(245, 147));
scene->_ladder.hide();
- _globals->_sceneItems.push_front(&scene->_ladder);
+ g_globals->_sceneItems.push_front(&scene->_ladder);
- if (_globals->_sceneObjects->contains(&scene->_hotspot8)) {
+ if (g_globals->_sceneObjects->contains(&scene->_hotspot8)) {
scene->_hotspot8.setAction(NULL);
Common::Point pt(118, 145);
NpcMover *mover = new NpcMover();
@@ -719,7 +719,7 @@ void Scene4000::Hotspot::doAction(int action) {
}
scene->_sceneMode = 4004;
- scene->setAction(&scene->_sequenceManager1, scene, 4011, &_globals->_player, &scene->_ladder, NULL);
+ scene->setAction(&scene->_sequenceManager1, scene, 4011, &g_globals->_player, &scene->_ladder, NULL);
break;
}
default:
@@ -730,14 +730,14 @@ void Scene4000::Hotspot::doAction(int action) {
void Scene4000::Hotspot17::doAction(int action) {
// Left Chimney
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(4000, 23);
break;
case CURSOR_USE:
- if (_globals->getFlag(40))
+ if (g_globals->getFlag(40))
scene->setAction(&scene->_action7);
else
SceneItem::display2(4000, 24);
@@ -750,14 +750,14 @@ void Scene4000::Hotspot17::doAction(int action) {
void Scene4000::Hotspot18::doAction(int action) {
// Right Chimney
- Scene4000 *scene = (Scene4000 *)_globals->_sceneManager._scene;
+ Scene4000 *scene = (Scene4000 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(4000, 36);
break;
case CURSOR_USE:
- if (_globals->getFlag(40))
+ if (g_globals->getFlag(40))
scene->setAction(&scene->_action8);
else
SceneItem::display2(4000, 24);
@@ -772,7 +772,7 @@ void Scene4000::Hotspot23::doAction(int action) {
// Door of the temple
switch (action) {
case CURSOR_LOOK:
- SceneItem::display2(4000, _globals->getFlag(31) ? 10 : 9);
+ SceneItem::display2(4000, g_globals->getFlag(31) ? 10 : 9);
break;
default:
SceneHotspot::doAction(action);
@@ -817,7 +817,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_speakerSText._npc = &_hotspot5;
_speakerMText._npc = &_miranda;
_speakerPText._npc = &_olo;
- _speakerQText._npc = &_globals->_player;
+ _speakerQText._npc = &g_globals->_player;
_hotspot13.setBounds(Rect(263, 41, 278, 55));
_hotspot14.setBounds(Rect(96 /*140*/, 177, 140 /*96*/, 204));
@@ -868,7 +868,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_theTech.fixPriority(200);
_theTech.setPosition(Common::Point(281, 176));
- if (_globals->getFlag(34)) {
+ if (g_globals->getFlag(34)) {
_soundHandler1.play(156);
_forceField.postInit();
@@ -878,16 +878,16 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_forceField.fixPriority(200);
_forceField.animate(ANIM_MODE_8, 0, NULL);
- _globals->_sceneItems.push_back(&_forceField);
+ g_globals->_sceneItems.push_back(&_forceField);
}
- _globals->_player.postInit();
- _globals->_player.setVisage(2602);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setPosition(Common::Point(-28, 86));
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(2602);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setPosition(Common::Point(-28, 86));
- if (!_globals->getFlag(36) && !_globals->getFlag(43)) {
+ if (!g_globals->getFlag(36) && !g_globals->getFlag(43)) {
_miranda.postInit();
_miranda.setVisage(2701);
_miranda.animate(ANIM_MODE_1, NULL);
@@ -895,14 +895,14 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_miranda._moveDiff = Common::Point(4, 2);
_miranda.setPosition(Common::Point(-210, 139));
- _globals->_sceneItems.push_back(&_miranda);
+ g_globals->_sceneItems.push_back(&_miranda);
}
- _globals->clearFlag(40);
+ g_globals->clearFlag(40);
- switch (_globals->_sceneManager._previousScene) {
+ switch (g_globals->_sceneManager._previousScene) {
case 2320:
- _globals->_soundHandler.play(155);
+ g_globals->_soundHandler.play(155);
if (RING_INVENTORY._ale._sceneNumber == 1) {
_guardRock.postInit();
@@ -913,17 +913,17 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
setAction(&_action6);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 4001;
- setAction(&_sequenceManager1, this, 4001, &_globals->_player, NULL);
+ setAction(&_sequenceManager1, this, 4001, &g_globals->_player, NULL);
- if (!_globals->getFlag(36) && !_globals->getFlag(43))
+ if (!g_globals->getFlag(36) && !g_globals->getFlag(43))
_miranda.setAction(&_sequenceManager2, NULL, 4002, &_miranda, NULL);
}
- if (_globals->getFlag(42))
+ if (g_globals->getFlag(42))
_hotspot8.setAction(&_action3);
- else if (_globals->getFlag(91))
+ else if (g_globals->getFlag(91))
_hotspot8.remove();
break;
@@ -950,12 +950,12 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
if (RING_INVENTORY._ladder._sceneNumber == 4000)
_hotspot8.remove();
- _globals->_player.setPosition(Common::Point(260, 185));
+ g_globals->_player.setPosition(Common::Point(260, 185));
- if (!_globals->getFlag(36) && !_globals->getFlag(43))
+ if (!g_globals->getFlag(36) && !g_globals->getFlag(43))
_miranda.setPosition(Common::Point(246, 146));
- if (_globals->getFlag(96)) {
+ if (g_globals->getFlag(96)) {
_olo.postInit();
_olo.setVisage(4006);
_olo.animate(ANIM_MODE_1, NULL);
@@ -963,7 +963,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_olo.setPosition(Common::Point(290, 163));
}
- if (_globals->_stripNum == 4025) {
+ if (g_globals->_stripNum == 4025) {
_soundHandler1.play(182);
_forceField.remove();
@@ -974,9 +974,9 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_hotspot5._moveDiff.x = 4;
_hotspot5.setPosition(Common::Point(-18, 86));
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
- if (!_globals->getFlag(96)) {
+ if (!g_globals->getFlag(96)) {
_olo.postInit();
_olo.setVisage(4006);
_olo.animate(ANIM_MODE_1, NULL);
@@ -990,17 +990,17 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_sceneMode = 4003;
setAction(&_sequenceManager1, this, 4003, &_hotspot5, NULL);
- } else if (_globals->getFlag(96)) {
- _globals->_player.disableControl();
+ } else if (g_globals->getFlag(96)) {
+ g_globals->_player.disableControl();
_sceneMode = 4013;
setAction(&_sequenceManager1, this, 4013, &_olo, NULL);
}
- _globals->clearFlag(96);
+ g_globals->clearFlag(96);
break;
case 4045:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
if (RING_INVENTORY._ladder._sceneNumber != 4000) {
_hotspot8.setVisage(4017);
@@ -1009,13 +1009,13 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_hotspot8.setAction(&_action3);
}
- _globals->_player.setPosition(Common::Point(208, 153));
- if (!_globals->getFlag(36) && !_globals->getFlag(43))
+ g_globals->_player.setPosition(Common::Point(208, 153));
+ if (!g_globals->getFlag(36) && !g_globals->getFlag(43))
_miranda.setPosition(Common::Point(246, 146));
- if (_globals->getFlag(39)) {
+ if (g_globals->getFlag(39)) {
// Ollo follows Quinn and gives explanations on the Tech.
- _globals->clearFlag(39);
+ g_globals->clearFlag(39);
_olo.postInit();
_olo.setVisage(4006);
@@ -1024,14 +1024,14 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_olo.setPosition(Common::Point(219, 150));
_sceneMode = 4010;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
// This is the buggy animation where Miranda comments the Tech even
// if she's not in the room but in the lander.
- setAction(&_sequenceManager1, this, 4010, &_globals->_player, &_olo, NULL);
+ setAction(&_sequenceManager1, this, 4010, &g_globals->_player, &_olo, NULL);
}
- if (_globals->_stripNum == 4000) {
- _globals->_stripNum = 0;
+ if (g_globals->_stripNum == 4000) {
+ g_globals->_stripNum = 0;
_guardRock.postInit();
_guardRock.setVisage(4001);
@@ -1045,21 +1045,21 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
break;
case 4050:
- _globals->_soundHandler.play(155);
- _globals->_player.disableControl();
+ g_globals->_soundHandler.play(155);
+ g_globals->_player.disableControl();
- if (_globals->_stripNum == 4050) {
- _globals->_player.setVisage(4008);
- _globals->_player.setStrip(4);
- _globals->_player.setFrame(_globals->_player.getFrameCount());
- _globals->_player.fixPriority(16);
- _globals->_player.setPosition(Common::Point(260, 55));
+ if (g_globals->_stripNum == 4050) {
+ g_globals->_player.setVisage(4008);
+ g_globals->_player.setStrip(4);
+ g_globals->_player.setFrame(g_globals->_player.getFrameCount());
+ g_globals->_player.fixPriority(16);
+ g_globals->_player.setPosition(Common::Point(260, 55));
_sceneMode = 4007;
- setAction(&_sequenceManager1, this, 4007, &_globals->_player, NULL);
+ setAction(&_sequenceManager1, this, 4007, &g_globals->_player, NULL);
} else {
- _globals->_player.setPosition(Common::Point(208, 153));
- _globals->_player.enableControl();
+ g_globals->_player.setPosition(Common::Point(208, 153));
+ g_globals->_player.enableControl();
}
if (RING_INVENTORY._ladder._sceneNumber != 4000)
@@ -1067,22 +1067,22 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
break;
case 4100:
- _globals->_player.enableControl();
- _globals->_player.setPosition(Common::Point(270, 155));
+ g_globals->_player.enableControl();
+ g_globals->_player.setPosition(Common::Point(270, 155));
- if (_globals->getFlag(42) && (RING_INVENTORY._ladder._sceneNumber != 4000)) {
+ if (g_globals->getFlag(42) && (RING_INVENTORY._ladder._sceneNumber != 4000)) {
_hotspot8.setVisage(4017);
_hotspot8.animate(ANIM_MODE_1, NULL);
_hotspot8.setPosition(Common::Point(244, 151));
_hotspot8.setAction(&_action3);
}
- if (!_globals->getFlag(36) && !_globals->getFlag(43))
+ if (!g_globals->getFlag(36) && !g_globals->getFlag(43))
_miranda.setPosition(Common::Point(246, 146));
break;
default:
- _globals->_soundHandler.play(155);
+ g_globals->_soundHandler.play(155);
_lander.postInit();
_lander.setVisage(4002);
@@ -1092,7 +1092,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_lander.setPosition(Common::Point(130, -1));
_lander.animate(ANIM_MODE_2, NULL);
- if (_globals->_stripNum == 9000) {
+ if (g_globals->_stripNum == 9000) {
_olo.postInit();
_olo.setVisage(4006);
_olo.setPosition(Common::Point(235, 153));
@@ -1115,7 +1115,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_forceField.fixPriority(200);
_forceField.animate(ANIM_MODE_8, 0, NULL);
} else {
- if (!_globals->getFlag(37)) {
+ if (!g_globals->getFlag(37)) {
_hotspot2.postInit();
_hotspot2.setVisage(4018);
_hotspot2._strip = 1;
@@ -1136,7 +1136,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_ladder.setStrip(5);
_ladder.setPosition(Common::Point(245, 147));
- _globals->_sceneItems.push_back(&_ladder);
+ g_globals->_sceneItems.push_back(&_ladder);
}
if (RING_INVENTORY._rope._sceneNumber == 4000) {
@@ -1147,7 +1147,7 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
_rope.setPosition(Common::Point(268, 44));
}
- _globals->_sceneItems.addItems(&_hotspot8, &_hotspot17, &_hotspot18, &_hotspot14, &_hotspot15,
+ g_globals->_sceneItems.addItems(&_hotspot8, &_hotspot17, &_hotspot18, &_hotspot14, &_hotspot15,
&_hotspot16, &_theTech, &_hotspot13, &_hotspot21, &_hotspot20, &_hotspot22, &_hotspot23,
&_hotspot24, &_hotspot25, &_hotspot19, &_hotspot26, NULL);
}
@@ -1155,51 +1155,51 @@ void Scene4000::postInit(SceneObjectList *OwnerList) {
void Scene4000::signal() {
switch (_sceneMode) {
case 4010:
- _globals->setFlag(38);
+ g_globals->setFlag(38);
_olo.remove();
// Deliberate fall-through
case 4001:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 4002:
case 4011:
break;
case 4003:
_sceneMode = 4014;
- setAction(&_sequenceManager1, this, 4014, &_globals->_player, &_hotspot5, NULL);
+ setAction(&_sequenceManager1, this, 4014, &g_globals->_player, &_hotspot5, NULL);
break;
case 4004:
RING_INVENTORY._ladder._sceneNumber = 4000;
// Deliberate fall-through
case 4007:
- _globals->_player._uiEnabled = true;
- _globals->_events.setCursor(CURSOR_USE);
- _globals->setFlag(40);
+ g_globals->_player._uiEnabled = true;
+ g_globals->_events.setCursor(CURSOR_USE);
+ g_globals->setFlag(40);
break;
case 4005:
- _globals->_player.enableControl();
- _globals->_events.setCursor(CURSOR_WALK);
- _globals->clearFlag(40);
+ g_globals->_player.enableControl();
+ g_globals->_events.setCursor(CURSOR_WALK);
+ g_globals->clearFlag(40);
break;
case 4006:
- _globals->_sceneManager.changeScene(4045);
+ g_globals->_sceneManager.changeScene(4045);
break;
case 4008:
- _globals->_sceneManager.changeScene(2320);
+ g_globals->_sceneManager.changeScene(2320);
break;
case 4009:
- _globals->_sceneManager.changeScene(2200);
+ g_globals->_sceneManager.changeScene(2200);
break;
case 4012:
- _globals->_player.checkAngle(&_theTech);
- _globals->_sceneManager.changeScene(4025);
+ g_globals->_player.checkAngle(&_theTech);
+ g_globals->_sceneManager.changeScene(4025);
break;
case 4013:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
_olo.remove();
break;
case 4014:
- _globals->_sceneManager.changeScene(4250);
+ g_globals->_sceneManager.changeScene(4250);
break;
case 4015:
ADD_MOVER_NULL(_miranda, 0, _miranda._position.y - 5);
@@ -1210,14 +1210,14 @@ void Scene4000::signal() {
void Scene4000::dispatch() {
Scene::dispatch();
- if ((_globals->_player.getRegionIndex() == 10) || (_globals->_player.getRegionIndex() == 6))
- _globals->_player.fixPriority(200);
- if (_globals->_player.getRegionIndex() == 11)
- _globals->_player.fixPriority(-1);
- if (_globals->_player.getRegionIndex() == 5)
- _globals->_player.fixPriority(94);
+ if ((g_globals->_player.getRegionIndex() == 10) || (g_globals->_player.getRegionIndex() == 6))
+ g_globals->_player.fixPriority(200);
+ if (g_globals->_player.getRegionIndex() == 11)
+ g_globals->_player.fixPriority(-1);
+ if (g_globals->_player.getRegionIndex() == 5)
+ g_globals->_player.fixPriority(94);
- if (_globals->_sceneObjects->contains(&_hotspot5)) {
+ if (g_globals->_sceneObjects->contains(&_hotspot5)) {
if ((_hotspot5.getRegionIndex() == 10) || (_hotspot5.getRegionIndex() == 6))
_hotspot5.fixPriority(200);
if (_hotspot5.getRegionIndex() == 11)
@@ -1226,10 +1226,10 @@ void Scene4000::dispatch() {
_hotspot5.fixPriority(94);
}
- if (_globals->_sceneObjects->contains(&_miranda)) {
+ if (g_globals->_sceneObjects->contains(&_miranda)) {
if (!_miranda._mover)
- _miranda.checkAngle(&_globals->_player);
- if (!_action && _globals->_player.getRegionIndex() == 23) {
+ _miranda.checkAngle(&g_globals->_player);
+ if (!_action && g_globals->_player.getRegionIndex() == 23) {
ADD_MOVER_NULL(_miranda, 204, 186);
}
@@ -1242,30 +1242,30 @@ void Scene4000::dispatch() {
}
if (!_action) {
- if ((RING_INVENTORY._peg._sceneNumber == 1) && _globals->getFlag(34) &&
- _globals->getFlag(37) && !_globals->getFlag(40)) {
- _globals->_player.disableControl();
+ if ((RING_INVENTORY._peg._sceneNumber == 1) && g_globals->getFlag(34) &&
+ g_globals->getFlag(37) && !g_globals->getFlag(40)) {
+ g_globals->_player.disableControl();
_soundHandler1.play(177);
- _globals->_soundHandler.play(178);
+ g_globals->_soundHandler.play(178);
setAction(&_action1);
}
- if (_globals->_player.getRegionIndex() == 2)
- _globals->_sceneManager.changeScene(4045);
- if (_globals->_player.getRegionIndex() == 15)
- _globals->_sceneManager.changeScene(4100);
+ if (g_globals->_player.getRegionIndex() == 2)
+ g_globals->_sceneManager.changeScene(4045);
+ if (g_globals->_player.getRegionIndex() == 15)
+ g_globals->_sceneManager.changeScene(4100);
- if ((_globals->_player._position.x <= 5) && (_globals->_player._position.y < 100)) {
- _globals->_player.disableControl();
+ if ((g_globals->_player._position.x <= 5) && (g_globals->_player._position.y < 100)) {
+ g_globals->_player.disableControl();
- if (!_globals->_sceneObjects->contains(&_miranda) || (_miranda._position.y <= 100)) {
+ if (!g_globals->_sceneObjects->contains(&_miranda) || (_miranda._position.y <= 100)) {
_sceneMode = 4008;
- setAction(&_sequenceManager1, this, 4008, &_globals->_player, NULL);
+ setAction(&_sequenceManager1, this, 4008, &g_globals->_player, NULL);
} else {
_sceneMode = 4015;
- _globals->_player.addMover(NULL);
- setAction(&_sequenceManager1, this, 4015, &_globals->_player, &_miranda, NULL);
+ g_globals->_player.addMover(NULL);
+ setAction(&_sequenceManager1, this, 4015, &g_globals->_player, &_miranda, NULL);
}
}
}
@@ -1286,14 +1286,14 @@ void Scene4010::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerMText);
_speakerSText._npc = &_hotspot1;
_speakerMText._npc = &_hotspot2;
- _speakerQText._npc = &_globals->_player;
+ _speakerQText._npc = &g_globals->_player;
- _globals->_player.postInit();
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setPosition(Common::Point(-38, 175));
- _globals->_player.changeZoom(75);
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setPosition(Common::Point(-38, 175));
+ g_globals->_player.changeZoom(75);
_hotspot2.postInit();
_hotspot2.setVisage(2705);
@@ -1310,12 +1310,12 @@ void Scene4010::postInit(SceneObjectList *OwnerList) {
_hotspot1.animate(ANIM_MODE_1, NULL);
_hotspot1.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.disableControl();
- setAction(&_sequenceManager, this, 4017, &_globals->_player, &_hotspot1, &_hotspot2, NULL);
+ g_globals->_player.disableControl();
+ setAction(&_sequenceManager, this, 4017, &g_globals->_player, &_hotspot1, &_hotspot2, NULL);
}
void Scene4010::signal() {
- _globals->_sceneManager.changeScene(4000);
+ g_globals->_sceneManager.changeScene(4000);
}
/*--------------------------------------------------------------------------
@@ -1324,7 +1324,7 @@ void Scene4010::signal() {
*--------------------------------------------------------------------------*/
void Scene4025::Action1::signal() {
- Scene4025 *scene = (Scene4025 *)_globals->_sceneManager._scene;
+ Scene4025 *scene = (Scene4025 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -1364,15 +1364,15 @@ void Scene4025::Action1::signal() {
break;
case 2:
- _globals->_player._uiEnabled = true;
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_player._uiEnabled = true;
+ g_globals->_events.setCursor(CURSOR_USE);
remove();
break;
}
}
void Scene4025::Action2::signal() {
- Scene4025 *scene = (Scene4025 *)_globals->_sceneManager._scene;
+ Scene4025 *scene = (Scene4025 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -1408,8 +1408,8 @@ void Scene4025::Action2::signal() {
scene->_armHotspot.animate(ANIM_MODE_5, this);
break;
case 2:
- _globals->_player._uiEnabled = true;
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_player._uiEnabled = true;
+ g_globals->_events.setCursor(CURSOR_USE);
remove();
break;
}
@@ -1418,14 +1418,14 @@ void Scene4025::Action2::signal() {
void Scene4025::Action3::signal() {
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
- _globals->_scenePalette.addRotation(64, 111, -1);
+ g_globals->_player.disableControl();
+ g_globals->_scenePalette.addRotation(64, 111, -1);
setDelay(120);
break;
case 1:
- _globals->clearFlag(34);
- _globals->_stripNum = 4025;
- _globals->_sceneManager.changeScene(4000);
+ g_globals->clearFlag(34);
+ g_globals->_stripNum = 4025;
+ g_globals->_sceneManager.changeScene(4000);
break;
}
}
@@ -1441,7 +1441,7 @@ void Scene4025::Hole::synchronize(Serializer &s) {
}
void Scene4025::Hole::doAction(int action) {
- Scene4025 *scene = (Scene4025 *)_globals->_sceneManager._scene;
+ Scene4025 *scene = (Scene4025 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -1451,15 +1451,15 @@ void Scene4025::Hole::doAction(int action) {
if (!scene->_pegPtr && !_pegPtr) {
setAction(&scene->_sequenceManager, scene, 4028, NULL);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_holePtr = this;
scene->setAction(&scene->_action2);
}
break;
case OBJECT_PEG:
if (!scene->_pegPtr2) {
- _globals->_player.disableControl();
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_player.disableControl();
+ g_globals->_events.setCursor(CURSOR_USE);
RING_INVENTORY._peg._sceneNumber = 4025;
scene->_pegPtr = &scene->_peg5;
@@ -1483,14 +1483,14 @@ void Scene4025::Peg::synchronize(Serializer &s) {
}
void Scene4025::Peg::doAction(int action) {
- Scene4025 *scene = (Scene4025 *)_globals->_sceneManager._scene;
+ Scene4025 *scene = (Scene4025 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(4025, 1);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_pegPtr = this;
scene->setAction(&scene->_action1);
break;
@@ -1509,7 +1509,7 @@ void Scene4025::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(0, 100, 200, 100);
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
_pegPtr = _pegPtr2 = NULL;
_peg1.postInit();
@@ -1609,11 +1609,11 @@ void Scene4025::postInit(SceneObjectList *OwnerList) {
_armHotspot.setStrip(3);
_armHotspot.setFrame(4);
- _globals->_sceneItems.addItems(&_hole1, &_hole2, &_hole3, &_hole4, &_hole5,
+ g_globals->_sceneItems.addItems(&_hole1, &_hole2, &_hole3, &_hole4, &_hole5,
&_peg1, &_peg2, &_peg3, &_peg4, &_peg5, NULL);
- _globals->_player._uiEnabled = true;
- _globals->_player.disableControl();
+ g_globals->_player._uiEnabled = true;
+ g_globals->_player.disableControl();
setAction(&_sequenceManager, this, 4026, NULL);
}
@@ -1625,7 +1625,7 @@ void Scene4025::synchronize(Serializer &s) {
}
void Scene4025::remove() {
- _globals->_scenePalette.clearListeners();
+ g_globals->_scenePalette.clearListeners();
Scene::remove();
}
@@ -1638,10 +1638,10 @@ void Scene4025::signal() {
_gfxButton._bounds.expandPanes();
}
- _globals->_player._uiEnabled = true;
+ g_globals->_player._uiEnabled = true;
}
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
}
void Scene4025::process(Event &event) {
@@ -1651,7 +1651,7 @@ void Scene4025::process(Event &event) {
if (RING_INVENTORY._peg._sceneNumber == 4025)
RING_INVENTORY._peg._sceneNumber = 1;
- _globals->_sceneManager.changeScene(4000);
+ g_globals->_sceneManager.changeScene(4000);
}
}
@@ -1669,15 +1669,15 @@ void Scene4025::dispatch() {
*--------------------------------------------------------------------------*/
void Scene4045::Action1::signal() {
- Scene4045 *scene = (Scene4045 *)_globals->_sceneManager._scene;
+ Scene4045 *scene = (Scene4045 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(60);
break;
case 1:
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start(4040, this, scene);
break;
case 2:
@@ -1691,52 +1691,52 @@ void Scene4045::Action1::signal() {
scene->_hotspot4.animate(ANIM_MODE_6, this);
break;
case 5:
- ADD_MOVER(_globals->_player, 150, 300);
+ ADD_MOVER(g_globals->_player, 150, 300);
break;
case 6:
- _globals->_stripNum = 4000;
- _globals->_sceneManager.changeScene(4000);
+ g_globals->_stripNum = 4000;
+ g_globals->_sceneManager.changeScene(4000);
remove();
break;
}
}
void Scene4045::Action2::signal() {
- Scene4045 *scene = (Scene4045 *)_globals->_sceneManager._scene;
+ Scene4045 *scene = (Scene4045 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(15);
break;
case 1:
- scene->_stripManager.start(_globals->_stripNum, this, scene);
+ scene->_stripManager.start(g_globals->_stripNum, this, scene);
break;
case 2:
scene->_olloFace.animate(ANIM_MODE_NONE, NULL);
setDelay(10);
break;
case 3:
- if (_globals->getFlag(38)) {
- _globals->_player.enableControl();
+ if (g_globals->getFlag(38)) {
+ g_globals->_player.enableControl();
remove();
} else {
- ADD_MOVER(_globals->_player, 150, 300);
+ ADD_MOVER(g_globals->_player, 150, 300);
}
break;
case 4:
- _globals->setFlag(39);
- _globals->_sceneManager.changeScene(4000);
+ g_globals->setFlag(39);
+ g_globals->_sceneManager.changeScene(4000);
break;
}
}
void Scene4045::Action3::signal() {
- Scene4045 *scene = (Scene4045 *)_globals->_sceneManager._scene;
+ Scene4045 *scene = (Scene4045 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_hotspot4.animate(ANIM_MODE_5, this);
break;
case 1:
@@ -1745,10 +1745,10 @@ void Scene4045::Action3::signal() {
case 2:
scene->_hotspot4.animate(ANIM_MODE_6, NULL);
scene->_olloFace.animate(ANIM_MODE_NONE, NULL);
- ADD_MOVER(_globals->_player, 91, 1264);
+ ADD_MOVER(g_globals->_player, 91, 1264);
break;
case 3:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -1757,7 +1757,7 @@ void Scene4045::Action3::signal() {
/*--------------------------------------------------------------------------*/
void Scene4045::OlloStand::doAction(int action) {
- Scene4045 *scene = (Scene4045 *)_globals->_sceneManager._scene;
+ Scene4045 *scene = (Scene4045 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_STUNNER:
@@ -1774,20 +1774,20 @@ void Scene4045::OlloStand::doAction(int action) {
setStrip(6);
animate(ANIM_MODE_NONE, NULL);
}
- if (_globals->_player._position.y < 135) {
+ if (g_globals->_player._position.y < 135) {
scene->_sceneMode = 4046;
_numFrames = 10;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
- scene->setAction(&scene->_sequenceManager, this, 4046, &_globals->_player, this, NULL);
+ scene->setAction(&scene->_sequenceManager, this, 4046, &g_globals->_player, this, NULL);
} else {
- if (!_globals->getFlag(31)) {
- _globals->setFlag(31);
- _globals->_stripNum = 4080;
- } else if (!_globals->getFlag(38))
- _globals->_stripNum = 4060;
+ if (!g_globals->getFlag(31)) {
+ g_globals->setFlag(31);
+ g_globals->_stripNum = 4080;
+ } else if (!g_globals->getFlag(38))
+ g_globals->_stripNum = 4060;
else
- _globals->_stripNum = 4503;
+ g_globals->_stripNum = 4503;
scene->setAction(&scene->_action2);
}
@@ -1799,7 +1799,7 @@ void Scene4045::OlloStand::doAction(int action) {
}
void Scene4045::Miranda::doAction(int action) {
- Scene4045 *scene = (Scene4045 *)_globals->_sceneManager._scene;
+ Scene4045 *scene = (Scene4045 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -1807,7 +1807,7 @@ void Scene4045::Miranda::doAction(int action) {
break;
case CURSOR_TALK:
scene->_sceneMode = 4102;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_sequenceManager, scene, 4104, NULL);
break;
default:
@@ -1817,22 +1817,22 @@ void Scene4045::Miranda::doAction(int action) {
}
void Scene4045::Necklace::doAction(int action) {
- Scene4045 *scene = (Scene4045 *)_globals->_sceneManager._scene;
+ Scene4045 *scene = (Scene4045 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(4045, 17);
break;
case CURSOR_USE:
- if (_globals->_player._position.y < 135) {
+ if (g_globals->_player._position.y < 135) {
SceneItem::display2(4045, 16);
RING_INVENTORY._peg._sceneNumber = 1;
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
remove();
} else {
scene->_sceneMode = 4047;
- _globals->_player.disableControl();
- scene->setAction(&scene->_sequenceManager, scene, 4047, &_globals->_player, &scene->_olloStand, NULL);
+ g_globals->_player.disableControl();
+ scene->setAction(&scene->_sequenceManager, scene, 4047, &g_globals->_player, &scene->_olloStand, NULL);
}
break;
default:
@@ -1877,13 +1877,13 @@ void Scene4045::postInit(SceneObjectList *OwnerList) {
_flame.setPosition(Common::Point(47, 111));
_flame.animate(ANIM_MODE_2, NULL);
_flame.fixPriority(156);
- _globals->_sceneItems.push_back(&_flame);
+ g_globals->_sceneItems.push_back(&_flame);
- _globals->_player.postInit();
- _globals->_player.setVisage(4200);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player._moveDiff = Common::Point(7, 4);
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(4200);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player._moveDiff = Common::Point(7, 4);
_olloStand.postInit();
_olloStand.setVisage(4051);
@@ -1893,10 +1893,10 @@ void Scene4045::postInit(SceneObjectList *OwnerList) {
_olloFace.setStrip(4);
_olloFace.fixPriority(152);
- if(_globals->_sceneManager._previousScene == 4050) {
- _globals->_soundHandler.play(155);
- _globals->_player.setPosition(Common::Point(72, 128));
- _globals->_player.enableControl();
+ if(g_globals->_sceneManager._previousScene == 4050) {
+ g_globals->_soundHandler.play(155);
+ g_globals->_player.setPosition(Common::Point(72, 128));
+ g_globals->_player.enableControl();
_olloStand.setStrip(5);
_olloStand.setPosition(Common::Point(173, 99));
@@ -1910,13 +1910,13 @@ void Scene4045::postInit(SceneObjectList *OwnerList) {
_necklace.setVisage(4045);
_necklace.setStrip(2);
_necklace.setPosition(Common::Point(108, 82));
- _globals->_sceneItems.push_back(&_necklace);
+ g_globals->_sceneItems.push_back(&_necklace);
}
} else {
- _globals->_player.setPosition(Common::Point(108, 192));
- _globals->_player.setStrip(4);
+ g_globals->_player.setPosition(Common::Point(108, 192));
+ g_globals->_player.setStrip(4);
- if (!_globals->getFlag(36) && !_globals->getFlag(43)) {
+ if (!g_globals->getFlag(36) && !g_globals->getFlag(43)) {
_miranda.postInit();
_miranda.setVisage(4102);
_miranda.animate(ANIM_MODE_NONE, NULL);
@@ -1925,10 +1925,10 @@ void Scene4045::postInit(SceneObjectList *OwnerList) {
_miranda.changeZoom(-1);
_miranda.setPosition(Common::Point(66, 209));
- _globals->_sceneItems.push_back(&_miranda);
+ g_globals->_sceneItems.push_back(&_miranda);
}
- if (_globals->getFlag(31)) {
+ if (g_globals->getFlag(31)) {
// Olo asleep
_olloStand.setVisage(4051);
_olloStand.setStrip(5);
@@ -1943,7 +1943,7 @@ void Scene4045::postInit(SceneObjectList *OwnerList) {
_necklace.setVisage(4045);
_necklace.setStrip(2);
_necklace.setPosition(Common::Point(108, 82));
- _globals->_sceneItems.push_back(&_necklace);
+ g_globals->_sceneItems.push_back(&_necklace);
}
} else {
_olloStand.setPosition(Common::Point(186, 149));
@@ -1955,14 +1955,14 @@ void Scene4045::postInit(SceneObjectList *OwnerList) {
_hotspot4.setPosition(Common::Point(202, 80));
_olloFace.setPosition(Common::Point(192, 77));
- _globals->setFlag(31);
+ g_globals->setFlag(31);
setAction(&_action1);
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
}
}
- _globals->_sceneItems.addItems(&_olloStand, &_hotspot7, &_hotspot8, &_hotspot9, &_hotspot10,
+ g_globals->_sceneItems.addItems(&_olloStand, &_hotspot7, &_hotspot8, &_hotspot9, &_hotspot10,
&_hotspot13, &_hotspot11, &_hotspot12, &_hotspot14, NULL);
}
@@ -1984,34 +1984,34 @@ void Scene4045::signal() {
_olloFace.animate(ANIM_MODE_NONE, NULL);
break;
case 4050:
- _globals->_sceneManager.changeScene(4000);
+ g_globals->_sceneManager.changeScene(4000);
break;
case 4102:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
}
}
void Scene4045::dispatch() {
if (!_action) {
- if (_globals->_player.getRegionIndex() == 8) {
- _globals->_player.addMover(NULL);
+ if (g_globals->_player.getRegionIndex() == 8) {
+ g_globals->_player.addMover(NULL);
if (_olloStand._strip != 1) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 4046;
_olloStand._numFrames = 10;
- setAction(&_sequenceManager, this, 4046, &_globals->_player, &_olloStand, NULL);
+ setAction(&_sequenceManager, this, 4046, &g_globals->_player, &_olloStand, NULL);
} else {
setAction(&_action3);
}
}
- if (_globals->_player.getRegionIndex() == 10)
- _globals->_sceneManager.changeScene(4050);
- if (_globals->_player._position.y >= 196) {
+ if (g_globals->_player.getRegionIndex() == 10)
+ g_globals->_sceneManager.changeScene(4050);
+ if (g_globals->_player._position.y >= 196) {
_sceneMode = 4050;
- _globals->_player.disableControl();
- setAction(&_sequenceManager, this, 4105, &_globals->_player, NULL);
+ g_globals->_player.disableControl();
+ setAction(&_sequenceManager, this, 4105, &g_globals->_player, NULL);
}
}
@@ -2025,21 +2025,21 @@ void Scene4045::dispatch() {
void Scene4050::Action1::signal() {
// "Map" on the wall
- Scene4050 *scene = (Scene4050 *)_globals->_sceneManager._scene;
+ Scene4050 *scene = (Scene4050 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(3);
break;
case 1: {
Common::Point pt(204, 152);
PlayerMover *mover = new PlayerMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2:
- _globals->_player.checkAngle(&scene->_hotspot17);
+ g_globals->_player.checkAngle(&scene->_hotspot17);
scene->_hotspot14.postInit();
scene->_hotspot14.setVisage(4050);
@@ -2049,11 +2049,11 @@ void Scene4050::Action1::signal() {
setDelay(10);
break;
case 3:
- _globals->_events.waitForPress();
- _globals->setFlag(45);
+ g_globals->_events.waitForPress();
+ g_globals->setFlag(45);
scene->_hotspot14.remove();
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -2063,34 +2063,34 @@ void Scene4050::Action2::signal() {
// Climb down the rope
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(120);
break;
case 1:
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 2:
- _globals->_player.setVisage(4202);
- _globals->_player.changeZoom(100);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setPosition(Common::Point(192, 130));
+ g_globals->_player.setVisage(4202);
+ g_globals->_player.changeZoom(100);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setPosition(Common::Point(192, 130));
- ADD_MOVER(_globals->_player, 215, 130);
+ ADD_MOVER(g_globals->_player, 215, 130);
break;
case 3:
- _globals->_player.setVisage(4052);
- _globals->_player.setStrip(5);
- _globals->_player.setFrame(1);
- _globals->_player.setPosition(Common::Point(236, 130));
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(4052);
+ g_globals->_player.setStrip(5);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.setPosition(Common::Point(236, 130));
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 4:
- _globals->_player.setVisage(4202);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setPosition(Common::Point(210, 185));
- _globals->_player.fixPriority(-1);
- _globals->_player.enableControl();
+ g_globals->_player.setVisage(4202);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setPosition(Common::Point(210, 185));
+ g_globals->_player.fixPriority(-1);
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -2103,51 +2103,51 @@ void Scene4050::Action3::signal() {
ADD_PLAYER_MOVER(210, 185);
break;
case 1:
- _globals->_player.fixPriority(200);
- _globals->_player.setVisage(4052);
- _globals->_player.setStrip(5);
- _globals->_player.changeZoom(100);
- _globals->_player.setFrame(_globals->_player.getFrameCount());
- _globals->_player.setPosition(Common::Point(236, 130));
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_player.fixPriority(200);
+ g_globals->_player.setVisage(4052);
+ g_globals->_player.setStrip(5);
+ g_globals->_player.changeZoom(100);
+ g_globals->_player.setFrame(g_globals->_player.getFrameCount());
+ g_globals->_player.setPosition(Common::Point(236, 130));
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 2:
- _globals->_player.setVisage(4202);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setPosition(Common::Point(215, 130));
- ADD_MOVER(_globals->_player, 212, 130);
+ g_globals->_player.setVisage(4202);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setPosition(Common::Point(215, 130));
+ ADD_MOVER(g_globals->_player, 212, 130);
break;
case 3:
- _globals->_stripNum = 4050;
- _globals->_sceneManager.changeScene(4000);
+ g_globals->_stripNum = 4050;
+ g_globals->_sceneManager.changeScene(4000);
break;
}
}
void Scene4050::Action4::signal() {
- Scene4050 *scene = (Scene4050 *)_globals->_sceneManager._scene;
+ Scene4050 *scene = (Scene4050 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
- ADD_MOVER(_globals->_player, 189, 135);
- _globals->_player.fixPriority(200);
+ g_globals->_player.disableControl();
+ ADD_MOVER(g_globals->_player, 189, 135);
+ g_globals->_player.fixPriority(200);
break;
case 1:
- _globals->_player._moveDiff.y = 3;
- _globals->_player.setStrip2(3);
- _globals->_player._frame = 1;
- _globals->_player.setPosition(Common::Point(189, 129));
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player._moveDiff.y = 3;
+ g_globals->_player.setStrip2(3);
+ g_globals->_player._frame = 1;
+ g_globals->_player.setPosition(Common::Point(189, 129));
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 2:
- _globals->_player.setVisage(4202);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setPosition(Common::Point(192, 130));
- _globals->_player.changeZoom(100);
- ADD_MOVER(_globals->_player, 215, 130);
+ g_globals->_player.setVisage(4202);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setPosition(Common::Point(192, 130));
+ g_globals->_player.changeZoom(100);
+ ADD_MOVER(g_globals->_player, 215, 130);
scene->_hotspot16.postInit();
scene->_hotspot16.setVisage(4052);
@@ -2157,18 +2157,18 @@ void Scene4050::Action4::signal() {
ADD_MOVER(scene->_hotspot16, 172, 188);
break;
case 3:
- _globals->_player.setVisage(4052);
- _globals->_player.setStrip(5);
- _globals->_player.setFrame(1);
- _globals->_player.setPosition(Common::Point(238, 130));
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(4052);
+ g_globals->_player.setStrip(5);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.setPosition(Common::Point(238, 130));
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 4:
- _globals->_player.setVisage(4052);
- _globals->_player.setStrip(2);
- _globals->_player.setFrame(1);
- _globals->_player.setPosition(Common::Point(216, 184));
- _globals->_player.fixPriority(-1);
+ g_globals->_player.setVisage(4052);
+ g_globals->_player.setStrip(2);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.setPosition(Common::Point(216, 184));
+ g_globals->_player.fixPriority(-1);
break;
case 5:
scene->_hotspot16.setStrip2(4);
@@ -2177,12 +2177,12 @@ void Scene4050::Action4::signal() {
break;
case 6:
scene->_hotspot16.animate(ANIM_MODE_5, NULL);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 7:
- _globals->_player.setVisage(4202);
- _globals->_player.setStrip(6);
- _globals->_player.setFrame(1);
+ g_globals->_player.setVisage(4202);
+ g_globals->_player.setStrip(6);
+ g_globals->_player.setFrame(1);
scene->_stripManager.start(4051, this);
break;
@@ -2190,7 +2190,7 @@ void Scene4050::Action4::signal() {
setDelay(15);
break;
case 9:
- _globals->_sceneManager.changeScene(4000);
+ g_globals->_sceneManager.changeScene(4000);
break;
}
}
@@ -2198,14 +2198,14 @@ void Scene4050::Action4::signal() {
/*--------------------------------------------------------------------------*/
void Scene4050::Hotspot15::doAction(int action) {
- Scene4050 *scene = (Scene4050 *)_globals->_sceneManager._scene;
+ Scene4050 *scene = (Scene4050 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(4050, 14);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setAction(&scene->_action3);
break;
default:
@@ -2215,7 +2215,7 @@ void Scene4050::Hotspot15::doAction(int action) {
}
void Scene4050::Hotspot17::doAction(int action) {
- Scene4050 *scene = (Scene4050 *)_globals->_sceneManager._scene;
+ Scene4050 *scene = (Scene4050 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -2257,50 +2257,50 @@ void Scene4050::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerQText);
_stripManager.addSpeaker(&_speakerGameText);
- _globals->_player.postInit();
+ g_globals->_player.postInit();
- switch (_globals->_sceneManager._previousScene) {
+ switch (g_globals->_sceneManager._previousScene) {
case 4000:
- if (_globals->getFlag(41)) {
+ if (g_globals->getFlag(41)) {
// Using a rope
_hotspot15.postInit();
_hotspot15.setVisage(4054);
_hotspot15.setPosition(Common::Point(206, 103));
- _globals->_sceneItems.push_back(&_hotspot15);
+ g_globals->_sceneItems.push_back(&_hotspot15);
- _globals->_player.setVisage(4008);
- _globals->_player.setPosition(Common::Point(206, 62));
- _globals->_player.changeZoom(130);
- _globals->_player.fixPriority(200);
- _globals->_player.setStrip(2);
+ g_globals->_player.setVisage(4008);
+ g_globals->_player.setPosition(Common::Point(206, 62));
+ g_globals->_player.changeZoom(130);
+ g_globals->_player.fixPriority(200);
+ g_globals->_player.setStrip(2);
setAction(&_action2);
- _globals->_soundHandler.play(175);
+ g_globals->_soundHandler.play(175);
} else {
// Without the rope
- _globals->_player.setVisage(5315);
- _globals->_player.setPosition(Common::Point(189, 83));
- _globals->_player.changeZoom(130);
- _globals->_player.setStrip2(2);
- _globals->_player._moveDiff.y = 10;
- _globals->_player.animate(ANIM_MODE_2, NULL);
+ g_globals->_player.setVisage(5315);
+ g_globals->_player.setPosition(Common::Point(189, 83));
+ g_globals->_player.changeZoom(130);
+ g_globals->_player.setStrip2(2);
+ g_globals->_player._moveDiff.y = 10;
+ g_globals->_player.animate(ANIM_MODE_2, NULL);
setAction(&_action4);
- _globals->_soundHandler.play(176);
+ g_globals->_soundHandler.play(176);
}
break;
case 4045:
_hotspot15.postInit();
_hotspot15.setVisage(4054);
_hotspot15.setPosition(Common::Point(206, 103));
- _globals->_sceneItems.push_back(&_hotspot15);
+ g_globals->_sceneItems.push_back(&_hotspot15);
- _globals->_player.setVisage(4202);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setPosition(Common::Point(193, 193));
+ g_globals->_player.setVisage(4202);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setPosition(Common::Point(193, 193));
- _globals->_soundHandler.play(175);
+ g_globals->_soundHandler.play(175);
break;
default:
break;
@@ -2329,25 +2329,25 @@ void Scene4050::postInit(SceneObjectList *OwnerList) {
_hotspot11.setBounds(Rect(263, 105, 279, 147));
_hotspot12.setBounds(Rect(258, 154, 307, 180));
- _globals->_sceneItems.addItems(&_hotspot17, &_hotspot12, &_hotspot11, &_hotspot10, &_hotspot13,
+ g_globals->_sceneItems.addItems(&_hotspot17, &_hotspot12, &_hotspot11, &_hotspot10, &_hotspot13,
&_hotspot2, &_hotspot3, &_hotspot4, &_hotspot5, &_hotspot6, &_hotspot8, &_hotspot9,
&_hotspot7, &_hotspot1, NULL);
}
void Scene4050::signal() {
if (_sceneMode == 4050)
- _globals->_sceneManager.changeScene(4045);
+ g_globals->_sceneManager.changeScene(4045);
}
void Scene4050::dispatch() {
if (!_action) {
- if ((_globals->_player._canWalk) && (_globals->_player._position.y > 196)) {
+ if ((g_globals->_player._canWalk) && (g_globals->_player._position.y > 196)) {
_sceneMode = 4050;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
Common::Point pt(160, 275);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
}
}
Scene::dispatch();
@@ -2359,28 +2359,28 @@ void Scene4050::dispatch() {
*--------------------------------------------------------------------------*/
void Scene4100::Action1::signal() {
- Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
+ Scene4100 *scene = (Scene4100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(10);
break;
case 1:
- scene->_stripManager.start(_globals->_stripNum, this);
+ scene->_stripManager.start(g_globals->_stripNum, this);
break;
case 2:
setDelay(30);
break;
case 3:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene4100::Action2::signal() {
- Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
+ Scene4100 *scene = (Scene4100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -2411,12 +2411,12 @@ void Scene4100::Action2::signal() {
void Scene4100::Action3::signal() {
- Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
+ Scene4100 *scene = (Scene4100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->clearFlag(43);
- _globals->setFlag(36);
+ g_globals->clearFlag(43);
+ g_globals->setFlag(36);
setDelay(15);
break;
case 1:
@@ -2432,7 +2432,7 @@ void Scene4100::Action3::signal() {
setDelay(15);
break;
case 5:
- _globals->_sceneManager.changeScene(4150);
+ g_globals->_sceneManager.changeScene(4150);
break;
default:
break;
@@ -2441,7 +2441,7 @@ void Scene4100::Action3::signal() {
void Scene4100::Action4::signal() {
// Rock getting drunk
- Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
+ Scene4100 *scene = (Scene4100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -2456,26 +2456,26 @@ void Scene4100::Action4::signal() {
scene->_hotspot1.animate(ANIM_MODE_5, this);
break;
case 3:
- _globals->clearFlag(43);
- _globals->setFlag(42);
+ g_globals->clearFlag(43);
+ g_globals->setFlag(42);
scene->_stripManager.start(4119, this);
break;
case 4:
setDelay(15);
break;
case 5:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene4100::Action5::signal() {
- Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
+ Scene4100 *scene = (Scene4100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
ADD_PLAYER_MOVER(58, 151);
break;
case 1:
@@ -2488,10 +2488,10 @@ void Scene4100::Action5::signal() {
scene->_ladder.setPosition(Common::Point(49, 144));
RING_INVENTORY._ladder._sceneNumber = 4100;
- _globals->_sceneItems.push_front(&scene->_ladder);
+ g_globals->_sceneItems.push_front(&scene->_ladder);
}
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -2499,16 +2499,16 @@ void Scene4100::Action5::signal() {
void Scene4100::Action6::signal() {
- Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
+ Scene4100 *scene = (Scene4100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_stripManager.start(4103, this);
ADD_PLAYER_MOVER(245, 167);
break;
case 1:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -2517,39 +2517,39 @@ void Scene4100::Action6::signal() {
/*--------------------------------------------------------------------------*/
void Scene4100::Hotspot1::doAction(int action) {
- Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
+ Scene4100 *scene = (Scene4100 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_STUNNER:
SceneItem::display2(4100, 16);
break;
case OBJECT_ALE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action3);
break;
case CURSOR_LOOK:
- SceneItem::display2(4100, _globals->getFlag(42) ? 24 : 12);
+ SceneItem::display2(4100, g_globals->getFlag(42) ? 24 : 12);
break;
case CURSOR_USE:
SceneItem::display2(4100, 22);
break;
case CURSOR_TALK:
if (RING_INVENTORY._peg._sceneNumber == 1) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 4109;
scene->setAction(&scene->_sequenceManager, scene, 4109, NULL);
- } else if (_globals->getFlag(42)) {
+ } else if (g_globals->getFlag(42)) {
scene->_sceneMode = 4102;
scene->setAction(&scene->_sequenceManager, scene, 4102, NULL);
} else {
- if (_globals->getFlag(33))
- _globals->_stripNum = 4077;
- else if (_globals->getFlag(82)) {
- _globals->clearFlag(82);
- _globals->_stripNum = 4100;
+ if (g_globals->getFlag(33))
+ g_globals->_stripNum = 4077;
+ else if (g_globals->getFlag(82)) {
+ g_globals->clearFlag(82);
+ g_globals->_stripNum = 4100;
} else {
- _globals->_stripNum = 4075;
- _globals->setFlag(33);
+ g_globals->_stripNum = 4075;
+ g_globals->setFlag(33);
}
scene->setAction(&scene->_action1);
@@ -2573,7 +2573,7 @@ void Scene4100::Hotspot2::doAction(int action) {
}
void Scene4100::Miranda::doAction(int action) {
- Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
+ Scene4100 *scene = (Scene4100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -2590,15 +2590,15 @@ void Scene4100::Miranda::doAction(int action) {
}
void Scene4100::Ladder::doAction(int action) {
- Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
+ Scene4100 *scene = (Scene4100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(4100, 2);
break;
case CURSOR_USE:
- if (_globals->getFlag(42)) {
- _globals->_player.disableControl();
+ if (g_globals->getFlag(42)) {
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action5);
} else {
scene->_sceneMode = 4102;
@@ -2615,14 +2615,14 @@ void Scene4100::Ladder::doAction(int action) {
Exit hotspot, South
*/
void Scene4100::Hotspot14::doAction(int action) {
- Scene4100 *scene = (Scene4100 *)_globals->_sceneManager._scene;
+ Scene4100 *scene = (Scene4100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(4100, 0);
break;
case OBJECT_LADDER:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action5);
break;
default:
@@ -2659,13 +2659,13 @@ void Scene4100::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerML);
_stripManager.addSpeaker(&_speakerQR);
- _globals->_player.postInit();
- _globals->_player.setVisage(4200);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setStrip(4);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setPosition(Common::Point(88, 180));
- _globals->_player._moveDiff = Common::Point(7, 4);
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(4200);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setStrip(4);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setPosition(Common::Point(88, 180));
+ g_globals->_player._moveDiff = Common::Point(7, 4);
_hotspot1.postInit();
_hotspot1.setVisage(4102);
@@ -2684,18 +2684,18 @@ void Scene4100::postInit(SceneObjectList *OwnerList) {
_hotspot4.setStrip2(2);
_hotspot4.setPosition(Common::Point(152, 167));
- if (_globals->getFlag(36)) {
+ if (g_globals->getFlag(36)) {
_hotspot1.setVisage(4105);
_hotspot1.setStrip(1);
_hotspot1.setFrame(4);
- } else if (!_globals->getFlag(43)) {
+ } else if (!g_globals->getFlag(43)) {
_miranda.postInit();
_miranda.setVisage(4102);
_miranda.setStrip2(3);
_miranda.setFrame(2);
_miranda.setPosition(Common::Point(65, 188));
- _globals->_sceneItems.push_back(&_miranda);
+ g_globals->_sceneItems.push_back(&_miranda);
}
if (RING_INVENTORY._ladder._sceneNumber == 4100) {
@@ -2703,7 +2703,7 @@ void Scene4100::postInit(SceneObjectList *OwnerList) {
_ladder.setVisage(4101);
_ladder.setPosition(Common::Point(49, 144));
- _globals->_sceneItems.push_back(&_ladder);
+ g_globals->_sceneItems.push_back(&_ladder);
}
_hotspot14.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
@@ -2715,41 +2715,41 @@ void Scene4100::postInit(SceneObjectList *OwnerList) {
_hotspot12.setBounds(Rect(229, 59, 256, 122));
_hotspot13.setBounds(Rect(255, 152, 286, 183));
- _globals->_sceneItems.addItems(&_hotspot3, &_hotspot1, &_hotspot13, &_hotspot12, &_hotspot4,
+ g_globals->_sceneItems.addItems(&_hotspot3, &_hotspot1, &_hotspot13, &_hotspot12, &_hotspot4,
&_hotspot11, &_hotspot9, &_hotspot7, &_hotspot10, &_hotspot8, &_hotspot14, NULL);
- if (_globals->_sceneManager._previousScene == 4150) {
- _globals->_soundHandler.play(155);
+ if (g_globals->_sceneManager._previousScene == 4150) {
+ g_globals->_soundHandler.play(155);
- if (!_globals->getFlag(42)) {
+ if (!g_globals->getFlag(42)) {
_hotspot1.setVisage(4104);
_hotspot1.setPosition(Common::Point(152, 118));
_hotspot1.setStrip2(-1);
_hotspot1.setFrame2(-1);
_hotspot1.setFrame(1);
- _globals->_player.setStrip(2);
- _globals->_player.disableControl();
+ g_globals->_player.setStrip(2);
+ g_globals->_player.disableControl();
setAction(&_action4);
- _globals->clearFlag(43);
+ g_globals->clearFlag(43);
} else {
// Workaround: In the original, the mouse is hidden when Quinn
// goes back to scene 4150 then to scene 4100. This enables everything.
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
}
- _globals->_player.setPosition(Common::Point(252, 139));
- _globals->_player.setStrip(2);
+ g_globals->_player.setPosition(Common::Point(252, 139));
+ g_globals->_player.setStrip(2);
} else {
- if ((RING_INVENTORY._ale._sceneNumber == 4100) && !_globals->getFlag(42)) {
- _globals->_player.disableControl();
+ if ((RING_INVENTORY._ale._sceneNumber == 4100) && !g_globals->getFlag(42)) {
+ g_globals->_player.disableControl();
setAction(&_action3);
}
- if (_globals->getFlag(35)) {
- _globals->_player.disableControl();
+ if (g_globals->getFlag(35)) {
+ g_globals->_player.disableControl();
_sceneMode = 4101;
- setAction(&_sequenceManager, this, 4101, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 4101, &g_globals->_player, NULL);
}
}
}
@@ -2757,28 +2757,28 @@ void Scene4100::postInit(SceneObjectList *OwnerList) {
void Scene4100::signal() {
switch (_sceneMode) {
case 4101:
- _globals->_sceneManager.changeScene(4000);
+ g_globals->_sceneManager.changeScene(4000);
break;
case 4102:
case 4103:
case 4109:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
}
}
void Scene4100::dispatch() {
if (!_action) {
- if ((_globals->_player.getRegionIndex() == 15) && !_globals->getFlag(42))
+ if ((g_globals->_player.getRegionIndex() == 15) && !g_globals->getFlag(42))
setAction(&_action6);
- if (_globals->_player.getRegionIndex() == 8)
- _globals->_sceneManager.changeScene(4150);
+ if (g_globals->_player.getRegionIndex() == 8)
+ g_globals->_sceneManager.changeScene(4150);
- if (_globals->_player._position.y >= 196) {
- _globals->_player.disableControl();
+ if (g_globals->_player._position.y >= 196) {
+ g_globals->_player.disableControl();
_sceneMode = 4101;
- setAction(&_sequenceManager, this, 4105, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 4105, &g_globals->_player, NULL);
}
}
@@ -2791,7 +2791,7 @@ void Scene4100::dispatch() {
*--------------------------------------------------------------------------*/
void Scene4150::Action1::signal() {
- Scene4150 *scene = (Scene4150 *)_globals->_sceneManager._scene;
+ Scene4150 *scene = (Scene4150 *)g_globals->_sceneManager._scene;
byte adjustData[4] = {0, 0, 0, 0};
switch (_actionIndex++) {
@@ -2809,7 +2809,7 @@ void Scene4150::Action1::signal() {
break;
case 4: {
for (int idx = 100; idx >= 0; idx -= 5) {
- _globals->_scenePalette.fade(adjustData, false, idx);
+ g_globals->_scenePalette.fade(adjustData, false, idx);
g_system->updateScreen();
g_system->delayMillis(10);
}
@@ -2828,8 +2828,8 @@ void Scene4150::Action1::signal() {
break;
}
case 5:
- _globals->_scenePalette.loadPalette(4150);
- _globals->_scenePalette.refresh();
+ g_globals->_scenePalette.loadPalette(4150);
+ g_globals->_scenePalette.refresh();
setDelay(60);
break;
case 6:
@@ -2837,7 +2837,7 @@ void Scene4150::Action1::signal() {
break;
case 7:
for (int idx = 100; idx >= 0; idx -= 5) {
- _globals->_scenePalette.fade(adjustData, false, idx);
+ g_globals->_scenePalette.fade(adjustData, false, idx);
g_system->updateScreen();
g_system->delayMillis(10);
}
@@ -2849,28 +2849,28 @@ void Scene4150::Action1::signal() {
scene->_hotspot1.setFrame(1);
scene->_hotspot1.show();
- _globals->_player.setVisage(4200);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setStrip(3);
- _globals->_player.setPosition(Common::Point(139, 166));
- _globals->_player._moveDiff = Common::Point(7, 3);
- _globals->_player.show();
+ g_globals->_player.setVisage(4200);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setStrip(3);
+ g_globals->_player.setPosition(Common::Point(139, 166));
+ g_globals->_player._moveDiff = Common::Point(7, 3);
+ g_globals->_player.show();
setDelay(120);
break;
case 8:
- _globals->_scenePalette.loadPalette(4150);
- _globals->_scenePalette.refresh();
+ g_globals->_scenePalette.loadPalette(4150);
+ g_globals->_scenePalette.refresh();
setDelay(30);
break;
case 9:
scene->_stripManager.start(4523, this);
break;
case 10:
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player._moveDiff = Common::Point(7, 4);
- _globals->_player.setStrip(3);
- _globals->_player.enableControl();
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player._moveDiff = Common::Point(7, 4);
+ g_globals->_player.setStrip(3);
+ g_globals->_player.enableControl();
remove();
break;
@@ -2878,7 +2878,7 @@ void Scene4150::Action1::signal() {
}
void Scene4150::Action2::signal() {
- Scene4150 *scene = (Scene4150 *)_globals->_sceneManager._scene;
+ Scene4150 *scene = (Scene4150 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -2890,10 +2890,10 @@ void Scene4150::Action2::signal() {
scene->_hotspot1.setFrame(1);
scene->_hotspot1.animate(ANIM_MODE_5, this);
- _globals->_player.animate(ANIM_MODE_5, NULL);
+ g_globals->_player.animate(ANIM_MODE_5, NULL);
break;
case 2:
- _globals->_player.hide();
+ g_globals->_player.hide();
scene->_hotspot1.setVisage(4153);
scene->_hotspot1.setStrip(1);
scene->_hotspot1.setFrame(1);
@@ -2906,15 +2906,15 @@ void Scene4150::Action2::signal() {
}
void Scene4150::Action3::signal() {
- Scene4150 *scene = (Scene4150 *)_globals->_sceneManager._scene;
+ Scene4150 *scene = (Scene4150 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(15);
break;
case 1:
- _globals->_player.checkAngle(&scene->_hotspot3);
+ g_globals->_player.checkAngle(&scene->_hotspot3);
if (RING_INVENTORY._rope._sceneNumber == 1) {
scene->_hotspot3.postInit();
@@ -2922,13 +2922,13 @@ void Scene4150::Action3::signal() {
scene->_hotspot3.setPosition(Common::Point(175, 70));
RING_INVENTORY._rope._sceneNumber = 4150;
- _globals->_sceneItems.push_front(&scene->_hotspot3);
+ g_globals->_sceneItems.push_front(&scene->_hotspot3);
} else {
RING_INVENTORY._rope._sceneNumber = 1;
scene->_hotspot3.remove();
}
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -2937,7 +2937,7 @@ void Scene4150::Action3::signal() {
/*--------------------------------------------------------------------------*/
void Scene4150::HotspotGroup1::doAction(int action) {
- Scene4150 *scene = (Scene4150 *)_globals->_sceneManager._scene;
+ Scene4150 *scene = (Scene4150 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -2952,8 +2952,8 @@ void Scene4150::HotspotGroup1::doAction(int action) {
void Scene4150::HotspotGroup3::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- SceneItem::display2(4150, _globals->getFlag(46) ? 9 : 8);
- _globals->setFlag(46);
+ SceneItem::display2(4150, g_globals->getFlag(46) ? 9 : 8);
+ g_globals->setFlag(46);
break;
case CURSOR_USE:
SceneItem::display2(4150, 30);
@@ -2964,8 +2964,8 @@ void Scene4150::HotspotGroup3::doAction(int action) {
void Scene4150::HotspotGroup6::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- SceneItem::display2(4150, _globals->getFlag(47) ? 16 : 15);
- _globals->setFlag(47);
+ SceneItem::display2(4150, g_globals->getFlag(47) ? 16 : 15);
+ g_globals->setFlag(47);
break;
case CURSOR_USE:
SceneItem::display2(4150, 31);
@@ -2974,7 +2974,7 @@ void Scene4150::HotspotGroup6::doAction(int action) {
}
void Scene4150::Hotspot3::doAction(int action) {
- Scene4150 *scene = (Scene4150 *)_globals->_sceneManager._scene;
+ Scene4150 *scene = (Scene4150 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -3031,31 +3031,31 @@ void Scene4150::postInit(SceneObjectList *OwnerList) {
_hotspot1.postInit();
_hotspot1.setPosition(Common::Point(177, 201));
- if (_globals->getFlag(44)) {
- _globals->_player.postInit();
- _globals->_player.setVisage(4200);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setStrip(2);
- _globals->_player.setPosition(Common::Point(328, 160));
- _globals->_player._moveDiff = Common::Point(7, 4);
- _globals->_player.disableControl();
+ if (g_globals->getFlag(44)) {
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(4200);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setStrip(2);
+ g_globals->_player.setPosition(Common::Point(328, 160));
+ g_globals->_player._moveDiff = Common::Point(7, 4);
+ g_globals->_player.disableControl();
_sceneMode = 4151;
- setAction(&_sequenceManager, this, 4151, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 4151, &g_globals->_player, NULL);
_hotspot1.setVisage(4157);
_hotspot1.setPosition(Common::Point(177, 201));
} else {
- _globals->_player.postInit();
- _globals->_player.setVisage(4154);
- _globals->_player._canWalk = false;
- _globals->_player.setPosition(Common::Point(198, 202));
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(4154);
+ g_globals->_player._canWalk = false;
+ g_globals->_player.setPosition(Common::Point(198, 202));
+ g_globals->_player.disableControl();
_hotspot1.setVisage(4152);
setAction(&_action1);
- _globals->setFlag(44);
+ g_globals->setFlag(44);
}
if (RING_INVENTORY._rope._sceneNumber == 4150) {
@@ -3063,10 +3063,10 @@ void Scene4150::postInit(SceneObjectList *OwnerList) {
_hotspot3.setVisage(4150);
_hotspot3.setPosition(Common::Point(175, 70));
- _globals->_sceneItems.push_back(&_hotspot3);
+ g_globals->_sceneItems.push_back(&_hotspot3);
}
- _globals->_sceneItems.push_back(&_hotspot1);
+ g_globals->_sceneItems.push_back(&_hotspot1);
_hotspot5.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
_hotspot6.setBounds(Rect(28, 121, 80, 148));
@@ -3091,32 +3091,32 @@ void Scene4150::postInit(SceneObjectList *OwnerList) {
_hotspot25.setBounds(Rect(183, 155, 316, 190));
_hotspot26.setBounds(Rect(98, 169, 238, 198));
- _globals->_sceneItems.addItems(&_hotspot24, &_hotspot23, &_hotspot13, &_hotspot25,
+ g_globals->_sceneItems.addItems(&_hotspot24, &_hotspot23, &_hotspot13, &_hotspot25,
&_hotspot26, &_hotspot19, &_hotspot22, &_hotspot20, &_hotspot17, &_hotspot16,
&_hotspot15, &_hotspot11, &_hotspot14, &_hotspot18, &_hotspot21, &_hotspot12,
&_hotspot10, &_hotspot9, &_hotspot8, &_hotspot7, &_hotspot6, &_hotspot2,
&_hotspot5, NULL);
- _globals->_soundHandler.play(165);
+ g_globals->_soundHandler.play(165);
_soundHandler.play(311);
}
void Scene4150::signal() {
if (_sceneMode == 4151)
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
else if (_sceneMode == 4152)
- _globals->_sceneManager.changeScene(4100);
+ g_globals->_sceneManager.changeScene(4100);
}
void Scene4150::dispatch() {
Scene::dispatch();
- if (!_action && (_globals->_player._position.x >= 316)) {
- _globals->_soundHandler.fadeOut(NULL);
+ if (!_action && (g_globals->_player._position.x >= 316)) {
+ g_globals->_soundHandler.fadeOut(NULL);
_soundHandler.fadeOut(NULL);
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 4152;
- setAction(&_sequenceManager, this, 4152, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 4152, &g_globals->_player, NULL);
}
}
@@ -3126,15 +3126,15 @@ void Scene4150::dispatch() {
*--------------------------------------------------------------------------*/
void Scene4250::Action1::signal() {
- Scene4250 *scene = (Scene4250 *)_globals->_sceneManager._scene;
+ Scene4250 *scene = (Scene4250 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(3);
break;
case 1:
- ADD_MOVER_NULL(_globals->_player, 6, 190);
+ ADD_MOVER_NULL(g_globals->_player, 6, 190);
ADD_MOVER_NULL(scene->_hotspot3, 9, 195);
ADD_MOVER(scene->_hotspot1, 12, 185);
break;
@@ -3157,44 +3157,44 @@ void Scene4250::Action1::signal() {
scene->_stripManager.start(4470, this);
break;
case 8:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene4250::Action2::signal() {
- Scene4250 *scene = (Scene4250 *)_globals->_sceneManager._scene;
+ Scene4250 *scene = (Scene4250 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
ADD_PLAYER_MOVER(247, 182);
break;
case 1:
- _globals->_player.setVisage(2670);
- _globals->_player.changeZoom(50);
- _globals->_player.setStrip(3);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(2670);
+ g_globals->_player.changeZoom(50);
+ g_globals->_player.setStrip(3);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 2:
- if ((_globals->_stripNum == 9000) || (_globals->_stripNum == 4300)) {
+ if ((g_globals->_stripNum == 9000) || (g_globals->_stripNum == 4300)) {
scene->_stripManager.start(4205, this);
} else {
scene->_stripManager.start(4490, this);
}
break;
case 3:
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 4:
- _globals->_player.setVisage(2602);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.changeZoom(70);
+ g_globals->_player.setVisage(2602);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.changeZoom(70);
- if ((_globals->_stripNum == 9000) || (_globals->_stripNum == 4300)) {
- _globals->_player.enableControl();
+ if ((g_globals->_stripNum == 9000) || (g_globals->_stripNum == 4300)) {
+ g_globals->_player.enableControl();
remove();
} else {
ADD_PLAYER_MOVER(6, 180);
@@ -3208,19 +3208,19 @@ void Scene4250::Action2::signal() {
ADD_MOVER_NULL(scene->_hotspot5, -30, 195);
break;
case 6:
- _globals->clearFlag(59);
- _globals->clearFlag(70);
- _globals->clearFlag(37);
- _globals->clearFlag(114);
- _globals->clearFlag(36);
- _globals->clearFlag(43);
- _globals->_sceneManager.changeScene(2100);
+ g_globals->clearFlag(59);
+ g_globals->clearFlag(70);
+ g_globals->clearFlag(37);
+ g_globals->clearFlag(114);
+ g_globals->clearFlag(36);
+ g_globals->clearFlag(43);
+ g_globals->_sceneManager.changeScene(2100);
break;
}
}
void Scene4250::Action3::signal() {
- Scene4250 *scene = (Scene4250 *)_globals->_sceneManager._scene;
+ Scene4250 *scene = (Scene4250 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -3230,46 +3230,46 @@ void Scene4250::Action3::signal() {
scene->_stripManager.start(4480, this);
break;
case 2:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene4250::Action4::signal() {
- Scene4250 *scene = (Scene4250 *)_globals->_sceneManager._scene;
+ Scene4250 *scene = (Scene4250 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(3);
break;
case 1:
- _globals->_player.addMover(NULL);
+ g_globals->_player.addMover(NULL);
scene->_stripManager.start((RING_INVENTORY._helmet._sceneNumber == 4250) ? 4259 : 4256, this);
break;
case 2:
- ADD_PLAYER_MOVER(_globals->_player._position.x + 5, _globals->_player._position.y);
+ ADD_PLAYER_MOVER(g_globals->_player._position.x + 5, g_globals->_player._position.y);
break;
case 3:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene4250::Action5::signal() {
- Scene4250 *scene = (Scene4250 *)_globals->_sceneManager._scene;
+ Scene4250 *scene = (Scene4250 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(3);
break;
case 1:
scene->_hotspot4.fixPriority(195);
scene->_hotspot1.fixPriority(105);
- ADD_MOVER_NULL(_globals->_player, 6, 185);
+ ADD_MOVER_NULL(g_globals->_player, 6, 185);
ADD_MOVER_NULL(scene->_hotspot4, 9, 190);
ADD_MOVER(scene->_hotspot1, 12, 180);
break;
@@ -3282,7 +3282,7 @@ void Scene4250::Action5::signal() {
scene->_hotspot4.fixPriority(-1);
scene->_hotspot1.setStrip(5);
scene->_hotspot4.setStrip(7);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -3291,15 +3291,15 @@ void Scene4250::Action5::signal() {
/*--------------------------------------------------------------------------*/
void Scene4250::Hotspot1::doAction(int action) {
- Scene4250 *scene = (Scene4250 *)_globals->_sceneManager._scene;
+ Scene4250 *scene = (Scene4250 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 19 : 14);
break;
case CURSOR_TALK:
- _globals->_player.disableControl();
- if (!_globals->_sceneObjects->contains(&scene->_hotspot4)) {
+ g_globals->_player.disableControl();
+ if (!g_globals->_sceneObjects->contains(&scene->_hotspot4)) {
scene->setAction(&scene->_action3);
} else {
scene->_sceneMode = 4260;
@@ -3308,7 +3308,7 @@ void Scene4250::Hotspot1::doAction(int action) {
scene->setAction(&scene->_sequenceManager, scene, 4265, this, NULL);
} else {
scene->setAction(&scene->_sequenceManager, scene,
- _globals->_sceneObjects->contains(&scene->_hotspot6) ? 4260 : 4262, this, NULL);
+ g_globals->_sceneObjects->contains(&scene->_hotspot6) ? 4260 : 4262, this, NULL);
}
}
break;
@@ -3332,7 +3332,7 @@ void Scene4250::Hotspot1::doAction(int action) {
void Scene4250::Hotspot2::doAction(int action) {
//Ship with stasis field
- Scene4250 *scene = (Scene4250 *)_globals->_sceneManager._scene;
+ Scene4250 *scene = (Scene4250 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -3340,19 +3340,19 @@ void Scene4250::Hotspot2::doAction(int action) {
SceneItem::display2(4250, 16);
break;
case OBJECT_SCANNER:
- if ((_globals->_stripNum == 9000) || (_globals->_stripNum == 4300))
+ if ((g_globals->_stripNum == 9000) || (g_globals->_stripNum == 4300))
scene->setAction(&scene->_action2);
- else if (_globals->getFlag(55))
+ else if (g_globals->getFlag(55))
SceneItem::display2(4250, 17);
else {
- _globals->setFlag(55);
+ g_globals->setFlag(55);
scene->setAction(&scene->_action2);
}
break;
case OBJECT_STASIS_NEGATOR:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 4252;
- scene->setAction(&scene->_sequenceManager, scene, 4252, &_globals->_player, this, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 4252, &g_globals->_player, this, NULL);
break;
default:
SceneHotspot::doAction(action);
@@ -3361,7 +3361,7 @@ void Scene4250::Hotspot2::doAction(int action) {
}
void Scene4250::Hotspot4::doAction(int action) {
- Scene4250 *scene = (Scene4250 *)_globals->_sceneManager._scene;
+ Scene4250 *scene = (Scene4250 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -3380,8 +3380,8 @@ void Scene4250::Hotspot4::doAction(int action) {
SceneHotspot::doAction(action);
break;
case CURSOR_TALK:
- _globals->_player.disableControl();
- if (!_globals->_sceneObjects->contains(&scene->_hotspot6)) {
+ g_globals->_player.disableControl();
+ if (!g_globals->_sceneObjects->contains(&scene->_hotspot6)) {
scene->_sceneMode = 4254;
scene->setAction(&scene->_sequenceManager, scene, 4263, NULL);
} else {
@@ -3403,7 +3403,7 @@ void Scene4250::Hotspot4::doAction(int action) {
}
void Scene4250::Hotspot6::doAction(int action) {
- Scene4250 *scene = (Scene4250 *)_globals->_sceneManager._scene;
+ Scene4250 *scene = (Scene4250 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -3416,17 +3416,17 @@ void Scene4250::Hotspot6::doAction(int action) {
SceneItem::display2(4250, (RING_INVENTORY._helmet._sceneNumber == 4250) ? 20 : 3);
break;
case OBJECT_HELMET:
- _globals->_soundHandler.play(354);
- _globals->_player.disableControl();
+ g_globals->_soundHandler.play(354);
+ g_globals->_player.disableControl();
RING_INVENTORY._helmet._sceneNumber = 4250;
if (RING_INVENTORY._concentrator._sceneNumber == 1) {
- if (_globals->getFlag(115)) {
+ if (g_globals->getFlag(115)) {
scene->_sceneMode = 4269;
scene->setAction(&scene->_sequenceManager, scene, 4269, this, NULL);
} else {
- _globals->setFlag(115);
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->setFlag(115);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_sceneMode = 4256;
scene->setAction(&scene->_sequenceManager, scene, 4256, this, NULL);
}
@@ -3437,20 +3437,20 @@ void Scene4250::Hotspot6::doAction(int action) {
scene->_sceneMode = 4268;
scene->setAction(&scene->_sequenceManager, scene, 4268, this, NULL);
} else {
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
ADD_MOVER_NULL(scene->_hotspot1, 241, 169);
scene->_sceneMode = 4261;
- scene->setAction(&scene->_sequenceManager, scene, 4261, &_globals->_player, this, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 4261, &g_globals->_player, this, NULL);
}
break;
case OBJECT_NULLIFIER:
if (RING_INVENTORY._helmet._sceneNumber == 4250) {
- _globals->_soundHandler.play(353);
- _globals->_player.disableControl();
+ g_globals->_soundHandler.play(353);
+ g_globals->_player.disableControl();
RING_INVENTORY._helmet._sceneNumber = 1;
scene->_sceneMode = 4257;
- scene->setAction(&scene->_sequenceManager, scene, 4257, &_globals->_player, this, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 4257, &g_globals->_player, this, NULL);
} else {
SceneItem::display2(4250, 4);
}
@@ -3459,7 +3459,7 @@ void Scene4250::Hotspot6::doAction(int action) {
if (RING_INVENTORY._helmet._sceneNumber == 4250)
doAction(OBJECT_HELMET);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 4264;
scene->setAction(&scene->_sequenceManager, scene, 4264, this, NULL);
}
@@ -3468,7 +3468,7 @@ void Scene4250::Hotspot6::doAction(int action) {
if (RING_INVENTORY._helmet._sceneNumber == 4250)
doAction(OBJECT_HELMET);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
if ((RING_INVENTORY._items._sceneNumber != 1) || (RING_INVENTORY._concentrator._sceneNumber != 1)) {
scene->_sceneMode = 4258;
scene->setAction(&scene->_sequenceManager, scene, 4258, this, NULL);
@@ -3480,7 +3480,7 @@ void Scene4250::Hotspot6::doAction(int action) {
scene->_hotspot2.hide();
scene->_sceneMode = 4259;
- scene->setAction(&scene->_sequenceManager, scene, 4259, &_globals->_player, this, &scene->_hotspot2, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 4259, &g_globals->_player, this, &scene->_hotspot2, NULL);
}
}
break;
@@ -3491,12 +3491,12 @@ void Scene4250::Hotspot6::doAction(int action) {
}
void Scene4250::Hotspot8::doAction(int action) {
- Scene4250 *scene = (Scene4250 *)_globals->_sceneManager._scene;
+ Scene4250 *scene = (Scene4250 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
case CURSOR_USE:
- _globals->_sceneManager.changeScene(4300);
+ g_globals->_sceneManager.changeScene(4300);
break;
case OBJECT_SCANNER:
SceneItem::display2(4250, 24);
@@ -3505,7 +3505,7 @@ void Scene4250::Hotspot8::doAction(int action) {
SceneItem::display2(4250, 25);
break;
case OBJECT_STASIS_NEGATOR:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 4270;
scene->setAction(&scene->_sequenceManager, scene,
(RING_INVENTORY._helmet._sceneNumber == 4250) ? 4270 : 4271, NULL);
@@ -3542,13 +3542,13 @@ void Scene4250::postInit(TsAGE::SceneObjectList *OwnerList) {
_speakerPText.setTextPos(Common::Point(40, 100));
_hotspot8._sceneRegionId = 16;
- _globals->_player.postInit();
- _globals->_player.setVisage(2602);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setPosition(Common::Point(-13, 190));
- _globals->_player.changeZoom(-1);
- _globals->_player._moveDiff = Common::Point(4, 1);
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(2602);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setPosition(Common::Point(-13, 190));
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player._moveDiff = Common::Point(4, 1);
_hotspot1.postInit();
_hotspot1.setVisage(2801);
@@ -3557,9 +3557,9 @@ void Scene4250::postInit(TsAGE::SceneObjectList *OwnerList) {
_hotspot1.setPosition(Common::Point(-18, 185));
_hotspot1.changeZoom(-1);
_hotspot1._moveDiff = Common::Point(4, 1);
- _globals->_sceneItems.push_back(&_hotspot1);
+ g_globals->_sceneItems.push_back(&_hotspot1);
- if (_globals->_sceneManager._previousScene == 4300) {
+ if (g_globals->_sceneManager._previousScene == 4300) {
_hotspot5.postInit();
_hotspot5.setVisage(4250);
_hotspot5.setPosition(Common::Point(268, 168));
@@ -3573,13 +3573,13 @@ void Scene4250::postInit(TsAGE::SceneObjectList *OwnerList) {
_hotspot4.setStrip(2);
_hotspot4._moveDiff = Common::Point(4, 1);
_hotspot4.changeZoom(70);
- _globals->_sceneItems.push_back(&_hotspot4);
+ g_globals->_sceneItems.push_back(&_hotspot4);
_hotspot1.setPosition(Common::Point(197, 173));
_hotspot1.changeZoom(70);
- _globals->_player.setPosition(Common::Point(252, 176));
- _globals->_player.changeZoom(70);
+ g_globals->_player.setPosition(Common::Point(252, 176));
+ g_globals->_player.changeZoom(70);
_hotspot6.postInit();
_hotspot6.setVisage(4302);
@@ -3594,32 +3594,32 @@ void Scene4250::postInit(TsAGE::SceneObjectList *OwnerList) {
_hotspot6.setFrame(_hotspot6.getFrameCount());
}
- if (_globals->getFlag(98)) {
- _globals->_sceneItems.push_front(&_hotspot6);
+ if (g_globals->getFlag(98)) {
+ g_globals->_sceneItems.push_front(&_hotspot6);
} else {
_hotspot6.hide();
- if ((_globals->_stripNum == 4300) || (_globals->_stripNum == 4301)) {
- _globals->setFlag(98);
- _globals->_player.setVisage(4302);
- _globals->_player.setStrip(5);
- _globals->_player.changeZoom(50);
- _globals->_player.disableControl();
+ if ((g_globals->_stripNum == 4300) || (g_globals->_stripNum == 4301)) {
+ g_globals->setFlag(98);
+ g_globals->_player.setVisage(4302);
+ g_globals->_player.setStrip(5);
+ g_globals->_player.changeZoom(50);
+ g_globals->_player.disableControl();
_hotspot4.setPosition(Common::Point(239, 195));
_sceneMode = 4253;
- _globals->_sceneItems.push_front(&_hotspot6);
+ g_globals->_sceneItems.push_front(&_hotspot6);
- setAction(&_sequenceManager, this, 4253, &_globals->_player, &_hotspot6, &_hotspot4, NULL);
+ setAction(&_sequenceManager, this, 4253, &g_globals->_player, &_hotspot6, &_hotspot4, NULL);
}
}
- } else if (_globals->_stripNum == 9000) {
+ } else if (g_globals->_stripNum == 9000) {
_hotspot4.postInit();
_hotspot4.setVisage(2701);
_hotspot4.animate(ANIM_MODE_1, NULL);
_hotspot4.setObjectWrapper(new SceneObjectWrapper());
_hotspot4.setPosition(Common::Point(-15, 195));
_hotspot4._moveDiff = Common::Point(4, 1);
- _globals->_sceneItems.push_back(&_hotspot4);
+ g_globals->_sceneItems.push_back(&_hotspot4);
setAction(&_action5);
} else {
@@ -3632,13 +3632,13 @@ void Scene4250::postInit(TsAGE::SceneObjectList *OwnerList) {
_hotspot3._moveDiff = Common::Point(4, 1);
setAction(&_action1);
- _globals->clearFlag(43);
- _globals->clearFlag(114);
- _globals->clearFlag(36);
+ g_globals->clearFlag(43);
+ g_globals->clearFlag(114);
+ g_globals->clearFlag(36);
}
- if (_globals->getFlag(17)) {
- _globals->_sceneItems.push_back(&_hotspot8);
+ if (g_globals->getFlag(17)) {
+ g_globals->_sceneItems.push_back(&_hotspot8);
} else {
_hotspot2.postInit();
_hotspot2.setVisage(4251);
@@ -3647,27 +3647,27 @@ void Scene4250::postInit(TsAGE::SceneObjectList *OwnerList) {
_hotspot2.setFrame(1);
_hotspot2.setPosition(Common::Point(267, 172));
- _globals->_sceneItems.push_back(&_hotspot2);
+ g_globals->_sceneItems.push_back(&_hotspot2);
}
_hotspot7.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- _globals->_sceneItems.push_back(&_hotspot7);
- _globals->_soundHandler.play(185);
+ g_globals->_sceneItems.push_back(&_hotspot7);
+ g_globals->_soundHandler.play(185);
}
void Scene4250::signal() {
switch (_sceneMode) {
case 4252:
- _globals->setFlag(17);
- _globals->_sceneManager.changeScene(4301);
+ g_globals->setFlag(17);
+ g_globals->_sceneManager.changeScene(4301);
break;
case 4253:
- if (_globals->_stripNum == 4301) {
+ if (g_globals->_stripNum == 4301) {
_sceneMode = 4261;
ADD_MOVER_NULL(_hotspot1, 241, 169);
- setAction(&_sequenceManager, this, 4261, &_globals->_player, &_hotspot6, NULL);
+ setAction(&_sequenceManager, this, 4261, &g_globals->_player, &_hotspot6, NULL);
} else {
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
}
break;
case 4254:
@@ -3682,15 +3682,15 @@ void Scene4250::signal() {
case 4268:
case 4269:
case 4270:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 4259:
- _globals->_soundHandler.play(360);
- _globals->_sceneManager.changeScene(9900);
+ g_globals->_soundHandler.play(360);
+ g_globals->_sceneManager.changeScene(9900);
break;
case 4261:
RING_INVENTORY._keyDevice._sceneNumber = 1;
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 4255:
case 4262:
@@ -3701,13 +3701,13 @@ void Scene4250::signal() {
}
void Scene4250::dispatch() {
- if (_globals->_player.getRegionIndex() == 8)
- _globals->_player.changeZoom(90 - (_globals->_player._position.y - 153));
- if (_globals->_player.getRegionIndex() == 12)
- _globals->_player.changeZoom(70);
- if (_globals->_player.getRegionIndex() == 15) {
- _globals->_player.changeZoom(-1);
- _globals->_player.fixPriority(-1);
+ if (g_globals->_player.getRegionIndex() == 8)
+ g_globals->_player.changeZoom(90 - (g_globals->_player._position.y - 153));
+ if (g_globals->_player.getRegionIndex() == 12)
+ g_globals->_player.changeZoom(70);
+ if (g_globals->_player.getRegionIndex() == 15) {
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player.fixPriority(-1);
}
if (_hotspot1.getRegionIndex() == 8)
@@ -3731,11 +3731,11 @@ void Scene4250::dispatch() {
Scene::dispatch();
if (!_action) {
- if (!_globals->getFlag(55) && (_globals->_player.getRegionIndex() == 12)) {
+ if (!g_globals->getFlag(55) && (g_globals->_player.getRegionIndex() == 12)) {
setAction(&_action4);
}
- if (_globals->_sceneObjects->contains(&_hotspot6) && (_globals->_player.getRegionIndex() == 12))
+ if (g_globals->_sceneObjects->contains(&_hotspot6) && (g_globals->_player.getRegionIndex() == 12))
setAction(&_action4);
}
}
@@ -3746,17 +3746,17 @@ void Scene4250::dispatch() {
*--------------------------------------------------------------------------*/
void Scene4300::Action1::signal() {
- Scene4300 *scene = (Scene4300 *)_globals->_sceneManager._scene;
+ Scene4300 *scene = (Scene4300 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->setFlag(56);
- _globals->_scenePalette.addRotation(240, 254, -1);
+ g_globals->setFlag(56);
+ g_globals->_scenePalette.addRotation(240, 254, -1);
scene->_hotspot7.animate(ANIM_MODE_6, this);
- _globals->_soundHandler.play(164);
+ g_globals->_soundHandler.play(164);
break;
case 1:
- _globals->_soundHandler.play(340);
+ g_globals->_soundHandler.play(340);
scene->_soundHandler1.play(341);
scene->_hotspot1.remove();
setDelay(3);
@@ -3795,10 +3795,10 @@ void Scene4300::Action1::signal() {
scene->_stripManager.start(8015, this, scene);
break;
case 9:
- _globals->_soundHandler.play(350);
- _globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
- _globals->_events.setCursor(CURSOR_USE);
- _globals->_player.enableControl();
+ g_globals->_soundHandler.play(350);
+ g_globals->_sceneManager._fadeMode = FADEMODE_GRADUAL;
+ g_globals->_events.setCursor(CURSOR_USE);
+ g_globals->_player.enableControl();
remove();
break;
@@ -3806,7 +3806,7 @@ void Scene4300::Action1::signal() {
}
void Scene4300::Action2::signal() {
- Scene4300 *scene = (Scene4300 *)_globals->_sceneManager._scene;
+ Scene4300 *scene = (Scene4300 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -3816,7 +3816,7 @@ void Scene4300::Action2::signal() {
scene->_stripManager.start(8016, this, scene);
break;
case 2:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -3841,11 +3841,11 @@ void Scene4300::Hotspot8::doAction(int action) {
break;
case OBJECT_KEY_DEVICE:
RING_INVENTORY._keyDevice._sceneNumber = 4300;
- _globals->_scenePalette.addRotation(240, 254, -1);
+ g_globals->_scenePalette.addRotation(240, 254, -1);
animate(ANIM_MODE_5, NULL);
- _globals->setFlag(99);
- _globals->_sceneItems.push_back(this);
+ g_globals->setFlag(99);
+ g_globals->_sceneItems.push_back(this);
break;
default:
SceneHotspot::doAction(action);
@@ -3887,14 +3887,14 @@ void Scene4300::Hotspot9::doAction(int action) {
void Scene4300::Hotspot10::doAction(int action) {
// Alien
- Scene4300 *scene = (Scene4300 *)_globals->_sceneManager._scene;
+ Scene4300 *scene = (Scene4300 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(4300, 2);
break;
case CURSOR_TALK:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action2);
break;
case OBJECT_SCANNER:
@@ -3905,9 +3905,9 @@ void Scene4300::Hotspot10::doAction(int action) {
break;
case CURSOR_USE:
case OBJECT_HELMET:
- _globals->_stripNum = (action == CURSOR_USE) ? 4300 : 4301;
- _globals->_events.setCursor(CURSOR_NONE);
- _globals->_sceneManager.changeScene(4250);
+ g_globals->_stripNum = (action == CURSOR_USE) ? 4300 : 4301;
+ g_globals->_events.setCursor(CURSOR_NONE);
+ g_globals->_sceneManager.changeScene(4250);
break;
default:
SceneHotspot::doAction(action);
@@ -3916,11 +3916,11 @@ void Scene4300::Hotspot10::doAction(int action) {
}
void Scene4300::Hotspot15::signal() {
- Scene4300 *scene = (Scene4300 *)_globals->_sceneManager._scene;
+ Scene4300 *scene = (Scene4300 *)g_globals->_sceneManager._scene;
scene->_soundHandler2.play(345);
- _strip = (_globals->_randomSource.getRandomNumber(6) < 2) ? 2 : 1;
+ _strip = (g_globals->_randomSource.getRandomNumber(6) < 2) ? 2 : 1;
if ((RING_INVENTORY._stasisBox2._sceneNumber == 4300) ||
(RING_INVENTORY._concentrator._sceneNumber == 1)) {
setStrip(1);
@@ -3932,7 +3932,7 @@ void Scene4300::Hotspot15::signal() {
}
void Scene4300::Hotspot16::doAction(int action) {
- Scene4300 *scene = (Scene4300 *)_globals->_sceneManager._scene;
+ Scene4300 *scene = (Scene4300 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -3960,7 +3960,7 @@ void Scene4300::Hotspot16::doAction(int action) {
}
void Scene4300::Hotspot17::doAction(int action) {
- Scene4300 *scene = (Scene4300 *)_globals->_sceneManager._scene;
+ Scene4300 *scene = (Scene4300 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -3970,7 +3970,7 @@ void Scene4300::Hotspot17::doAction(int action) {
if (RING_INVENTORY._stasisBox2._sceneNumber != 4300)
SceneItem::display2(4300, 13);
else {
- _globals->_scenePalette.clearListeners();
+ g_globals->_scenePalette.clearListeners();
remove();
SceneItem::display2(4300, 12);
@@ -3985,7 +3985,7 @@ void Scene4300::Hotspot17::doAction(int action) {
break;
case OBJECT_STASIS_BOX2:
scene->_soundHandler1.play(352);
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
scene->_sceneMode = 4303;
scene->setAction(&scene->_sequenceManager, scene, 4303, this, NULL);
@@ -4033,27 +4033,27 @@ void Scene4300::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerMText);
_stripManager.addSpeaker(&_speakerFLText);
- _hotspot11.setup(76, 97, 102, 127, 4300, 5, 6);
+ _hotspot11.setDetails(76, 97, 102, 127, 4300, 5, 6);
_hotspot7.postInit();
_hotspot7.setPosition(Common::Point(90, 128));
_hotspot7.setVisage(4303);
_hotspot7.fixPriority(250);
- _globals->_sceneItems.push_back(&_hotspot7);
+ g_globals->_sceneItems.push_back(&_hotspot7);
- _hotspot9.setup(120, 49, 174, 91, 4300, -1, -1);
+ _hotspot9.setDetails(120, 49, 174, 91, 4300, -1, -1);
_hotspot15.postInit();
_hotspot15.setVisage(4300);
_hotspot15.setPosition(Common::Point(149, 79));
_hotspot15.signal();
- if (!_globals->getFlag(99)) {
+ if (!g_globals->getFlag(99)) {
_hotspot8.postInit();
_hotspot8.setVisage(4300);
_hotspot8.setStrip(3);
_hotspot8.setPosition(Common::Point(196, 47));
- _globals->_sceneItems.push_back(&_hotspot8);
+ g_globals->_sceneItems.push_back(&_hotspot8);
}
if (RING_INVENTORY._concentrator._sceneNumber == 4300) {
@@ -4066,15 +4066,15 @@ void Scene4300::postInit(SceneObjectList *OwnerList) {
if (RING_INVENTORY._stasisBox2._sceneNumber == 4300)
_hotspot17.setFrame(_hotspot17.getFrameCount());
- _globals->_sceneItems.push_back(&_hotspot17);
+ g_globals->_sceneItems.push_back(&_hotspot17);
}
- if (!_globals->getFlag(98)) {
+ if (!g_globals->getFlag(98)) {
_hotspot10.postInit();
_hotspot10.setVisage(4302);
_hotspot10.setPosition(Common::Point(244, 179));
_hotspot10.fixPriority(100);
- _globals->_sceneItems.push_back(&_hotspot10);
+ g_globals->_sceneItems.push_back(&_hotspot10);
_hotspot12.postInit();
_hotspot12.setVisage(4302);
@@ -4099,11 +4099,11 @@ void Scene4300::postInit(SceneObjectList *OwnerList) {
_hotspot16.setPosition(Common::Point(169, 141));
_hotspot16.fixPriority(1);
_hotspot16.setStrip(4);
- _globals->_sceneItems.push_back(&_hotspot16);
+ g_globals->_sceneItems.push_back(&_hotspot16);
}
- if (_globals->_sceneManager._previousScene == 4301) {
- _globals->_player.disableControl();
+ if (g_globals->_sceneManager._previousScene == 4301) {
+ g_globals->_player.disableControl();
_hotspot7.setFrame(_hotspot7.getFrameCount());
_hotspot1.postInit();
@@ -4143,15 +4143,15 @@ void Scene4300::postInit(SceneObjectList *OwnerList) {
setAction(&_action1);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 4304;
setAction(&_sequenceManager, this, 4304, NULL);
}
_hotspot10.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
_hotspot19._sceneRegionId = 0;
- _globals->_sceneItems.push_back(&_hotspot19);
- _globals->_sceneItems.push_back(&_hotspot18);
+ g_globals->_sceneItems.push_back(&_hotspot19);
+ g_globals->_sceneItems.push_back(&_hotspot18);
}
void Scene4300::stripCallback(int v) {
@@ -4167,7 +4167,7 @@ void Scene4300::stripCallback(int v) {
}
void Scene4300::remove() {
- _globals->_scenePalette.clearListeners();
+ g_globals->_scenePalette.clearListeners();
Scene::remove();
}
@@ -4176,7 +4176,7 @@ void Scene4300::signal() {
case 4302:
RING_INVENTORY._items._sceneNumber = 1;
_hotspot16.remove();
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 4303:
RING_INVENTORY._stasisBox2._sceneNumber = 4300;
@@ -4195,8 +4195,8 @@ void Scene4300::signal() {
_gfxButton.draw();
_gfxButton._bounds.expandPanes();
- _globals->_player.enableControl();
- _globals->_scenePalette.addRotation(240, 254, -1);
+ g_globals->_player.enableControl();
+ g_globals->_scenePalette.addRotation(240, 254, -1);
break;
}
}
@@ -4209,7 +4209,7 @@ void Scene4300::dispatch() {
void Scene4300::process(Event &event) {
Scene::process(event);
if (_gfxButton.process(event))
- _globals->_sceneManager.changeScene(4250);
+ g_globals->_sceneManager.changeScene(4250);
}
/*--------------------------------------------------------------------------
@@ -4225,8 +4225,8 @@ void Scene4301::Action1::synchronize(Serializer &s) {
}
void Scene4301::Action1::remove() {
- Scene4301 *scene = (Scene4301 *)_globals->_sceneManager._scene;
- _globals->_player.enableControl();
+ Scene4301 *scene = (Scene4301 *)g_globals->_sceneManager._scene;
+ g_globals->_player.enableControl();
for (_state = 0; _state < 6; ++_state)
_buttonList[_state].remove();
@@ -4239,7 +4239,7 @@ void Scene4301::Action1::remove() {
}
void Scene4301::Action1::signal() {
- Scene4301 *scene = (Scene4301 *)_globals->_sceneManager._scene;
+ Scene4301 *scene = (Scene4301 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -4247,8 +4247,8 @@ void Scene4301::Action1::signal() {
scene->_hotspot1.animate(ANIM_MODE_5, this);
break;
case 1:
- _globals->_soundHandler.play(335);
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_soundHandler.play(335);
+ g_globals->_events.setCursor(CURSOR_USE);
scene->_hotspot2.postInit();
scene->_hotspot2.setVisage(4303);
@@ -4271,7 +4271,7 @@ void Scene4301::Action1::signal() {
break;
case 10:
// Puzzle: Wrong code
- _globals->_events.setCursor(CURSOR_NONE);
+ g_globals->_events.setCursor(CURSOR_NONE);
scene->_soundHandler.play(337);
if (scene->_hotspot3._flags & OBJFLAG_HIDE)
scene->_hotspot3.show();
@@ -4292,11 +4292,11 @@ void Scene4301::Action1::signal() {
_actionIndex = 2;
_state = 0;
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
break;
case 20:
// Puzzle: Correct code
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_soundHandler.play(339);
scene->_hotspot3._frame = 3;
if (scene->_hotspot3._flags & OBJFLAG_HIDE)
@@ -4319,7 +4319,7 @@ void Scene4301::Action1::signal() {
void Scene4301::Action1::process(Event &event) {
// Puzzle
- Scene4301 *scene = (Scene4301 *)_globals->_sceneManager._scene;
+ Scene4301 *scene = (Scene4301 *)g_globals->_sceneManager._scene;
Rect buttonsRect;
Action::process(event);
@@ -4374,10 +4374,10 @@ void Scene4301::Action1::process(Event &event) {
void Scene4301::Hotspot4::doAction(int action) {
// Hatch near door
- Scene4301 *scene = (Scene4301 *)_globals->_sceneManager._scene;
+ Scene4301 *scene = (Scene4301 *)g_globals->_sceneManager._scene;
if (action == CURSOR_USE) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action1);
} else {
NamedHotspot::doAction(action);
@@ -4407,14 +4407,14 @@ void Scene4301::Hotspot5::doAction(int action) {
/*--------------------------------------------------------------------------*/
void Scene4301::postInit(SceneObjectList *OwnerList) {
- _globals->setFlag(50);
+ g_globals->setFlag(50);
loadScene(4301);
Scene::postInit();
setZoomPercents(0, 100, 200, 100);
_field68E = false;
RING_INVENTORY._stasisBox2._sceneNumber = 1;
- _hotspot4.setup(97, 76, 127, 102, 4300, 5, 6);
+ _hotspot4.setDetails(97, 76, 127, 102, 4300, 5, 6);
_hotspot1.postInit();
_hotspot1.setPosition(Common::Point(90, 128));
@@ -4424,9 +4424,9 @@ void Scene4301::postInit(SceneObjectList *OwnerList) {
_hotspot1.fixPriority(250);
_hotspot5.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- _globals->_sceneItems.push_back(&_hotspot5);
+ g_globals->_sceneItems.push_back(&_hotspot5);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
}
void Scene4301::dispatch() {
@@ -4434,9 +4434,9 @@ void Scene4301::dispatch() {
_action->dispatch();
} else if (_field68E) {
_field68E = 0;
- _globals->clearFlag(50);
- _globals->_sceneManager._fadeMode = FADEMODE_NONE;
- _globals->_sceneManager.setNewScene(4300);
+ g_globals->clearFlag(50);
+ g_globals->_sceneManager._fadeMode = FADEMODE_NONE;
+ g_globals->_sceneManager.setNewScene(4300);
}
}
diff --git a/engines/tsage/ringworld/ringworld_scenes5.h b/engines/tsage/ringworld/ringworld_scenes5.h
index 6c6b6b6f32..80e67755bd 100644
--- a/engines/tsage/ringworld/ringworld_scenes5.h
+++ b/engines/tsage/ringworld/ringworld_scenes5.h
@@ -27,6 +27,7 @@
#include "tsage/core.h"
#include "tsage/converse.h"
#include "tsage/ringworld/ringworld_logic.h"
+#include "tsage/ringworld/ringworld_speakers.h"
namespace TsAGE {
diff --git a/engines/tsage/ringworld/ringworld_scenes6.cpp b/engines/tsage/ringworld/ringworld_scenes6.cpp
index f21ae59478..cd3415f511 100644
--- a/engines/tsage/ringworld/ringworld_scenes6.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes6.cpp
@@ -36,7 +36,7 @@ namespace Ringworld {
void Scene5000::Action1::signal() {
// Ship landing
- Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene;
+ Scene5000 *scene = (Scene5000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -88,7 +88,7 @@ void Scene5000::Action1::signal() {
}
void Scene5000::Action1::dispatch() {
- Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene;
+ Scene5000 *scene = (Scene5000 *)g_globals->_sceneManager._scene;
Action::dispatch();
if (_actionIndex == 3) {
@@ -112,83 +112,83 @@ void Scene5000::Action1::dispatch() {
}
void Scene5000::Action2::signal() {
- Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene;
+ Scene5000 *scene = (Scene5000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.setPosition(Common::Point(217, 76));
+ g_globals->_player.setPosition(Common::Point(217, 76));
setDelay(10);
break;
case 1:
- _globals->_player.setStrip2(3);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- ADD_MOVER(_globals->_player, 214, 89);
+ g_globals->_player.setStrip2(3);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ ADD_MOVER(g_globals->_player, 214, 89);
break;
case 2:
- if (!_globals->getFlag(59))
+ if (!g_globals->getFlag(59))
setAction(&scene->_action3, this);
- _globals->_player.fixPriority(15);
- ADD_MOVER(_globals->_player, 208, 100);
+ g_globals->_player.fixPriority(15);
+ ADD_MOVER(g_globals->_player, 208, 100);
break;
case 3:
- ADD_MOVER(_globals->_player, 213, 98);
+ ADD_MOVER(g_globals->_player, 213, 98);
break;
case 4:
- _globals->_player.fixPriority(20);
- ADD_MOVER(_globals->_player, 215, 115);
+ g_globals->_player.fixPriority(20);
+ ADD_MOVER(g_globals->_player, 215, 115);
break;
case 5:
- _globals->_player.changeZoom(47);
- ADD_MOVER(_globals->_player, 220, 125);
+ g_globals->_player.changeZoom(47);
+ ADD_MOVER(g_globals->_player, 220, 125);
break;
case 6:
- ADD_MOVER(_globals->_player, 229, 115);
+ ADD_MOVER(g_globals->_player, 229, 115);
break;
case 7:
- _globals->_player.changeZoom(-1);
- _globals->_player.fixPriority(35);
- ADD_MOVER(_globals->_player, 201, 166);
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player.fixPriority(35);
+ ADD_MOVER(g_globals->_player, 201, 166);
break;
case 8:
- _globals->_player.updateZoom();
- ADD_MOVER(_globals->_player, 205, 146);
+ g_globals->_player.updateZoom();
+ ADD_MOVER(g_globals->_player, 205, 146);
break;
case 9:
- _globals->_player.changeZoom(-1);
- _globals->_player.fixPriority(50);
- ADD_MOVER(_globals->_player, 220, 182);
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player.fixPriority(50);
+ ADD_MOVER(g_globals->_player, 220, 182);
break;
case 10:
- _globals->_player.updateZoom();
- ADD_MOVER(_globals->_player, 208, 163);
+ g_globals->_player.updateZoom();
+ ADD_MOVER(g_globals->_player, 208, 163);
break;
case 11:
- _globals->_player.changeZoom(-1);
- _globals->_player.setStrip2(-1);
- _globals->_player.fixPriority(-1);
- ADD_MOVER(_globals->_player, 208, 175);
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player.setStrip2(-1);
+ g_globals->_player.fixPriority(-1);
+ ADD_MOVER(g_globals->_player, 208, 175);
break;
case 12:
- _globals->_player.setStrip(8);
- _globals->_player.setFrame(1);
+ g_globals->_player.setStrip(8);
+ g_globals->_player.setFrame(1);
setDelay(10);
break;
case 13:
- if (!_globals->_sceneObjects->contains(&scene->_hotspot7))
+ if (!g_globals->_sceneObjects->contains(&scene->_hotspot7))
setDelay(10);
break;
case 14:
setDelay(30);
break;
case 15:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene5000::Action3::signal() {
- Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene;
+ Scene5000 *scene = (Scene5000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -206,7 +206,7 @@ void Scene5000::Action3::signal() {
scene->_hotspot7.animate(ANIM_MODE_1, NULL);
ADD_MOVER(scene->_hotspot7, 214, 89);
- _globals->_sceneItems.push_front(&scene->_hotspot7);
+ g_globals->_sceneItems.push_front(&scene->_hotspot7);
break;
case 2:
scene->_hotspot7.changeZoom(-1);
@@ -262,116 +262,116 @@ void Scene5000::Action3::signal() {
}
void Scene5000::Action4::signal() {
- Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene;
+ Scene5000 *scene = (Scene5000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(1);
break;
case 1:
- _globals->_player.fixPriority(50);
- _globals->_player.setStrip2(4);
- ADD_MOVER(_globals->_player, 210, 182);
+ g_globals->_player.fixPriority(50);
+ g_globals->_player.setStrip2(4);
+ ADD_MOVER(g_globals->_player, 210, 182);
break;
case 2:
- ADD_MOVER(_globals->_player, 205, 146);
+ ADD_MOVER(g_globals->_player, 205, 146);
break;
case 3:
- _globals->_player.fixPriority(35);
- ADD_MOVER(_globals->_player, 201, 166);
+ g_globals->_player.fixPriority(35);
+ ADD_MOVER(g_globals->_player, 201, 166);
break;
case 4:
- ADD_MOVER(_globals->_player, 229, 115);
+ ADD_MOVER(g_globals->_player, 229, 115);
break;
case 5:
- _globals->_player.fixPriority(20);
- _globals->_player.changeZoom(47);
- ADD_MOVER(_globals->_player, 220, 125);
+ g_globals->_player.fixPriority(20);
+ g_globals->_player.changeZoom(47);
+ ADD_MOVER(g_globals->_player, 220, 125);
break;
case 6:
- ADD_MOVER(_globals->_player, 215, 115);
+ ADD_MOVER(g_globals->_player, 215, 115);
break;
case 7:
- _globals->_player.changeZoom(-1);
- ADD_MOVER(_globals->_player, 213, 98);
+ g_globals->_player.changeZoom(-1);
+ ADD_MOVER(g_globals->_player, 213, 98);
break;
case 8:
- _globals->_player.fixPriority(15);
- ADD_MOVER(_globals->_player, 208, 100);
+ g_globals->_player.fixPriority(15);
+ ADD_MOVER(g_globals->_player, 208, 100);
break;
case 9:
- ADD_MOVER(_globals->_player, 214, 89);
+ ADD_MOVER(g_globals->_player, 214, 89);
break;
case 10:
- ADD_MOVER(_globals->_player, 217, 76);
+ ADD_MOVER(g_globals->_player, 217, 76);
break;
case 11:
- _globals->_player.hide();
+ g_globals->_player.hide();
setDelay(60);
break;
case 12:
- if (!_globals->_sceneObjects->contains(&scene->_hotspot7))
- _globals->_sceneManager.changeScene(2320);
+ if (!g_globals->_sceneObjects->contains(&scene->_hotspot7))
+ g_globals->_sceneManager.changeScene(2320);
remove();
break;
}
}
void Scene5000::Action5::signal() {
- Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene;
+ Scene5000 *scene = (Scene5000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
- ADD_MOVER(_globals->_player, 91, 155);
+ g_globals->_player.disableControl();
+ ADD_MOVER(g_globals->_player, 91, 155);
break;
case 1:
- _globals->_player.setVisage(2670);
- _globals->_player._strip = 4;
- _globals->_player._frame = 1;
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(2670);
+ g_globals->_player._strip = 4;
+ g_globals->_player._frame = 1;
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 2:
- SceneItem::display2(5000, _globals->_sceneObjects->contains(&scene->_hotspot7) ? 17 : 13);
- _globals->_player.animate(ANIM_MODE_6, this);
+ SceneItem::display2(5000, g_globals->_sceneObjects->contains(&scene->_hotspot7) ? 17 : 13);
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 3:
- _globals->_player.setVisage(0);
- _globals->_player._strip = 8;
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setVisage(0);
+ g_globals->_player._strip = 8;
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
}
}
void Scene5000::Action6::signal() {
// Discussion between the hero and Seeker, then the hero goes back to the lander
- Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene;
+ Scene5000 *scene = (Scene5000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(3);
break;
case 1:
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
scene->_stripManager.start(2150, this);
break;
case 2:
- _globals->_events.setCursor(CURSOR_NONE);
+ g_globals->_events.setCursor(CURSOR_NONE);
scene->setAction(&scene->_sequenceManager, this, 5001, &scene->_hotspot7, NULL);
break;
case 3:
ADD_PLAYER_MOVER(208, 163);
break;
case 4:
- _globals->_player.fixPriority(50);
- _globals->_player.setStrip2(4);
- ADD_MOVER(_globals->_player, 210, 182);
+ g_globals->_player.fixPriority(50);
+ g_globals->_player.setStrip2(4);
+ ADD_MOVER(g_globals->_player, 210, 182);
break;
case 5:
- _globals->_sceneManager.changeScene(2100);
+ g_globals->_sceneManager.changeScene(2100);
break;
}
}
@@ -379,7 +379,7 @@ void Scene5000::Action6::signal() {
/*--------------------------------------------------------------------------*/
void Scene5000::Hotspot7::doAction(int action) {
- Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene;
+ Scene5000 *scene = (Scene5000 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -396,7 +396,7 @@ void Scene5000::Hotspot7::doAction(int action) {
void Scene5000::Hotspot8::doAction(int action) {
// Cave
- Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene;
+ Scene5000 *scene = (Scene5000 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -415,9 +415,9 @@ void Scene5000::Hotspot8::doAction(int action) {
}
void Scene5000::HotspotGroup1::doAction(int action) {
- Scene5000 *scene = (Scene5000 *)_globals->_sceneManager._scene;
+ Scene5000 *scene = (Scene5000 *)g_globals->_sceneManager._scene;
- if (_globals->_sceneObjects->contains(&scene->_hotspot7))
+ if (g_globals->_sceneObjects->contains(&scene->_hotspot7))
scene->setAction(&scene->_action6);
else
SceneItem::display2(5000, 11);
@@ -446,13 +446,13 @@ void Scene5000::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerSText);
_stripManager.addSpeaker(&_speakerQText);
- _globals->_player.postInit();
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player._moveDiff = Common::Point(4, 2);
- _globals->_player.changeZoom(-1);
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player._moveDiff = Common::Point(4, 2);
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player.disableControl();
_hotspot1.postInit();
_hotspot1.setVisage(5001);
@@ -518,14 +518,14 @@ void Scene5000::postInit(SceneObjectList *OwnerList) {
_hotspot16.setBounds(Rect(0, 86, 319, 200));
_hotspot12.setBounds(Rect(230, 143, 244, 150));
- _globals->_sceneItems.addItems(&_hotspot9, &_hotspot10, &_hotspot11, &_hotspot8, &_hotspot13,
+ g_globals->_sceneItems.addItems(&_hotspot9, &_hotspot10, &_hotspot11, &_hotspot8, &_hotspot13,
&_hotspot14, &_hotspot12, &_hotspot15, &_hotspot17, &_hotspot18, &_hotspot16, NULL);
- switch (_globals->_sceneManager._previousScene) {
+ switch (g_globals->_sceneManager._previousScene) {
case 1000:
case 2100:
case 2320:
- if (_globals->getFlag(59)) {
+ if (g_globals->getFlag(59)) {
_hotspot1.setPosition(Common::Point(233, 90));
_hotspot1.changeZoom(100);
_hotspot1.show();
@@ -535,21 +535,21 @@ void Scene5000::postInit(SceneObjectList *OwnerList) {
_hotspot5.setPosition(Common::Point(218, 76));
_hotspot5.show();
- _globals->_player.setPosition(Common::Point(217, -10));
- _globals->_player.disableControl();
+ g_globals->_player.setPosition(Common::Point(217, -10));
+ g_globals->_player.disableControl();
setAction(&_action2);
} else {
- _globals->_player.setPosition(Common::Point(217, -10));
+ g_globals->_player.setPosition(Common::Point(217, -10));
_hotspot1.setPosition(Common::Point(320, -10));
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setAction(&_action1);
}
break;
default:
- _globals->_player.disableControl();
- _globals->_player.setPosition(Common::Point(0, 146));
+ g_globals->_player.disableControl();
+ g_globals->_player.setPosition(Common::Point(0, 146));
_hotspot1.changeZoom(100);
_hotspot1.setPosition(Common::Point(233, 90));
@@ -559,11 +559,11 @@ void Scene5000::postInit(SceneObjectList *OwnerList) {
_hotspot5.show();
_sceneMode = 5004;
- setAction(&_sequenceManager, this, 5004, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 5004, &g_globals->_player, NULL);
break;
}
- _globals->_soundHandler.play(190);
+ g_globals->_soundHandler.play(190);
}
void Scene5000::signal() {
@@ -571,10 +571,10 @@ void Scene5000::signal() {
case 5002:
case 5003:
case 5004:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 5005:
- _globals->_sceneManager.changeScene(5100);
+ g_globals->_sceneManager.changeScene(5100);
break;
}
}
@@ -583,29 +583,29 @@ void Scene5000::dispatch() {
Scene::dispatch();
if (!_action) {
- if (!_globals->_sceneObjects->contains(&_hotspot7) && (_globals->_player.getRegionIndex() == 10)) {
- _globals->_player.disableControl();
+ if (!g_globals->_sceneObjects->contains(&_hotspot7) && (g_globals->_player.getRegionIndex() == 10)) {
+ g_globals->_player.disableControl();
_sceneMode = 5005;
- setAction(&_sequenceManager, this, 5005, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 5005, &g_globals->_player, NULL);
}
- if (_globals->_player.getRegionIndex() == 8) {
- _globals->_player.disableControl();
+ if (g_globals->_player.getRegionIndex() == 8) {
+ g_globals->_player.disableControl();
- if (_globals->_sceneObjects->contains(&_hotspot7)) {
+ if (g_globals->_sceneObjects->contains(&_hotspot7)) {
_sceneMode = 5003;
- _globals->_player.addMover(NULL);
- setAction(&_sequenceManager, this, 5003, &_globals->_player, NULL);
+ g_globals->_player.addMover(NULL);
+ setAction(&_sequenceManager, this, 5003, &g_globals->_player, NULL);
} else {
setAction(&_action4);
}
}
- if (_globals->_sceneObjects->contains(&_hotspot7) && (_globals->_player.getRegionIndex() == 15)) {
+ if (g_globals->_sceneObjects->contains(&_hotspot7) && (g_globals->_player.getRegionIndex() == 15)) {
_sceneMode = 5002;
- _globals->_player.disableControl();
- _globals->_player.addMover(NULL);
- setAction(&_sequenceManager, this, 5002, &_globals->_player, NULL);
+ g_globals->_player.disableControl();
+ g_globals->_player.addMover(NULL);
+ setAction(&_sequenceManager, this, 5002, &g_globals->_player, NULL);
}
}
}
@@ -617,26 +617,26 @@ void Scene5000::dispatch() {
void Scene5100::Action1::signal() {
// Quinn enters the cave for the first time
- Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
+ Scene5100 *scene = (Scene5100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(5);
break;
case 1:
- ADD_MOVER(_globals->_player, 1111, 165);
+ ADD_MOVER(g_globals->_player, 1111, 165);
break;
case 2:
- _globals->_player.setStrip(6);
- _globals->_player.setFrame(1);
+ g_globals->_player.setStrip(6);
+ g_globals->_player.setFrame(1);
setDelay(60);
break;
case 3:
- if (_globals->getFlag(10)) {
- _globals->_player.enableControl();
+ if (g_globals->getFlag(10)) {
+ g_globals->_player.enableControl();
remove();
} else {
- _globals->setFlag(10);
+ g_globals->setFlag(10);
scene->_stripManager.start(5102, this);
}
break;
@@ -650,7 +650,7 @@ void Scene5100::Action1::signal() {
scene->_hotspot5.animate(ANIM_MODE_1, NULL);
scene->_hotspot5.fixPriority(10);
- _globals->_sceneItems.push_front(&scene->_hotspot5);
+ g_globals->_sceneItems.push_front(&scene->_hotspot5);
ADD_MOVER(scene->_hotspot5, 999, 14);
break;
case 5:
@@ -659,7 +659,7 @@ void Scene5100::Action1::signal() {
scene->_hotspot5.animate(ANIM_MODE_5, this);
break;
case 6:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -667,11 +667,11 @@ void Scene5100::Action1::signal() {
void Scene5100::Action2::signal() {
// Quinn and Seeker exit the cave
- Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
+ Scene5100 *scene = (Scene5100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(5);
break;
case 1:
@@ -693,13 +693,13 @@ void Scene5100::Action2::signal() {
scene->_stripManager.start(5129, this);
break;
case 3:
- if (_globals->_player._position.x >= 966) {
+ if (g_globals->_player._position.x >= 966) {
ADD_PLAYER_MOVER_NULL(scene->_hotspot8, 1215, 155);
} else {
ADD_PLAYER_MOVER_NULL(scene->_hotspot8, 966, 185);
}
- if (_globals->_player._position.x >= 966) {
+ if (g_globals->_player._position.x >= 966) {
setDelay(1);
} else {
ADD_PLAYER_MOVER(966, 190);
@@ -710,40 +710,40 @@ void Scene5100::Action2::signal() {
ADD_PLAYER_MOVER(1215, 155);
break;
case 5:
- _globals->_sceneManager.changeScene(2100);
+ g_globals->_sceneManager.changeScene(2100);
break;
}
}
void Scene5100::Action3::signal() {
// Quinns shots flesheater
- Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
+ Scene5100 *scene = (Scene5100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->setFlag(62);
- _globals->_player.disableControl();
- _globals->_player.addMover(NULL);
+ g_globals->setFlag(62);
+ g_globals->_player.disableControl();
+ g_globals->_player.addMover(NULL);
scene->_hotspot2.addMover(NULL);
scene->_hotspot3.addMover(NULL);
- _globals->_player.setVisage(2672);
+ g_globals->_player.setVisage(2672);
- if (static_cast<SceneObject *>(_owner)->_position.x >= _globals->_player._position.x)
- _globals->_player._strip = 4;
+ if (static_cast<SceneObject *>(_owner)->_position.x >= g_globals->_player._position.x)
+ g_globals->_player._strip = 4;
else
- _globals->_player._strip = 3;
- _globals->_player._frame = 1;
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player._strip = 3;
+ g_globals->_player._frame = 1;
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 1:
- _globals->_player.setVisage(2674);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setVisage(2674);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 2:
scene->_soundHandler.play(28);
- if (static_cast<SceneObject *>(_owner)->_position.x < _globals->_player._position.x) {
+ if (static_cast<SceneObject *>(_owner)->_position.x < g_globals->_player._position.x) {
scene->_hotspot2.setVisage(5130);
scene->_hotspot2._strip = 1;
scene->_hotspot2._frame = 1;
@@ -764,35 +764,35 @@ void Scene5100::Action3::signal() {
}
- _globals->_player.setVisage(2672);
- _globals->_player._frame = _globals->_player.getFrameCount();
- _globals->_player.animate(ANIM_MODE_6, this);
+ g_globals->_player.setVisage(2672);
+ g_globals->_player._frame = g_globals->_player.getFrameCount();
+ g_globals->_player.animate(ANIM_MODE_6, this);
break;
case 3:
break;
case 4:
SceneItem::display2(5100, 38);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
- _globals->_player.setVisage(0);
- _globals->_player._strip = 8;
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setVisage(0);
+ g_globals->_player._strip = 8;
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
remove();
break;
}
}
void Scene5100::Action4::signal() {
- Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
+ Scene5100 *scene = (Scene5100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_soundHandler.play(208);
SceneItem::display2(5100, 15);
ObjectMover3 *mover = new ObjectMover3();
- scene->_hotspot2.addMover(mover, &_globals->_player, 20, this);
+ scene->_hotspot2.addMover(mover, &g_globals->_player, 20, this);
break;
}
case 1:
@@ -806,18 +806,18 @@ void Scene5100::Action4::signal() {
setDelay(15);
break;
case 3:
- _globals->_sceneManager.changeScene(5200);
+ g_globals->_sceneManager.changeScene(5200);
break;
}
}
void Scene5100::Action5::signal() {
// Quinns forgot the statis box in the throne room, and goes back
- Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
+ Scene5100 *scene = (Scene5100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(60);
break;
case 1:
@@ -828,7 +828,7 @@ void Scene5100::Action5::signal() {
break;
case 3:
scene->_sceneMode = 5106;
- scene->setAction(&scene->_sequenceManager, scene, 5106, &_globals->_player, &scene->_hotspot14, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 5106, &g_globals->_player, &scene->_hotspot14, NULL);
break;
}
}
@@ -837,11 +837,11 @@ void Scene5100::Action5::signal() {
void Scene5100::HotspotGroup1::doAction(int action) {
// Flesh Eaters
- Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
+ Scene5100 *scene = (Scene5100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
- SceneItem::display2(5100, _globals->getFlag(62) ? 41 : 26);
+ SceneItem::display2(5100, g_globals->getFlag(62) ? 41 : 26);
break;
case CURSOR_USE:
SceneItem::display2(5100, 11);
@@ -850,7 +850,7 @@ void Scene5100::HotspotGroup1::doAction(int action) {
SceneItem::display2(5100, 17);
break;
case OBJECT_STUNNER:
- if (_globals->getFlag(62))
+ if (g_globals->getFlag(62))
SceneItem::display2(5100, 42);
else
setAction(&scene->_action3);
@@ -862,16 +862,16 @@ void Scene5100::HotspotGroup1::doAction(int action) {
}
void Scene5100::Hotspot4::doAction(int action) {
- Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
+ Scene5100 *scene = (Scene5100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(5100, 31);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 5110;
- scene->setAction(&scene->_sequenceManager, scene, 5110, &_globals->_player, this, &scene->_hotspot7, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 5110, &g_globals->_player, this, &scene->_hotspot7, NULL);
break;
case CURSOR_TALK:
SceneItem::display2(5100, 34);
@@ -890,11 +890,11 @@ void Scene5100::Hotspot4::doAction(int action) {
void Scene5100::HotspotGroup2::doAction(int action) {
// Bat
- Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
+ Scene5100 *scene = (Scene5100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
- SceneItem::display2(5100, _globals->getFlag(108) ? 47 : 23);
+ SceneItem::display2(5100, g_globals->getFlag(108) ? 47 : 23);
break;
case CURSOR_USE:
SceneItem::display2(5100, 29);
@@ -903,7 +903,7 @@ void Scene5100::HotspotGroup2::doAction(int action) {
if (_position.x >= 600)
SceneItem::display2(5100, 28);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 5114;
scene->setAction(&scene->_sequenceManager, scene, 5114, NULL);
}
@@ -919,16 +919,16 @@ void Scene5100::HotspotGroup2::doAction(int action) {
void Scene5100::Hotspot9::doAction(int action) {
// Rope
- Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
+ Scene5100 *scene = (Scene5100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(5100, 32);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 5117;
- scene->setAction(&scene->_sequenceManager, scene, 5117, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 5117, &g_globals->_player, NULL);
break;
case OBJECT_STUNNER:
SceneItem::display2(5100, 35);
@@ -937,9 +937,9 @@ void Scene5100::Hotspot9::doAction(int action) {
SceneItem::display2(5100, 44);
break;
case OBJECT_BONE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 5116;
- scene->setAction(&scene->_sequenceManager, scene, 5116, &_globals->_player, this, &scene->_hotspot10,
+ scene->setAction(&scene->_sequenceManager, scene, 5116, &g_globals->_player, this, &scene->_hotspot10,
&scene->_hotspot4, NULL);
break;
default:
@@ -950,19 +950,19 @@ void Scene5100::Hotspot9::doAction(int action) {
void Scene5100::Hotspot17::doAction(int action) {
// Rock blocking pit entrance
- Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
+ Scene5100 *scene = (Scene5100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(5100, 18);
break;
case CURSOR_USE:
- if (_globals->getFlag(67))
+ if (g_globals->getFlag(67))
SceneItem::display2(5100, 19);
else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 5101;
- scene->setAction(&scene->_sequenceManager, scene, 5101, &_globals->_player, this, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 5101, &g_globals->_player, this, NULL);
}
break;
default:
@@ -974,7 +974,7 @@ void Scene5100::Hotspot17::doAction(int action) {
void Scene5100::Hotspot18::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- if (_globals->_sceneManager._previousScene != 5000) {
+ if (g_globals->_sceneManager._previousScene != 5000) {
SceneItem::display2(5100, 3);
} else {
switch (_index1) {
@@ -1016,21 +1016,21 @@ void Scene5100::Hotspot18::doAction(int action) {
void Scene5100::Hotspot19::doAction(int action) {
// Pillar
- Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
+ Scene5100 *scene = (Scene5100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
- SceneItem::display2(5100, _globals->_sceneObjects->contains(&scene->_hotspot14) ? 27 : 20);
+ SceneItem::display2(5100, g_globals->_sceneObjects->contains(&scene->_hotspot14) ? 27 : 20);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 5106;
- if (_globals->getFlag(66))
- scene->setAction(&scene->_sequenceManager, scene, 5113, &_globals->_player, NULL);
+ if (g_globals->getFlag(66))
+ scene->setAction(&scene->_sequenceManager, scene, 5113, &g_globals->_player, NULL);
else {
- _globals->setFlag(66);
- scene->setAction(&scene->_sequenceManager, scene, 5106, &_globals->_player, &scene->_hotspot14, NULL);
+ g_globals->setFlag(66);
+ scene->setAction(&scene->_sequenceManager, scene, 5106, &g_globals->_player, &scene->_hotspot14, NULL);
}
break;
default:
@@ -1040,21 +1040,21 @@ void Scene5100::Hotspot19::doAction(int action) {
}
void Scene5100::Hotspot20::doAction(int action) {
- Scene5100 *scene = (Scene5100 *)_globals->_sceneManager._scene;
+ Scene5100 *scene = (Scene5100 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(5100, 21);
break;
case CURSOR_USE:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
- if (_globals->getFlag(67)) {
+ if (g_globals->getFlag(67)) {
scene->_sceneMode = 5112;
- scene->setAction(&scene->_sequenceManager, scene, 5112, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 5112, &g_globals->_player, NULL);
} else {
scene->_sceneMode = 5101;
- scene->setAction(&scene->_sequenceManager, scene, 5106, &_globals->_player, &scene->_hotspot17, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 5106, &g_globals->_player, &scene->_hotspot17, NULL);
}
break;
default:
@@ -1080,17 +1080,17 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerSText);
_stripManager.addSpeaker(&_speakerGameText);
_stripManager.addSpeaker(&_speakerBatText);
- _speakerQText._npc = &_globals->_player;
- _speakerMText._npc = &_globals->_player;
+ _speakerQText._npc = &g_globals->_player;
+ _speakerMText._npc = &g_globals->_player;
_speakerSText._npc = &_hotspot8;
- _globals->_player.postInit();
- _globals->_player.setVisage(0);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(0);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.disableControl();
- if ((!_globals->getFlag(66)) || (RING_INVENTORY._stasisBox._sceneNumber != 1)) {
+ if ((!g_globals->getFlag(66)) || (RING_INVENTORY._stasisBox._sceneNumber != 1)) {
_hotspot14.postInit();
_hotspot14.setVisage(5101);
_hotspot14.setPosition(Common::Point(498, 147));
@@ -1103,7 +1103,7 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
_hotspot17._strip = 2;
_hotspot17.fixPriority(200);
- if (_globals->getFlag(67))
+ if (g_globals->getFlag(67))
_hotspot17.setPosition(Common::Point(554, 192));
else
_hotspot17.setPosition(Common::Point(539, 179));
@@ -1111,26 +1111,26 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
_hotspot19.setBounds(Rect(488, 115, 508, 148));
_hotspot21.setBounds(Rect(1150, 85, 1173, 112));
_hotspot20.setBounds(Rect(517, 193, 562, 200));
- _globals->_sceneItems.addItems(&_hotspot19, &_hotspot21, NULL);
+ g_globals->_sceneItems.addItems(&_hotspot19, &_hotspot21, NULL);
- if (_globals->getFlag(67)) {
- _globals->_sceneItems.addItems(&_hotspot20, &_hotspot17, NULL);
+ if (g_globals->getFlag(67)) {
+ g_globals->_sceneItems.addItems(&_hotspot20, &_hotspot17, NULL);
} else {
- _globals->_sceneItems.addItems(&_hotspot17, &_hotspot20, NULL);
+ g_globals->_sceneItems.addItems(&_hotspot17, &_hotspot20, NULL);
}
- if (!_globals->getFlag(105)) {
+ if (!g_globals->getFlag(105)) {
_hotspot4.postInit();
_hotspot4.setVisage(5363);
_hotspot4.setPosition(Common::Point(1025, 65));
_hotspot4.setStrip(4);
_hotspot4.animate(ANIM_MODE_7, 0, NULL);;
- _globals->_sceneItems.push_back(&_hotspot4);
+ g_globals->_sceneItems.push_back(&_hotspot4);
_hotspot9.postInit();
_hotspot9.setVisage(5363);
_hotspot9.setPosition(Common::Point(966, 120));
- _globals->_sceneItems.push_back(&_hotspot9);
+ g_globals->_sceneItems.push_back(&_hotspot9);
_hotspot10.postInit();
_hotspot10.setVisage(5363);
@@ -1142,26 +1142,26 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
_hotspot6.setPosition(Common::Point(1017, 34));
_hotspot6._strip = 4;
_hotspot6._frame = _hotspot6.getFrameCount();
- _globals->_sceneItems.push_back(&_hotspot6);
+ g_globals->_sceneItems.push_back(&_hotspot6);
}
_hotspot16._sceneRegionId = 15;
- _globals->_sceneItems.push_back(&_hotspot16);
+ g_globals->_sceneItems.push_back(&_hotspot16);
- if (!_globals->getFlag(62)) {
+ if (!g_globals->getFlag(62)) {
_hotspot2.postInit();
_hotspot2.setVisage(5110);
_hotspot2.animate(ANIM_MODE_1, NULL);
_hotspot2._moveDiff.x = 4;
- _globals->_sceneItems.push_back(&_hotspot2);
+ g_globals->_sceneItems.push_back(&_hotspot2);
_hotspot3.postInit();
_hotspot3.setVisage(5110);
_hotspot3.animate(ANIM_MODE_1, NULL);
_hotspot3._moveDiff.x = 4;
- _globals->_sceneItems.push_back(&_hotspot3);
+ g_globals->_sceneItems.push_back(&_hotspot3);
- if (_globals->getFlag(61)) {
+ if (g_globals->getFlag(61)) {
_hotspot2.setPosition(Common::Point(483, 189));
_hotspot3.setPosition(Common::Point(811, 182));
} else {
@@ -1170,35 +1170,35 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
}
}
- if (_globals->getFlag(60) && (RING_INVENTORY._stasisBox._sceneNumber == 1) &&
- _globals->getFlag(107) && _globals->getFlag(67)) {
+ if (g_globals->getFlag(60) && (RING_INVENTORY._stasisBox._sceneNumber == 1) &&
+ g_globals->getFlag(107) && g_globals->getFlag(67)) {
_hotspot8.postInit();
_hotspot8.setVisage(2806);
_hotspot8.setPosition(Common::Point(557, 178));
_hotspot8.animate(ANIM_MODE_1, NULL);
_hotspot8.setObjectWrapper(new SceneObjectWrapper());
- _globals->clearFlag(59);
+ g_globals->clearFlag(59);
}
- switch (_globals->_sceneManager._previousScene) {
+ switch (g_globals->_sceneManager._previousScene) {
case 5000:
default:
- _globals->_player.setPosition(Common::Point(1184, 160));
+ g_globals->_player.setPosition(Common::Point(1184, 160));
setAction(&_action1);
break;
case 5200:
- if (_globals->_stripNum == 5200) {
- _globals->_player.setVisage(5101);
- _globals->_player.fixPriority(200);
- _globals->_player.setStrip(5);
- _globals->_player.setFrame(1);
- _globals->_player.setPosition(Common::Point(513, 199));
+ if (g_globals->_stripNum == 5200) {
+ g_globals->_player.setVisage(5101);
+ g_globals->_player.fixPriority(200);
+ g_globals->_player.setStrip(5);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.setPosition(Common::Point(513, 199));
_sceneMode = 5108;
- setAction(&_sequenceManager, this, 5108, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 5108, &g_globals->_player, NULL);
} else {
- _globals->_player.setPosition(Common::Point(20, 175));
+ g_globals->_player.setPosition(Common::Point(20, 175));
_hotspot13.postInit();
_hotspot13.setVisage(5110);
@@ -1213,7 +1213,7 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
_hotspot11.animate(ANIM_MODE_1, NULL);
ObjectMover2 *mover = new ObjectMover2();
- _hotspot11.addMover(mover, 15, 20, &_globals->_player);
+ _hotspot11.addMover(mover, 15, 20, &g_globals->_player);
_hotspot12.postInit();
_hotspot12.setVisage(5110);
@@ -1223,51 +1223,51 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
_hotspot12.animate(ANIM_MODE_1, NULL);
ObjectMover2 *mover2 = new ObjectMover2();
- _hotspot12.addMover(mover2, 25, 50, &_globals->_player);
+ _hotspot12.addMover(mover2, 25, 50, &g_globals->_player);
_hotspot17.setPosition(Common::Point(554, 182));
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 5105;
- setAction(&_sequenceManager, this, 5105, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 5105, &g_globals->_player, NULL);
}
break;
case 5300:
- switch (_globals->_stripNum) {
+ switch (g_globals->_stripNum) {
case 5300:
_sceneMode = 5111;
- _globals->_player.setVisage(5101);
- _globals->_player.setStrip(6);
- _globals->_player.fixPriority(170);
- _globals->_player.setPosition(Common::Point(1168, 110));
+ g_globals->_player.setVisage(5101);
+ g_globals->_player.setStrip(6);
+ g_globals->_player.fixPriority(170);
+ g_globals->_player.setPosition(Common::Point(1168, 110));
- setAction(&_sequenceManager, this, 5111, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 5111, &g_globals->_player, NULL);
_hotspot8.setPosition(Common::Point(1107, 178));
break;
case 5302:
- _globals->_player.setPosition(Common::Point(512, 190));
+ g_globals->_player.setPosition(Common::Point(512, 190));
- if (_globals->_sceneObjects->contains(&_hotspot8))
+ if (g_globals->_sceneObjects->contains(&_hotspot8))
setAction(&_action2);
else
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 5303:
_hotspot8.setVisage(5102);
_hotspot8.setPosition(Common::Point(533, 172));
- _globals->_player.setPosition(Common::Point(512, 190));
+ g_globals->_player.setPosition(Common::Point(512, 190));
setAction(&_action2);
break;
}
- if (_globals->getFlag(108)) {
+ if (g_globals->getFlag(108)) {
_hotspot6.postInit();
_hotspot6.setVisage(5362);
_hotspot6.setPosition(Common::Point(542, 19));
_hotspot6.setStrip(6);
_hotspot6.setFrame(1);
- _globals->_sceneItems.push_back(&_hotspot6);
+ g_globals->_sceneItems.push_back(&_hotspot6);
} else if (RING_INVENTORY._vial._sceneNumber != 5100) {
_hotspot6.postInit();
_hotspot6.setVisage(5362);
@@ -1275,13 +1275,13 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
_hotspot6.fixPriority(170);
_hotspot6.setStrip(6);
_hotspot6.setFrame(1);
- _globals->_sceneItems.push_back(&_hotspot6);
+ g_globals->_sceneItems.push_back(&_hotspot6);
}
break;
}
_hotspot18.setBounds(Rect(0, 0, 1280, 200));
- _globals->_sceneItems.push_back(&_hotspot18);
+ g_globals->_sceneItems.push_back(&_hotspot18);
_hotspot15.postInit();
_hotspot15.setVisage(5140);
@@ -1289,41 +1289,41 @@ void Scene5100::postInit(SceneObjectList *OwnerList) {
_hotspot15.setPosition(Common::Point(977, 173));
_hotspot15.fixPriority(1);
- _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position);
+ g_globals->_sceneManager._scene->_sceneBounds.center(g_globals->_player._position);
loadScene(5100);
- _globals->_soundHandler.play(205);
+ g_globals->_soundHandler.play(205);
}
void Scene5100::signal() {
switch (_sceneMode) {
case 5101:
case 5112:
- _globals->setFlag(67);
- _globals->_sceneManager.changeScene(5300);
+ g_globals->setFlag(67);
+ g_globals->_sceneManager.changeScene(5300);
break;
case 5102:
case 5114:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 5103:
- if (_globals->getFlag(61)) {
+ if (g_globals->getFlag(61)) {
SceneItem::display2(5100, 46);
- _globals->_sceneManager.changeScene(5300);
+ g_globals->_sceneManager.changeScene(5300);
} else {
SceneItem::display2(5100, 45);
- _globals->_sceneManager.changeScene(5200);
+ g_globals->_sceneManager.changeScene(5200);
}
break;
case 5105:
- _globals->_sceneManager.changeScene(5300);
+ g_globals->_sceneManager.changeScene(5300);
break;
case 5106:
- _globals->_stripNum = 5111;
- _globals->_sceneManager.changeScene(5200);
+ g_globals->_stripNum = 5111;
+ g_globals->_sceneManager.changeScene(5200);
break;
case 5108:
- if (!_globals->getFlag(60))
- _globals->_player.enableControl();
+ if (!g_globals->getFlag(60))
+ g_globals->_player.enableControl();
else if (RING_INVENTORY._stasisBox._sceneNumber == 1)
setAction(&_action2);
else
@@ -1331,78 +1331,78 @@ void Scene5100::signal() {
break;
case 5110:
SceneItem::display2(5100, 30);
- _globals->_player._angle = 325;
- _globals->_player.enableControl();
+ g_globals->_player._angle = 325;
+ g_globals->_player.enableControl();
break;
case 5111:
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setVisage(0);
- _globals->_player.setStrip(6);
- _globals->_player.fixPriority(-1);
- _globals->_player.animate(ANIM_MODE_1, NULL);
-
- if ((RING_INVENTORY._vial._sceneNumber != 5100) && !_globals->getFlag(108)) {
- _globals->setFlag(108);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setVisage(0);
+ g_globals->_player.setStrip(6);
+ g_globals->_player.fixPriority(-1);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+
+ if ((RING_INVENTORY._vial._sceneNumber != 5100) && !g_globals->getFlag(108)) {
+ g_globals->setFlag(108);
_sceneMode = 5130;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
- _speakerBatText.setTextPos(Common::Point(_globals->_sceneManager._scene->_sceneBounds.left + 20, 30));
- setAction(&_sequenceManager, this, 5130, &_globals->_player, &_hotspot6, NULL);
- } else if (_globals->_sceneObjects->contains(&_hotspot8)) {
+ _speakerBatText.setTextPos(Common::Point(g_globals->_sceneManager._scene->_sceneBounds.left + 20, 30));
+ setAction(&_sequenceManager, this, 5130, &g_globals->_player, &_hotspot6, NULL);
+ } else if (g_globals->_sceneObjects->contains(&_hotspot8)) {
setAction(&_action2);
} else {
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
}
break;
case 5116:
- _globals->setFlag(105);
+ g_globals->setFlag(105);
RING_INVENTORY._bone._sceneNumber = 0;
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setVisage(0);
- _globals->_player.setStrip(6);
- _globals->_player.fixPriority(-1);
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setVisage(0);
+ g_globals->_player.setStrip(6);
+ g_globals->_player.fixPriority(-1);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
// No break on purpose
case 5117:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 5130:
_hotspot6.setVisage(5362);
_hotspot6.setPosition(Common::Point(542, 25));
_hotspot6.setStrip(6);
_hotspot6.setFrame(1);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 5150:
- _globals->clearFlag(60);
- _globals->_sceneManager.changeScene(5300);
+ g_globals->clearFlag(60);
+ g_globals->_sceneManager.changeScene(5300);
break;
}
}
void Scene5100::dispatch() {
// Flesheater trap
- if (_hotspot15._bounds.contains(_globals->_player._position) && !_globals->_player._visage) {
- _globals->_player.disableControl();
- _globals->_player.addMover(NULL);
+ if (_hotspot15._bounds.contains(g_globals->_player._position) && !g_globals->_player._visage) {
+ g_globals->_player.disableControl();
+ g_globals->_player.addMover(NULL);
_soundHandler.play(207);
_sceneMode = 5103;
- setAction(&_sequenceManager, this, (_globals->_player._position.x >= 966) ? 5104 : 5103,
- &_globals->_player, &_hotspot15, NULL);
+ setAction(&_sequenceManager, this, (g_globals->_player._position.x >= 966) ? 5104 : 5103,
+ &g_globals->_player, &_hotspot15, NULL);
}
- if (_globals->getFlag(61) && !_globals->getFlag(62) &&
- ((_globals->_player._position.x - _hotspot2._position.x) < 160) &&
- (_globals->_sceneManager._previousScene != 5200) && (_sceneMode != 5150)) {
+ if (g_globals->getFlag(61) && !g_globals->getFlag(62) &&
+ ((g_globals->_player._position.x - _hotspot2._position.x) < 160) &&
+ (g_globals->_sceneManager._previousScene != 5200) && (_sceneMode != 5150)) {
setAction(NULL);
_sceneMode = 5150;
_soundHandler.play(208);
if (RING_INVENTORY._vial._sceneNumber == 5100) {
- _globals->_player.addMover(NULL);
- _globals->_player.disableControl();
+ g_globals->_player.addMover(NULL);
+ g_globals->_player.disableControl();
SceneItem::display2(5100, 39);
}
@@ -1410,28 +1410,28 @@ void Scene5100::dispatch() {
_hotspot3.setStrip2(2);
ObjectMover3 *mover1 = new ObjectMover3();
- _hotspot2.addMover(mover1, &_globals->_player, 20, this);
+ _hotspot2.addMover(mover1, &g_globals->_player, 20, this);
ObjectMover3 *mover2 = new ObjectMover3();
- _hotspot3.addMover(mover2, &_globals->_player, 20, this);
+ _hotspot3.addMover(mover2, &g_globals->_player, 20, this);
}
if (!_action) {
- if (((_globals->_player._position.x - _hotspot2._position.x) < 130) && !_globals->getFlag(61)) {
- _globals->_player._canWalk = false;
- _globals->_player.addMover(NULL);
+ if (((g_globals->_player._position.x - _hotspot2._position.x) < 130) && !g_globals->getFlag(61)) {
+ g_globals->_player._canWalk = false;
+ g_globals->_player.addMover(NULL);
Common::Point pt(20, 25);
PlayerMover2 *mover = new PlayerMover2();
- _hotspot3.addMover(mover, &pt, &_globals->_player);
+ _hotspot3.addMover(mover, &pt, &g_globals->_player);
setAction(&_action4);
}
- if ((_globals->_sceneManager._scene->_backgroundBounds.right - 85) <= _globals->_player._position.x)
- _globals->_sceneManager.changeScene(5000);
+ if ((g_globals->_sceneManager._scene->_backgroundBounds.right - 85) <= g_globals->_player._position.x)
+ g_globals->_sceneManager.changeScene(5000);
- if (_globals->_player.getRegionIndex() == 8) {
+ if (g_globals->_player.getRegionIndex() == 8) {
_sceneMode = 5114;
- setAction(&_sequenceManager, this, 5115, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 5115, &g_globals->_player, NULL);
}
}
@@ -1444,11 +1444,11 @@ void Scene5100::dispatch() {
*--------------------------------------------------------------------------*/
void Scene5200::Action1::signal() {
- Scene5200 *scene = (Scene5200 *)_globals->_sceneManager._scene;
+ Scene5200 *scene = (Scene5200 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- setDelay(_globals->_randomSource.getRandomNumber(59) + 120);
+ setDelay(g_globals->_randomSource.getRandomNumber(59) + 120);
break;
case 1:
scene->_hotspot3.animate(ANIM_MODE_8, 1, this);
@@ -1459,30 +1459,30 @@ void Scene5200::Action1::signal() {
void Scene5200::Action2::signal() {
// Quinn obtains the stasis box from the flesheater throne room
- Scene5200 *scene = (Scene5200 *)_globals->_sceneManager._scene;
+ Scene5200 *scene = (Scene5200 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
ADD_PLAYER_MOVER(92, 52);
break;
case 1:
- _globals->_player.setVisage(5202);
- _globals->_player._strip = 4;
- _globals->_player._frame = 1;
- _globals->_player.animate(ANIM_MODE_4, 3, 1, this);
+ g_globals->_player.setVisage(5202);
+ g_globals->_player._strip = 4;
+ g_globals->_player._frame = 1;
+ g_globals->_player.animate(ANIM_MODE_4, 3, 1, this);
break;
case 2:
scene->_soundHandler.stop();
scene->_hotspot14.remove();
RING_INVENTORY._stasisBox._sceneNumber = 1;
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 3:
- _globals->_player.setVisage(0);
- _globals->_player._strip = 3;
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setVisage(0);
+ g_globals->_player._strip = 3;
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
scene->_hotspot8.animate(ANIM_MODE_2, NULL);
ADD_MOVER(scene->_hotspot8, 141, 77);
@@ -1495,7 +1495,7 @@ void Scene5200::Action2::signal() {
scene->_hotspot8.animate(ANIM_MODE_5, this);
break;
case 5:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -1504,28 +1504,28 @@ void Scene5200::Action2::signal() {
void Scene5200::Action3::signal() {
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(5);
break;
case 1:
ADD_PLAYER_MOVER(285, 62);
break;
case 2:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene5200::Action4::signal() {
- Scene5200 *scene = (Scene5200 *)_globals->_sceneManager._scene;
+ Scene5200 *scene = (Scene5200 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(120);
break;
case 1:
- _globals->_soundHandler.play(209);
+ g_globals->_soundHandler.play(209);
scene->_stripManager.start(5202, this, scene);
break;
case 2:
@@ -1541,7 +1541,7 @@ void Scene5200::Action4::signal() {
setDelay(60);
break;
case 6:
- _globals->_sceneManager.changeScene(5100);
+ g_globals->_sceneManager.changeScene(5100);
break;
}
}
@@ -1584,7 +1584,7 @@ void Scene5200::Hotspot10::doAction(int action) {
}
void Scene5200::Hotspot14::doAction(int action) {
- Scene5200 *scene = (Scene5200 *)_globals->_sceneManager._scene;
+ Scene5200 *scene = (Scene5200 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -1638,33 +1638,33 @@ void Scene5200::postInit(SceneObjectList *OwnerList) {
_hotspot8._strip = 1;
_hotspot8.setPosition(Common::Point(96, 53));
_hotspot8.fixPriority(90);
- _globals->_sceneItems.push_back(&_hotspot14);
+ g_globals->_sceneItems.push_back(&_hotspot14);
}
- if (_globals->_stripNum == 5111) {
+ if (g_globals->_stripNum == 5111) {
// Happens when the player enters the throne room via the secret passage,
// after talking with the bat. No NPCs are around and the player can
// obtain the stasis box.
- _globals->_soundHandler.play(205);
- _globals->_player.disableControl();
-
- _globals->_player.postInit();
- _globals->_player.setVisage(0);
- _globals->_player.changeZoom(75);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setStrip(1);
- _globals->_player.setFrame(3);
- _globals->_player.setPosition(Common::Point(307, 62));
+ g_globals->_soundHandler.play(205);
+ g_globals->_player.disableControl();
+
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(0);
+ g_globals->_player.changeZoom(75);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setStrip(1);
+ g_globals->_player.setFrame(3);
+ g_globals->_player.setPosition(Common::Point(307, 62));
setAction(&_action3);
} else {
// Happens when the player is captured by the flesh eaters the first time.
- _globals->_player.postInit();
- _globals->_player.setVisage(2640);
- _globals->_player._strip = 1;
- _globals->_player._frame = 4;
- _globals->_player.setPosition(Common::Point(105, 199));
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(2640);
+ g_globals->_player._strip = 1;
+ g_globals->_player._frame = 4;
+ g_globals->_player.setPosition(Common::Point(105, 199));
_hotspot5.postInit();
_hotspot5.setVisage(5210);
@@ -1708,8 +1708,8 @@ void Scene5200::postInit(SceneObjectList *OwnerList) {
_hotspot4.setPosition(Common::Point(146, 110));
_hotspot4.fixPriority(90);
- _globals->_player.disableControl();
- _globals->setFlag(61);
+ g_globals->_player.disableControl();
+ g_globals->setFlag(61);
setAction(&_action4);
}
@@ -1720,8 +1720,8 @@ void Scene5200::postInit(SceneObjectList *OwnerList) {
_hotspot12._sceneRegionId = 10;
_hotspot13._sceneRegionId = 8;
- _globals->_sceneItems.addItems(&_hotspot12, &_hotspot13, &_hotspot9, &_hotspot10, &_hotspot11, NULL);
- _globals->_sceneManager._scene->_sceneBounds.center(_globals->_player._position);
+ g_globals->_sceneItems.addItems(&_hotspot12, &_hotspot13, &_hotspot9, &_hotspot10, &_hotspot11, NULL);
+ g_globals->_sceneManager._scene->_sceneBounds.center(g_globals->_player._position);
loadScene(5200);
}
@@ -1739,9 +1739,9 @@ void Scene5200::stripCallback(int v) {
void Scene5200::dispatch() {
Scene::dispatch();
- if (!_action && (_globals->_player.getRegionIndex() == 12)) {
- _globals->_stripNum = 5200;
- _globals->_sceneManager.changeScene(5100);
+ if (!_action && (g_globals->_player.getRegionIndex() == 12)) {
+ g_globals->_stripNum = 5200;
+ g_globals->_sceneManager.changeScene(5100);
}
}
@@ -1752,11 +1752,11 @@ void Scene5200::dispatch() {
void Scene5300::Action1::signal() {
// Seeker waking up
- Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene;
+ Scene5300 *scene = (Scene5300 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(3);
break;
case 1:
@@ -1767,30 +1767,30 @@ void Scene5300::Action1::signal() {
case 2:
scene->_hotspot2.animate(ANIM_MODE_NONE, NULL);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setStrip2(-1);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- ADD_MOVER(_globals->_player, 85, 170);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setStrip2(-1);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ ADD_MOVER(g_globals->_player, 85, 170);
break;
case 3:
scene->_hotspot2.fixPriority(-1);
- _globals->_player.checkAngle(&scene->_hotspot2);
+ g_globals->_player.checkAngle(&scene->_hotspot2);
setAction(&scene->_sequenceManager, this, 5305, &scene->_hotspot2, NULL);
break;
case 4:
scene->_stripManager.start(5316, this);
break;
case 5:
- if (!_globals->getFlag(106) || !_globals->getFlag(107) || (RING_INVENTORY._stasisBox._sceneNumber != 1)) {
- _globals->_player.enableControl();
+ if (!g_globals->getFlag(106) || !g_globals->getFlag(107) || (RING_INVENTORY._stasisBox._sceneNumber != 1)) {
+ g_globals->_player.enableControl();
remove();
} else {
- _globals->setFlag(60);
+ g_globals->setFlag(60);
scene->_hotspot2._numFrames = 10;
- if (_globals->getFlag(67)) {
+ if (g_globals->getFlag(67)) {
scene->_sceneMode = 5310;
- scene->setAction(&scene->_sequenceManager, scene, 5310, &_globals->_player, &scene->_hotspot2, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 5310, &g_globals->_player, &scene->_hotspot2, NULL);
} else {
scene->_sceneMode = 5347;
scene->setAction(&scene->_sequenceManager, scene, 5347, NULL);
@@ -1801,46 +1801,46 @@ void Scene5300::Action1::signal() {
}
void Scene5300::Action2::signal() {
- Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene;
+ Scene5300 *scene = (Scene5300 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(60);
break;
case 1:
- _globals->setFlag(60);
+ g_globals->setFlag(60);
scene->_stripManager.start(5328, this);
break;
case 2:
if (RING_INVENTORY._stasisBox._sceneNumber == 1) {
- _globals->_stripNum = 5303;
+ g_globals->_stripNum = 5303;
setDelay(5);
} else {
- _globals->_stripNum = 5302;
+ g_globals->_stripNum = 5302;
scene->_stripManager.start(5329, this);
}
break;
case 3:
- _globals->_sceneManager.changeScene(5100);
+ g_globals->_sceneManager.changeScene(5100);
remove();
break;
}
}
void Scene5300::Action3::signal() {
- Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene;
+ Scene5300 *scene = (Scene5300 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(30);
break;
case 1:
- scene->_stripManager.start(_globals->_stripNum, this);
+ scene->_stripManager.start(g_globals->_stripNum, this);
break;
case 2:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -1849,14 +1849,14 @@ void Scene5300::Action3::signal() {
/*--------------------------------------------------------------------------*/
void Scene5300::Hotspot1::doAction(int action) {
- Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene;
+ Scene5300 *scene = (Scene5300 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(5300, 24);
break;
case CURSOR_TALK:
- _globals->_stripNum = 5312;
+ g_globals->_stripNum = 5312;
scene->setAction(&scene->_action3);
break;
default:
@@ -1866,37 +1866,37 @@ void Scene5300::Hotspot1::doAction(int action) {
}
void Scene5300::Hotspot2::doAction(int action) {
// Seeker
- Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene;
+ Scene5300 *scene = (Scene5300 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(5300, 23);
break;
case CURSOR_USE:
- if (!_globals->getFlag(106)) {
- _globals->_player.disableControl();
+ if (!g_globals->getFlag(106)) {
+ g_globals->_player.disableControl();
scene->_sceneMode = 5302;
- scene->setAction(&scene->_sequenceManager, scene, 5302, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 5302, &g_globals->_player, NULL);
} else {
- SceneItem::display2(5300, _globals->getFlag(107) ? 25 : 20);
+ SceneItem::display2(5300, g_globals->getFlag(107) ? 25 : 20);
}
break;
case CURSOR_TALK:
- if (!_globals->getFlag(106)) {
- _globals->_player.disableControl();
+ if (!g_globals->getFlag(106)) {
+ g_globals->_player.disableControl();
scene->_sceneMode = 5302;
- scene->setAction(&scene->_sequenceManager, scene, 5302, &_globals->_player, NULL);
- } else if (!_globals->getFlag(107)) {
+ scene->setAction(&scene->_sequenceManager, scene, 5302, &g_globals->_player, NULL);
+ } else if (!g_globals->getFlag(107)) {
SceneItem::display2(5300, 11);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
if (RING_INVENTORY._stasisBox._sceneNumber != 1) {
scene->_sceneMode = 5316;
scene->setAction(&scene->_sequenceManager, scene, 5316, NULL);
} else {
- _globals->setFlag(60);
- if (_globals->getFlag(67)) {
+ g_globals->setFlag(60);
+ if (g_globals->getFlag(67)) {
scene->_sceneMode = 5315;
scene->setAction(&scene->_sequenceManager, scene, 5315, this, NULL);
} else {
@@ -1907,29 +1907,29 @@ void Scene5300::Hotspot2::doAction(int action) {
}
break;
case OBJECT_SCANNER:
- SceneItem::display2(5300, _globals->getFlag(107) ? 10 : 9);
+ SceneItem::display2(5300, g_globals->getFlag(107) ? 10 : 9);
break;
case OBJECT_MEDKIT:
- if (_globals->getFlag(106))
+ if (g_globals->getFlag(106))
SceneItem::display2(5300, 7);
else {
- _globals->setFlag(106);
- _globals->_player.disableControl();
+ g_globals->setFlag(106);
+ g_globals->_player.disableControl();
scene->_sceneMode = 5303;
- scene->setAction(&scene->_sequenceManager, scene, 5303, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 5303, &g_globals->_player, NULL);
}
break;
case OBJECT_VIAL:
- if (_globals->getFlag(107)) {
+ if (g_globals->getFlag(107)) {
SceneItem::display2(5300, 8);
} else {
RING_INVENTORY._vial._sceneNumber = 5300;
- _globals->setFlag(107);
- _globals->_player.disableControl();
+ g_globals->setFlag(107);
+ g_globals->_player.disableControl();
scene->_sceneMode = 5304;
- scene->setAction(&scene->_sequenceManager, scene, 5304, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 5304, &g_globals->_player, NULL);
}
break;
default:
@@ -1940,7 +1940,7 @@ void Scene5300::Hotspot2::doAction(int action) {
void Scene5300::Hotspot5::doAction(int action) {
// Sharp bone
- Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene;
+ Scene5300 *scene = (Scene5300 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -1948,10 +1948,10 @@ void Scene5300::Hotspot5::doAction(int action) {
break;
case CURSOR_USE:
RING_INVENTORY._bone._sceneNumber = 1;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 5309;
- scene->setAction(&scene->_sequenceManager, scene, 5309, &_globals->_player, this, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 5309, &g_globals->_player, this, NULL);
break;
default:
SceneHotspot::doAction(action);
@@ -1961,26 +1961,26 @@ void Scene5300::Hotspot5::doAction(int action) {
void Scene5300::Hotspot6::doAction(int action) {
// Left Hole
- Scene5300 *scene = (Scene5300 *)_globals->_sceneManager._scene;
+ Scene5300 *scene = (Scene5300 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
- if (!_globals->getFlag(105) || (RING_INVENTORY._vial._sceneNumber == 1))
+ if (!g_globals->getFlag(105) || (RING_INVENTORY._vial._sceneNumber == 1))
SceneItem::display2(5300, 4);
else
SceneItem::display2(5300, 26);
break;
case CURSOR_USE:
- if (!_globals->getFlag(105) || (RING_INVENTORY._vial._sceneNumber != 5100)) {
- _globals->_player.disableControl();
+ if (!g_globals->getFlag(105) || (RING_INVENTORY._vial._sceneNumber != 5100)) {
+ g_globals->_player.disableControl();
scene->_sceneMode = 5301;
- scene->setAction(&scene->_sequenceManager, scene, 5301, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 5301, &g_globals->_player, NULL);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 5307;
RING_INVENTORY._vial._sceneNumber = 1;
- scene->setAction(&scene->_sequenceManager, scene, 5307, &scene->_hotspot1, &_globals->_player,
+ scene->setAction(&scene->_sequenceManager, scene, 5307, &scene->_hotspot1, &g_globals->_player,
&scene->_hotspot4, NULL);
}
break;
@@ -1993,19 +1993,19 @@ void Scene5300::Hotspot6::doAction(int action) {
void Scene5300::Hotspot7::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(63))
+ if (g_globals->getFlag(63))
SceneItem::display2(5300, 2);
else {
- _globals->setFlag(63);
+ g_globals->setFlag(63);
SceneItem::display2(5300, 0);
SceneItem::display2(5300, 1);
}
break;
case CURSOR_USE:
- if (_globals->getFlag(64))
+ if (g_globals->getFlag(64))
SceneItem::display2(5300, 15);
else {
- _globals->setFlag(64);
+ g_globals->setFlag(64);
SceneItem::display2(5300, 14);
}
break;
@@ -2018,7 +2018,7 @@ void Scene5300::Hotspot7::doAction(int action) {
void Scene5300::Hotspot8::doAction(int action) {
switch (action) {
case CURSOR_LOOK:
- SceneItem::display2(5300, _globals->getFlag(65) ? 6 : 5);
+ SceneItem::display2(5300, g_globals->getFlag(65) ? 6 : 5);
break;
case CURSOR_USE:
SceneItem::display2(5300, 18);
@@ -2050,7 +2050,7 @@ void Scene5300::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerSText);
_stripManager.addSpeaker(&_speakerGameText);
- if (_globals->getFlag(106) && _globals->getFlag(107)) {
+ if (g_globals->getFlag(106) && g_globals->getFlag(107)) {
_hotspot2.postInit();
_hotspot2.setVisage(2806);
_hotspot2.setObjectWrapper(new SceneObjectWrapper());
@@ -2077,13 +2077,13 @@ void Scene5300::postInit(SceneObjectList *OwnerList) {
_hotspot4.animate(ANIM_MODE_2, NULL);
_hotspot4.hide();
- if (_globals->getFlag(67)) {
- _globals->_player.postInit();
- _globals->_player.setVisage(5316);
- _globals->_player.setPosition(Common::Point(191, 27));
- _globals->_player.disableControl();
+ if (g_globals->getFlag(67)) {
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(5316);
+ g_globals->_player.setPosition(Common::Point(191, 27));
+ g_globals->_player.disableControl();
- if (_globals->getFlag(107) && _globals->getFlag(106)) {
+ if (g_globals->getFlag(107) && g_globals->getFlag(106)) {
_hotspot2.setVisage(2806);
_hotspot2.postInit();
_hotspot2.setObjectWrapper(new SceneObjectWrapper());
@@ -2091,14 +2091,14 @@ void Scene5300::postInit(SceneObjectList *OwnerList) {
setAction(&_action2);
} else {
- _globals->_player.setVisage(5315);
- _globals->_player.setPosition(Common::Point(204, 86));
- _globals->_player.animate(ANIM_MODE_2, NULL);
- _globals->_player.setStrip2(1);
- _globals->_player._moveDiff.y = 12;
+ g_globals->_player.setVisage(5315);
+ g_globals->_player.setPosition(Common::Point(204, 86));
+ g_globals->_player.animate(ANIM_MODE_2, NULL);
+ g_globals->_player.setStrip2(1);
+ g_globals->_player._moveDiff.y = 12;
_sceneMode = 5308;
- setAction(&_sequenceManager, this, 5308, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 5308, &g_globals->_player, NULL);
}
} else {
_hotspot3.postInit();
@@ -2107,16 +2107,16 @@ void Scene5300::postInit(SceneObjectList *OwnerList) {
_hotspot3.fixPriority(1);
_hotspot3.animate(ANIM_MODE_NONE, NULL);
- _globals->_player.postInit();
- _globals->_player.setVisage(5315);
- _globals->_player.setPosition(Common::Point(204, 86));
- _globals->_player.animate(ANIM_MODE_2, NULL);
- _globals->_player.setStrip2(1);
- _globals->_player._moveDiff.y = 12;
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(5315);
+ g_globals->_player.setPosition(Common::Point(204, 86));
+ g_globals->_player.animate(ANIM_MODE_2, NULL);
+ g_globals->_player.setStrip2(1);
+ g_globals->_player._moveDiff.y = 12;
+ g_globals->_player.disableControl();
_sceneMode = 5306;
- setAction(&_sequenceManager, this, 5306, &_globals->_player, &_hotspot3, NULL);
+ setAction(&_sequenceManager, this, 5306, &g_globals->_player, &_hotspot3, NULL);
}
_field1B0A = 1;
@@ -2125,22 +2125,22 @@ void Scene5300::postInit(SceneObjectList *OwnerList) {
_hotspot5.setVisage(5301);
_hotspot5.setStrip(2);
_hotspot5.setPosition(Common::Point(190, 147));
- _globals->_sceneItems.push_back(&_hotspot5);
+ g_globals->_sceneItems.push_back(&_hotspot5);
}
_hotspot6.setBounds(Rect(74, 51, 114, 69));
_hotspot7.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
_hotspot8._sceneRegionId = 8;
- _globals->_sceneItems.addItems(&_hotspot8, &_hotspot2, &_hotspot6, &_hotspot3, &_hotspot7, NULL);
- _globals->_soundHandler.play(212);
+ g_globals->_sceneItems.addItems(&_hotspot8, &_hotspot2, &_hotspot6, &_hotspot3, &_hotspot7, NULL);
+ g_globals->_soundHandler.play(212);
}
void Scene5300::signal() {
switch (_sceneMode) {
case 5301:
- _globals->_stripNum = 5300;
- _globals->_sceneManager.changeScene(5100);
+ g_globals->_stripNum = 5300;
+ g_globals->_sceneManager.changeScene(5100);
break;
case 5307:
_soundHandler.fadeOut(NULL);
@@ -2149,31 +2149,31 @@ void Scene5300::signal() {
case 5308:
case 5316:
case 5347:
- _globals->_player.setStrip2(-1);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.enableControl();
+ g_globals->_player.setStrip2(-1);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.enableControl();
break;
case 5303:
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.enableControl();
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.enableControl();
- if (_globals->getFlag(107))
+ if (g_globals->getFlag(107))
setAction(&_action1);
else
SceneItem::display2(5300, 28);
break;
case 5304:
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.enableControl();
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.enableControl();
- if (_globals->getFlag(106))
+ if (g_globals->getFlag(106))
setAction(&_action1);
else
SceneItem::display2(5300, 28);
break;
case 5306:
- _globals->clearFlag(67);
- _globals->_player.setStrip2(-1);
+ g_globals->clearFlag(67);
+ g_globals->_player.setStrip2(-1);
if ((RING_INVENTORY._vial._sceneNumber == 1) || (RING_INVENTORY._vial._sceneNumber == 5300))
_stripManager.start(5303, this);
@@ -2183,7 +2183,7 @@ void Scene5300::signal() {
break;
case 5309:
_hotspot5.remove();
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 5310:
_hotspot2.fixPriority(41);
@@ -2192,8 +2192,8 @@ void Scene5300::signal() {
setAction(&_sequenceManager, this, 5315, &_hotspot2, NULL);
break;
case 5315:
- _globals->_stripNum = 5302;
- _globals->_sceneManager.changeScene(5100);
+ g_globals->_stripNum = 5302;
+ g_globals->_sceneManager.changeScene(5100);
break;
}
}
diff --git a/engines/tsage/ringworld/ringworld_scenes6.h b/engines/tsage/ringworld/ringworld_scenes6.h
index 79e604a177..bf353de415 100644
--- a/engines/tsage/ringworld/ringworld_scenes6.h
+++ b/engines/tsage/ringworld/ringworld_scenes6.h
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
#include "tsage/ringworld/ringworld_logic.h"
+#include "tsage/ringworld/ringworld_speakers.h"
#include "tsage/events.h"
#include "tsage/core.h"
#include "tsage/scenes.h"
diff --git a/engines/tsage/ringworld/ringworld_scenes8.cpp b/engines/tsage/ringworld/ringworld_scenes8.cpp
index 5f1ff5cdca..f8fb8b01e7 100644
--- a/engines/tsage/ringworld/ringworld_scenes8.cpp
+++ b/engines/tsage/ringworld/ringworld_scenes8.cpp
@@ -51,11 +51,11 @@ void SceneObject7700::synchronize(Serializer &s) {
void Scene7000::Action1::signal() {
// Quinn walks from the lander to the seaside (action6) then discuss with Skeenar
- Scene7000 *scene = (Scene7000 *)_globals->_sceneManager._scene;
+ Scene7000 *scene = (Scene7000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(3);
break;
case 1:
@@ -69,7 +69,7 @@ void Scene7000::Action1::signal() {
scene->_object1.animate(ANIM_MODE_5, this);
scene->_object1.setPosition(Common::Point(151, 182));
scene->_object1.fixPriority(205);
- _globals->_sceneItems.push_front(&scene->_object1);
+ g_globals->_sceneItems.push_front(&scene->_object1);
break;
case 3:
scene->_object1._numFrames = 4;
@@ -82,7 +82,7 @@ void Scene7000::Action1::signal() {
setDelay(3);
break;
case 5:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -91,25 +91,25 @@ void Scene7000::Action1::signal() {
/*--------------------------------------------------------------------------*/
void Scene7000::Action2::signal() {
- Scene7000 *scene = (Scene7000 *)_globals->_sceneManager._scene;
+ Scene7000 *scene = (Scene7000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(3);
break;
case 1:
- _globals->_player.addMover(NULL);
- _globals->_player.setVisage(7006);
- _globals->_player.setStrip(1);
- _globals->_player.setFrame(1);
- _globals->_player.setPosition(Common::Point(_globals->_player._position.x, _globals->_player._position.y + 13));
- _globals->_player.changeZoom(68);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.addMover(NULL);
+ g_globals->_player.setVisage(7006);
+ g_globals->_player.setStrip(1);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.setPosition(Common::Point(g_globals->_player._position.x, g_globals->_player._position.y + 13));
+ g_globals->_player.changeZoom(68);
+ g_globals->_player.animate(ANIM_MODE_5, this);
scene->_object1.remove();
break;
case 2:
- _globals->_sceneManager.changeScene(7100);
+ g_globals->_sceneManager.changeScene(7100);
remove();
break;
}
@@ -118,7 +118,7 @@ void Scene7000::Action2::signal() {
/*--------------------------------------------------------------------------*/
void Scene7000::Action3::dispatch() {
- Scene7000 *scene = (Scene7000 *)_globals->_sceneManager._scene;
+ Scene7000 *scene = (Scene7000 *)g_globals->_sceneManager._scene;
Action::dispatch();
if (_actionIndex == 4)
@@ -129,7 +129,7 @@ void Scene7000::Action3::dispatch() {
void Scene7000::Action3::signal() {
// Lander is landing
- Scene7000 *scene = (Scene7000 *)_globals->_sceneManager._scene;
+ Scene7000 *scene = (Scene7000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -165,7 +165,7 @@ void Scene7000::Action3::signal() {
}
case 4:
scene->_object4.remove();
- _globals->_sceneManager.changeScene(2100);
+ g_globals->_sceneManager.changeScene(2100);
remove();
break;
}
@@ -174,11 +174,11 @@ void Scene7000::Action3::signal() {
/*--------------------------------------------------------------------------*/
void Scene7000::Action4::signal() {
- Scene7000 *scene = (Scene7000 *)_globals->_sceneManager._scene;
+ Scene7000 *scene = (Scene7000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_object1.animate(ANIM_MODE_6, this);
break;
case 1:
@@ -186,7 +186,7 @@ void Scene7000::Action4::signal() {
setDelay(300);
break;
case 2:
- _globals->_soundHandler.play(252);
+ g_globals->_soundHandler.play(252);
scene->_object1.show();
scene->_object1.setStrip(3);
scene->_object1.setFrame(1);
@@ -195,8 +195,8 @@ void Scene7000::Action4::signal() {
case 3:
scene->_object1.setStrip(4);
scene->_object1.animate(ANIM_MODE_8, 0, NULL);
- _globals->setFlag(81);
- _globals->_player.enableControl();
+ g_globals->setFlag(81);
+ g_globals->_player.enableControl();
remove();
break;
}
@@ -205,18 +205,18 @@ void Scene7000::Action4::signal() {
/*--------------------------------------------------------------------------*/
void Scene7000::Action5::signal() {
- Scene7000 *scene = (Scene7000 *)_globals->_sceneManager._scene;
+ Scene7000 *scene = (Scene7000 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0: {
NpcMover *playerMover = new NpcMover();
Common::Point pt(88, 121);
- _globals->_player.addMover(playerMover, &pt, this);
+ g_globals->_player.addMover(playerMover, &pt, this);
break;
}
case 1:
- _globals->_player.checkAngle(&scene->_object1);
- _globals->_soundHandler.play(252);
+ g_globals->_player.checkAngle(&scene->_object1);
+ g_globals->_soundHandler.play(252);
scene->_object1.setStrip(2);
scene->_stripManager.start(7015, this);
break;
@@ -229,34 +229,34 @@ void Scene7000::Action5::signal() {
scene->_object1.remove();
NpcMover *mover = new NpcMover();
Common::Point pt(31, 94);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 4: {
NpcMover *mover = new NpcMover();
Common::Point pt(11, 94);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 5: {
- _globals->_player.fixPriority(10);
+ g_globals->_player.fixPriority(10);
NpcMover *mover = new NpcMover();
Common::Point pt(11, 89);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 6: {
NpcMover *mover = new NpcMover();
Common::Point pt(41, 89);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 7:
- _globals->clearFlag(36);
- _globals->clearFlag(37);
- _globals->clearFlag(72);
- _globals->clearFlag(13);
- _globals->_sceneManager.changeScene(2100);
+ g_globals->clearFlag(36);
+ g_globals->clearFlag(37);
+ g_globals->clearFlag(72);
+ g_globals->clearFlag(13);
+ g_globals->_sceneManager.changeScene(2100);
break;
}
}
@@ -267,43 +267,43 @@ void Scene7000::Action6::signal() {
// Quinn walks from the lander to the seaside
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(3);
break;
case 1: {
NpcMover *mover = new NpcMover();
Common::Point pt(12, 91);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2: {
NpcMover *mover = new NpcMover();
Common::Point pt(8, 91);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 3: {
NpcMover *mover = new NpcMover();
Common::Point pt(31, 96);
- _globals->_player.addMover(mover, &pt, this);
- _globals->_player.fixPriority(-1);
+ g_globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.fixPriority(-1);
break;
}
case 4: {
NpcMover *mover = new NpcMover();
Common::Point pt(83, 117);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 5: {
NpcMover *mover = new NpcMover();
Common::Point pt(95, 121);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 6:
- _globals->_player.setStrip(3);
- _globals->_player.setFrame(1);
+ g_globals->_player.setStrip(3);
+ g_globals->_player.setFrame(1);
remove();
break;
}
@@ -314,7 +314,7 @@ void Scene7000::Action6::signal() {
void Scene7000::Action7::signal() {
switch (_actionIndex++) {
case 0:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
setDelay(3);
break;
case 1:
@@ -323,33 +323,33 @@ void Scene7000::Action7::signal() {
case 2: {
NpcMover *mover = new NpcMover();
Common::Point pt(31, 94);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 3: {
NpcMover *mover = new NpcMover();
Common::Point pt(11, 94);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 4: {
- _globals->_player.fixPriority(10);
+ g_globals->_player.fixPriority(10);
NpcMover *mover = new NpcMover();
Common::Point pt(11, 89);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 5: {
NpcMover *mover = new NpcMover();
Common::Point pt(41, 89);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 6:
- if (_globals->getFlag(13))
- _globals->_sceneManager.changeScene(2280);
+ if (g_globals->getFlag(13))
+ g_globals->_sceneManager.changeScene(2280);
else
- _globals->_sceneManager.changeScene(2320);
+ g_globals->_sceneManager.changeScene(2320);
break;
}
}
@@ -367,84 +367,84 @@ void Scene7000::Hotspot1::doAction(int action) {
void Scene7000::Object1::doAction(int action) {
// Skeenar
- Scene7000 *scene = (Scene7000 *)_globals->_sceneManager._scene;
+ Scene7000 *scene = (Scene7000 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_TRANSLATOR:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
RING_INVENTORY._translator._sceneNumber = 7000;
if ((RING_INVENTORY._waldos._sceneNumber != 7000) && (RING_INVENTORY._jar._sceneNumber != 7000)) {
scene->_sceneMode = 7004;
- scene->setAction(&scene->_sequenceManager, scene, 7004, &_globals->_player, this, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7004, &g_globals->_player, this, NULL);
} else if (RING_INVENTORY._waldos._sceneNumber != 7000) {
scene->_sceneMode = 7011;
- scene->setAction(&scene->_sequenceManager, scene, 7010, &_globals->_player, &scene->_object1, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7010, &g_globals->_player, &scene->_object1, NULL);
} else if (RING_INVENTORY._jar._sceneNumber != 7000) {
scene->_sceneMode = 7012;
- scene->setAction(&scene->_sequenceManager, scene, 7010, &_globals->_player, &scene->_object1, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7010, &g_globals->_player, &scene->_object1, NULL);
} else {
scene->_sceneMode = 7015;
- scene->setAction(&scene->_sequenceManager, scene, 7017, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7017, &g_globals->_player, NULL);
}
break;
case OBJECT_WALDOS:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
RING_INVENTORY._waldos._sceneNumber = 7000;
if (RING_INVENTORY._translator._sceneNumber == 7000) {
if (RING_INVENTORY._jar._sceneNumber == 7000) {
scene->_sceneMode = 7015;
- scene->setAction(&scene->_sequenceManager, scene, 7015, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7015, &g_globals->_player, NULL);
} else {
scene->_sceneMode = 7006;
- scene->setAction(&scene->_sequenceManager, scene, 7006, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7006, &g_globals->_player, NULL);
}
} else {
scene->_sceneMode = 7009;
- scene->setAction(&scene->_sequenceManager, scene, 7009, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7009, &g_globals->_player, NULL);
}
break;
case OBJECT_JAR:
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
RING_INVENTORY._jar._sceneNumber = 7000;
if (RING_INVENTORY._translator._sceneNumber == 7000) {
if (RING_INVENTORY._waldos._sceneNumber != 7000) {
scene->_sceneMode = 7007;
- scene->setAction(&scene->_sequenceManager, scene, 7007, &_globals->_player, &scene->_object1, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7007, &g_globals->_player, &scene->_object1, NULL);
} else {
scene->_sceneMode = 7015;
- scene->setAction(&scene->_sequenceManager, scene, 7016, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7016, &g_globals->_player, NULL);
}
} else {
scene->_sceneMode = 7008;
- scene->setAction(&scene->_sequenceManager, scene, 7008, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7008, &g_globals->_player, NULL);
}
break;
case CURSOR_LOOK:
- if (_globals->getFlag(81))
+ if (g_globals->getFlag(81))
SceneItem::display2(7000, 1);
else
SceneItem::display2(7000, 0);
break;
case CURSOR_USE:
- if (_globals->getFlag(81)) {
+ if (g_globals->getFlag(81)) {
RING_INVENTORY._stasisBox2._sceneNumber = 1;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action5);
} else {
SceneItem::display2(7000, 5);
}
break;
case CURSOR_TALK:
- if (_globals->getFlag(81)) {
+ if (g_globals->getFlag(81)) {
RING_INVENTORY._stasisBox2._sceneNumber = 1;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action5);
- } else if (_globals->getFlag(52)) {
+ } else if (g_globals->getFlag(52)) {
scene->_sceneMode = 7005;
scene->setAction(&scene->_sequenceManager, scene, 7013, NULL);
- } else if (_globals->getFlag(13)) {
+ } else if (g_globals->getFlag(13)) {
scene->_sceneMode = 7002;
scene->setAction(&scene->_sequenceManager, scene, 7014, NULL);
} else {
@@ -461,25 +461,25 @@ void Scene7000::Object1::doAction(int action) {
/*--------------------------------------------------------------------------*/
void Scene7000::dispatch() {
- Scene7000 *scene = (Scene7000 *)_globals->_sceneManager._scene;
+ Scene7000 *scene = (Scene7000 *)g_globals->_sceneManager._scene;
if (!_action) {
- if (_globals->_sceneRegions.indexOf(_globals->_player._position) == 8) {
- if (!_globals->getFlag(13)) {
- _globals->_player.disableControl();
- _globals->_player.addMover(NULL);
+ if (g_globals->_sceneRegions.indexOf(g_globals->_player._position) == 8) {
+ if (!g_globals->getFlag(13)) {
+ g_globals->_player.disableControl();
+ g_globals->_player.addMover(NULL);
SceneItem::display2(7000, 3);
_sceneMode = 7001;
- setAction(&scene->_sequenceManager, this, 7001, &_globals->_player, NULL);
- } else if (!_globals->getFlag(52)) {
+ setAction(&scene->_sequenceManager, this, 7001, &g_globals->_player, NULL);
+ } else if (!g_globals->getFlag(52)) {
setAction(&_action2);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
_sceneMode = 7003;
- setAction(&scene->_sequenceManager, this, 7003, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager, this, 7003, &g_globals->_player, NULL);
}
}
- if (_globals->_sceneRegions.indexOf(_globals->_player._position) == 9)
+ if (g_globals->_sceneRegions.indexOf(g_globals->_player._position) == 9)
scene->setAction(&scene->_action7);
}
Scene::dispatch();
@@ -498,7 +498,7 @@ void Scene7000::postInit(SceneObjectList *OwnerList) {
_stripManager.addSpeaker(&_speakerQR);
_speakerSKText._npc = &_object1;
- _speakerQText._npc = &_globals->_player;
+ _speakerQText._npc = &g_globals->_player;
_object5.postInit();
_object5.setVisage(7001);
@@ -528,7 +528,7 @@ void Scene7000::postInit(SceneObjectList *OwnerList) {
_object8.setPosition(Common::Point(176, 175));
_object8.fixPriority(1);
- if (_globals->getFlag(72)) {
+ if (g_globals->getFlag(72)) {
_object3.postInit();
_object3.setVisage(5001);
_object3.setStrip2(1);
@@ -538,7 +538,7 @@ void Scene7000::postInit(SceneObjectList *OwnerList) {
_object1.postInit();
_object1.setVisage(7003);
- if (_globals->getFlag(81))
+ if (g_globals->getFlag(81))
_object1.setStrip(4);
else
_object1.setStrip(2);
@@ -546,20 +546,20 @@ void Scene7000::postInit(SceneObjectList *OwnerList) {
_object1._numFrames = 4;
_object1.changeZoom(45);
_object1.animate(ANIM_MODE_8, 0, NULL);
- _globals->_sceneItems.push_back(&_object1);
+ g_globals->_sceneItems.push_back(&_object1);
}
_soundHandler.play(251);
- if (_globals->_sceneManager._previousScene == 2100) {
- if (_globals->getFlag(72)) {
- _globals->_player.postInit();
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ if (g_globals->_sceneManager._previousScene == 2100) {
+ if (g_globals->getFlag(72)) {
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
SceneObjectWrapper *wrapper = new SceneObjectWrapper();
- _globals->_player.setObjectWrapper(wrapper);
- _globals->_player.setPosition(Common::Point(57, 94));
- _globals->_player.changeZoom(-1);
- _globals->_player.fixPriority(10);
- if (_globals->getFlag(81)) {
+ g_globals->_player.setObjectWrapper(wrapper);
+ g_globals->_player.setPosition(Common::Point(57, 94));
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player.fixPriority(10);
+ if (g_globals->getFlag(81)) {
setAction(&_action4);
} else {
_object1.setPosition(Common::Point(151, 182));
@@ -567,8 +567,8 @@ void Scene7000::postInit(SceneObjectList *OwnerList) {
setAction(&_action1);
}
} else {
- _globals->_soundHandler.play(250);
- _globals->setFlag(72);
+ g_globals->_soundHandler.play(250);
+ g_globals->setFlag(72);
_object3.postInit();
_object3.setVisage(5001);
@@ -578,36 +578,36 @@ void Scene7000::postInit(SceneObjectList *OwnerList) {
_object3.changeZoom(-1);
setAction(&_action3);
}
- } else if (_globals->_sceneManager._previousScene == 2280) {
- _globals->_player.postInit();
- _globals->_player.setVisage(2170);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setPosition(Common::Point(57, 94));
- _globals->_player.changeZoom(-1);
- _globals->_player.fixPriority(10);
- _globals->_player.disableControl();
+ } else if (g_globals->_sceneManager._previousScene == 2280) {
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(2170);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setPosition(Common::Point(57, 94));
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player.fixPriority(10);
+ g_globals->_player.disableControl();
_sceneMode = 7001;
setAction(&_action6, this);
- if (!_globals->getFlag(81)) {
+ if (!g_globals->getFlag(81)) {
_object1.setPosition(Common::Point(151, 182));
_object1.changeZoom(100);
}
_object8.remove();
_object9.remove();
- } else if (_globals->_sceneManager._previousScene == 2320) {
- _globals->_player.postInit();
- _globals->_player.setVisage(0);
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ } else if (g_globals->_sceneManager._previousScene == 2320) {
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(0);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
SceneObjectWrapper *wrapper = new SceneObjectWrapper();
- _globals->_player.setObjectWrapper(wrapper);
- _globals->_player.setPosition(Common::Point(57, 94));
- _globals->_player.changeZoom(-1);
- _globals->_player.fixPriority(10);
+ g_globals->_player.setObjectWrapper(wrapper);
+ g_globals->_player.setPosition(Common::Point(57, 94));
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player.fixPriority(10);
_sceneMode = 7001;
setAction(&_action6, this);
} else {
- _globals->setFlag(72);
+ g_globals->setFlag(72);
_object3.postInit();
_object3.setVisage(5001);
@@ -615,18 +615,18 @@ void Scene7000::postInit(SceneObjectList *OwnerList) {
_object3.setPosition(Common::Point(307, 0));
_soundHandler.play(151);
_soundHandler.holdAt(true);
- _globals->_soundHandler.play(250);
+ g_globals->_soundHandler.play(250);
setAction(&_action3);
}
_hotspot1.setBounds(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));
- _globals->_sceneItems.push_back(&_hotspot1);
+ g_globals->_sceneItems.push_back(&_hotspot1);
}
/*--------------------------------------------------------------------------*/
void Scene7000::signal() {
- Scene7000 *scene = (Scene7000 *)_globals->_sceneManager._scene;
+ Scene7000 *scene = (Scene7000 *)g_globals->_sceneManager._scene;
switch (_sceneMode) {
case 7001:
case 7002:
@@ -636,19 +636,19 @@ void Scene7000::signal() {
case 7007:
case 7008:
case 7009:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 7003:
_sceneMode = 7001;
- setAction(&scene->_sequenceManager, this, 7001, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager, this, 7001, &g_globals->_player, NULL);
break;
case 7011:
_sceneMode = 7005;
- setAction(&scene->_sequenceManager, this, 7005, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager, this, 7005, &g_globals->_player, NULL);
break;
case 7012:
_sceneMode = 7005;
- setAction(&scene->_sequenceManager, this, 7012, &_globals->_player, NULL);
+ setAction(&scene->_sequenceManager, this, 7012, &g_globals->_player, NULL);
break;
case 7015:
setAction(&_action4);
@@ -663,7 +663,7 @@ void Scene7000::signal() {
*--------------------------------------------------------------------------*/
void Scene7100::Action3::signal() {
- Scene7100 *scene = (Scene7100 *)_globals->_sceneManager._scene;
+ Scene7100 *scene = (Scene7100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -683,11 +683,11 @@ void Scene7100::Action3::signal() {
}
void Scene7100::Action4::signal() {
- Scene7100 *scene = (Scene7100 *)_globals->_sceneManager._scene;
+ Scene7100 *scene = (Scene7100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- setDelay(_globals->_randomSource.getRandomNumber(1) + 1);
+ setDelay(g_globals->_randomSource.getRandomNumber(1) + 1);
break;
case 1: {
scene->_object5.setStrip(3);
@@ -711,7 +711,7 @@ void Scene7100::Action4::signal() {
}
void Scene7100::Action5::signal() {
- Scene7100 *scene = (Scene7100 *)_globals->_sceneManager._scene;
+ Scene7100 *scene = (Scene7100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -746,7 +746,7 @@ void Scene7100::Action5::signal() {
}
void Scene7100::Action6::signal() {
- Scene7100 *scene = (Scene7100 *)_globals->_sceneManager._scene;
+ Scene7100 *scene = (Scene7100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -801,7 +801,7 @@ void Scene7100::Action6::signal() {
}
void Scene7100::Action7::signal() {
- Scene7100 *scene = (Scene7100 *)_globals->_sceneManager._scene;
+ Scene7100 *scene = (Scene7100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -829,7 +829,7 @@ void Scene7100::Action7::signal() {
}
void Scene7100::Action8::signal() {
- Scene7100 *scene = (Scene7100 *)_globals->_sceneManager._scene;
+ Scene7100 *scene = (Scene7100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -927,7 +927,7 @@ void Scene7100::Action8::signal() {
}
void Scene7100::Action9::signal() {
- Scene7100 *scene = (Scene7100 *)_globals->_sceneManager._scene;
+ Scene7100 *scene = (Scene7100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -972,7 +972,7 @@ void Scene7100::Action9::signal() {
}
void Scene7100::Action10::signal() {
- Scene7100 *scene = (Scene7100 *)_globals->_sceneManager._scene;
+ Scene7100 *scene = (Scene7100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -992,7 +992,7 @@ void Scene7100::Action10::signal() {
}
void Scene7100::Action11::signal() {
- Scene7100 *scene = (Scene7100 *)_globals->_sceneManager._scene;
+ Scene7100 *scene = (Scene7100 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -1001,19 +1001,19 @@ void Scene7100::Action11::signal() {
case 1: {
Common::Point pt(154, 175);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
ObjectMover2 *mover2 = new ObjectMover2();
- scene->_object1.addMover(mover2, 25, 35, &_globals->_player);
+ scene->_object1.addMover(mover2, 25, 35, &g_globals->_player);
break;
}
case 2: {
Common::Point pt(700, 155);
NpcMover *mover = new NpcMover();
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 3:
- _globals->_sceneManager.changeScene(7200);
+ g_globals->_sceneManager.changeScene(7200);
remove();
break;
}
@@ -1119,14 +1119,14 @@ void Scene7100::postInit(SceneObjectList *OwnerList) {
_object25.setAction(&_action10, NULL);
// Swimmer 1
- _globals->_player.postInit();
- _globals->_player.setVisage(7101);
- _globals->_player.animate(ANIM_MODE_2, NULL);
- _globals->_player._moveDiff.x = 4;
- _globals->_player._moveDiff.y = 2;
- _globals->_player.setPosition(Common::Point(135, 135));
- _globals->_player.fixPriority(200);
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(7101);
+ g_globals->_player.animate(ANIM_MODE_2, NULL);
+ g_globals->_player._moveDiff.x = 4;
+ g_globals->_player._moveDiff.y = 2;
+ g_globals->_player.setPosition(Common::Point(135, 135));
+ g_globals->_player.fixPriority(200);
+ g_globals->_player.disableControl();
// Swimmer 2
_object1.postInit();
@@ -1139,7 +1139,7 @@ void Scene7100::postInit(SceneObjectList *OwnerList) {
setAction(&_action11);
_soundHandler1.play(270);
_soundHandler2.play(275);
- _globals->_soundHandler.play(270);
+ g_globals->_soundHandler.play(270);
}
/*--------------------------------------------------------------------------
* Scene 7200 - Underwater: Entering the cave
@@ -1147,7 +1147,7 @@ void Scene7100::postInit(SceneObjectList *OwnerList) {
*--------------------------------------------------------------------------*/
void Scene7200::Action1::signal() {
- Scene7200 *scene = (Scene7200 *)_globals->_sceneManager._scene;
+ Scene7200 *scene = (Scene7200 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -1159,13 +1159,13 @@ void Scene7200::Action1::signal() {
scene->_swimmer.addMover(mover1, &pt1, this);
Common::Point pt2(207, 138);
PlayerMover *mover2 = new PlayerMover();
- _globals->_player.addMover(mover2, &pt2, this);
+ g_globals->_player.addMover(mover2, &pt2, this);
break;
}
case 2:
break;
case 3:
- _globals->_sceneManager.changeScene(7300);
+ g_globals->_sceneManager.changeScene(7300);
remove();
break;
}
@@ -1174,7 +1174,7 @@ void Scene7200::Action1::signal() {
/*--------------------------------------------------------------------------*/
void Scene7200::Action2::signal() {
- Scene7200 *scene = (Scene7200 *)_globals->_sceneManager._scene;
+ Scene7200 *scene = (Scene7200 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -1288,13 +1288,13 @@ void Scene7200::postInit(SceneObjectList *OwnerList) {
_object9._numFrames = 3;
// Orange swimmer
- _globals->_player.postInit();
- _globals->_player.setVisage(7110);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setZoom(50);
- _globals->_player.setPosition(Common::Point(-18, 16));
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(7110);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setZoom(50);
+ g_globals->_player.setPosition(Common::Point(-18, 16));
+ g_globals->_player.disableControl();
_swimmer.postInit();
_swimmer.setVisage(7101);
@@ -1313,7 +1313,7 @@ void Scene7200::postInit(SceneObjectList *OwnerList) {
*--------------------------------------------------------------------------*/
void Scene7300::Action1::signal() {
- Scene7300 *scene = (Scene7300 *)_globals->_sceneManager._scene;
+ Scene7300 *scene = (Scene7300 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -1327,18 +1327,18 @@ void Scene7300::Action1::signal() {
case 4: {
NpcMover *mover = new NpcMover();
Common::Point pt(102, 122);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 5:
- _globals->_player.setStrip(2);
- _globals->_player.setFrame(1);
- _globals->_player.animate(ANIM_MODE_5, this);
+ g_globals->_player.setStrip(2);
+ g_globals->_player.setFrame(1);
+ g_globals->_player.animate(ANIM_MODE_5, this);
break;
case 6:
- _globals->_player.setStrip(3);
- _globals->_player._numFrames = 5;
- _globals->_player.animate(ANIM_MODE_2, this);
+ g_globals->_player.setStrip(3);
+ g_globals->_player._numFrames = 5;
+ g_globals->_player.animate(ANIM_MODE_2, this);
if (RING_INVENTORY._translator._sceneNumber == 1)
scene->_stripManager.start(7310, this);
else
@@ -1346,10 +1346,10 @@ void Scene7300::Action1::signal() {
break;
case 7:
setDelay(3);
- _globals->_soundHandler.fadeOut(NULL);
+ g_globals->_soundHandler.fadeOut(NULL);
break;
case 8:
- _globals->_sceneManager.changeScene(2280);
+ g_globals->_sceneManager.changeScene(2280);
break;
}
}
@@ -1357,7 +1357,7 @@ void Scene7300::Action1::signal() {
/*--------------------------------------------------------------------------*/
void Scene7300::Action2::signal() {
- Scene7300 *scene = (Scene7300 *)_globals->_sceneManager._scene;
+ Scene7300 *scene = (Scene7300 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -1365,7 +1365,7 @@ void Scene7300::Action2::signal() {
break;
case 1:
NpcMover *mover1 = new NpcMover();
- Common::Point pt(_globals->_randomSource.getRandomNumber(3) + 203, _globals->_randomSource.getRandomNumber(3) + 96);
+ Common::Point pt(g_globals->_randomSource.getRandomNumber(3) + 203, g_globals->_randomSource.getRandomNumber(3) + 96);
scene->_object3.addMover(mover1, &pt, this);
_actionIndex = 0;
break;
@@ -1375,7 +1375,7 @@ void Scene7300::Action2::signal() {
/*--------------------------------------------------------------------------*/
void Scene7300::Action3::signal() {
- Scene7300 *scene = (Scene7300 *)_globals->_sceneManager._scene;
+ Scene7300 *scene = (Scene7300 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
@@ -1383,7 +1383,7 @@ void Scene7300::Action3::signal() {
break;
case 1:
NpcMover *mover1 = new NpcMover();
- Common::Point pt(_globals->_randomSource.getRandomNumber(5) + 76, _globals->_randomSource.getRandomNumber(5) + 78);
+ Common::Point pt(g_globals->_randomSource.getRandomNumber(5) + 76, g_globals->_randomSource.getRandomNumber(5) + 78);
scene->_object1.addMover(mover1, &pt, this);
_actionIndex = 0;
break;
@@ -1406,7 +1406,7 @@ void Scene7300::Action4::signal() {
/*--------------------------------------------------------------------------*/
void Scene7300::dispatch() {
- Scene7300 *scene = (Scene7300 *)_globals->_sceneManager._scene;
+ Scene7300 *scene = (Scene7300 *)g_globals->_sceneManager._scene;
scene->_object4.setPosition(Common::Point(scene->_object3._position.x + 15, scene->_object3._position.y + 61));
scene->_object2.setPosition(Common::Point(scene->_object1._position.x + 1, scene->_object1._position.y - 31));
@@ -1421,9 +1421,9 @@ void Scene7300::postInit(SceneObjectList *OwnerList) {
Scene::postInit();
setZoomPercents(60, 85, 200, 100);
- _globals->setFlag(52);
- _globals->setFlag(24);
- _globals->setFlag(109);
+ g_globals->setFlag(52);
+ g_globals->setFlag(24);
+ g_globals->setFlag(109);
_stripManager.addSpeaker(&_speakerPOR);
_stripManager.addSpeaker(&_speakerPOText);
@@ -1450,11 +1450,11 @@ void Scene7300::postInit(SceneObjectList *OwnerList) {
_object3._moveRate = 2;
_object3.setAction(&_action2);
- _globals->_player.postInit();
- _globals->_player.setVisage(7305);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setPosition(Common::Point(-100, 100));
- _globals->_player.disableControl();
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(7305);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setPosition(Common::Point(-100, 100));
+ g_globals->_player.disableControl();
_object1.postInit();
_object1.setVisage(7312);
@@ -1499,7 +1499,7 @@ void Scene7300::postInit(SceneObjectList *OwnerList) {
_object8._numFrames = 2;
setAction(&_action1);
- _globals->_soundHandler.play(272);
+ g_globals->_soundHandler.play(272);
}
/*--------------------------------------------------------------------------
@@ -1515,11 +1515,11 @@ void Scene7600::Action1::signal() {
case 1: {
PlayerMover *mover = new PlayerMover();
Common::Point pt(389, 57);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2:
- _globals->_sceneManager.changeScene(7700);
+ g_globals->_sceneManager.changeScene(7700);
break;
}
}
@@ -1534,11 +1534,11 @@ void Scene7600::Action2::signal() {
case 1: {
NpcMover *mover = new NpcMover();
Common::Point pt(-30, 195);
- _globals->_player.addMover(mover, &pt, this);
+ g_globals->_player.addMover(mover, &pt, this);
break;
}
case 2:
- _globals->_sceneManager.changeScene(2320);
+ g_globals->_sceneManager.changeScene(2320);
remove();
break;
}
@@ -1585,23 +1585,23 @@ void Scene7600::postInit(SceneObjectList *OwnerList) {
_object6.setPosition(Common::Point(379, 191));
_object6.fixPriority(1);
- _globals->_player.postInit();
- _globals->_player.setVisage(2333);
- _globals->_player.animate(ANIM_MODE_1, NULL);
- _globals->_player.setObjectWrapper(new SceneObjectWrapper());
- _globals->_player.setStrip(1);
- _globals->_player._moveDiff = Common::Point(16, 16);
- _globals->_player.changeZoom(-1);
- _globals->_player.disableControl();
-
- if (_globals->_sceneManager._previousScene == 7700) {
- _globals->_player.setPosition(Common::Point(389, 57));
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(2333);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.setObjectWrapper(new SceneObjectWrapper());
+ g_globals->_player.setStrip(1);
+ g_globals->_player._moveDiff = Common::Point(16, 16);
+ g_globals->_player.changeZoom(-1);
+ g_globals->_player.disableControl();
+
+ if (g_globals->_sceneManager._previousScene == 7700) {
+ g_globals->_player.setPosition(Common::Point(389, 57));
setAction(&_action2);
} else {
- _globals->_player.setPosition(Common::Point(-50, 195));
+ g_globals->_player.setPosition(Common::Point(-50, 195));
setAction(&_action1);
}
- _sceneBounds.center(_globals->_player._position.x, _globals->_player._position.y);
+ _sceneBounds.center(g_globals->_player._position.x, g_globals->_player._position.y);
loadScene(7600);
_soundHandler2.play(255);
_soundHandler1.play(251);
@@ -1618,11 +1618,11 @@ void Scene7700::Action1::signal() {
case 0: {
PlayerMover *mover1 = new PlayerMover();
Common::Point pt = Common::Point(fmtObj->_position.x, fmtObj->_position.y + 30);
- _globals->_player.addMover(mover1, &pt, this);
+ g_globals->_player.addMover(mover1, &pt, this);
break;
}
case 1:
- _globals->_player.checkAngle(fmtObj);
+ g_globals->_player.checkAngle(fmtObj);
if (fmtObj->_state == 0)
fmtObj->animate(ANIM_MODE_5, this);
else
@@ -1635,11 +1635,11 @@ void Scene7700::Action1::signal() {
}
void Scene7700::Action2::signal() {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
case 2:
- setDelay(_globals->_randomSource.getRandomNumber(60) + 60);
+ setDelay(g_globals->_randomSource.getRandomNumber(60) + 60);
break;
case 1:
scene->_prof.animate(ANIM_MODE_7, 0, NULL);
@@ -1653,7 +1653,7 @@ void Scene7700::Action2::signal() {
}
void Scene7700::Action3::signal() {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
scene->_object15.animate(ANIM_MODE_5, this);
@@ -1675,14 +1675,14 @@ void Scene7700::Action3::signal() {
scene->_object8._numFrames = 3;
break;
case 3:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene7700::Action4::signal() {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 2:
scene->_object13.remove();
@@ -1701,21 +1701,21 @@ void Scene7700::Action4::signal() {
case 3:
CursorMan.showMouse(true);
SceneItem::display2(7700, 11);
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
remove();
break;
}
}
void Scene7700::Action5::signal() {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
- setDelay(_globals->_randomSource.getRandomNumber(240));
+ setDelay(g_globals->_randomSource.getRandomNumber(240));
break;
case 1: {
- scene->_cloud.setFrame(_globals->_randomSource.getRandomNumber(1) + 1);
- scene->_cloud.setPosition(Common::Point(133, 145 + _globals->_randomSource.getRandomNumber(54)));
+ scene->_cloud.setFrame(g_globals->_randomSource.getRandomNumber(1) + 1);
+ scene->_cloud.setPosition(Common::Point(133, 145 + g_globals->_randomSource.getRandomNumber(54)));
Common::Point pt(360, scene->_cloud._position.y);
NpcMover *mover = new NpcMover();
@@ -1727,7 +1727,7 @@ void Scene7700::Action5::signal() {
}
void Scene7700::Action6::signal() {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
setDelay(5);
@@ -1773,7 +1773,7 @@ void Scene7700::SceneHotspot2::doAction(int action) {
}
void Scene7700::SceneHotspot3::doAction(int action) {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_KEY:
@@ -1787,13 +1787,13 @@ void Scene7700::SceneHotspot3::doAction(int action) {
SceneItem::display2(7700, 53);
break;
case CURSOR_USE:
- if (!_globals->getFlag(78)) {
+ if (!g_globals->getFlag(78)) {
scene->_sceneMode = 7712;
scene->setAction(&scene->_sequenceManager, scene, 7715, NULL);
} else if (RING_INVENTORY._key._sceneNumber == 7700) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 7705;
- scene->setAction(&scene->_sequenceManager, scene, 7705, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7705, &g_globals->_player, NULL);
}
break;
default:
@@ -1803,14 +1803,14 @@ void Scene7700::SceneHotspot3::doAction(int action) {
}
void Scene7700::SceneHotspot4::doAction(int action) {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(7700, 12);
break;
case CURSOR_USE:
- if (!_globals->getFlag(78)) {
+ if (!g_globals->getFlag(78)) {
scene->_sceneMode = 7712;
scene->setAction(&scene->_sequenceManager, scene, 7715, NULL);
} else {
@@ -1824,18 +1824,18 @@ void Scene7700::SceneHotspot4::doAction(int action) {
}
void Scene7700::SceneHotspot5::doAction(int action) {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
SceneItem::display2(7700, 28);
break;
case CURSOR_USE:
- if (_globals->getFlag(78)) {
+ if (g_globals->getFlag(78)) {
if (RING_INVENTORY._paper._sceneNumber == 7700) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 7708;
- scene->setAction(&scene->_sequenceManager, scene, 7708, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7708, &g_globals->_player, NULL);
}
} else {
scene->_sceneMode = 7712;
@@ -1868,7 +1868,7 @@ void Scene7700::SceneItem7::doAction(int action) {
}
void Scene7700::SceneHotspot8::doAction(int action) {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -1894,7 +1894,7 @@ void Scene7700::SceneHotspot8::doAction(int action) {
}
void Scene7700::SceneHotspot9::doAction(int action) {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -1919,7 +1919,7 @@ void Scene7700::SceneHotspot9::doAction(int action) {
} else {
scene->_field97B++;
if (scene->_field97B == 3) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action3);
}
}
@@ -1937,13 +1937,13 @@ void Scene7700::SceneItem10::doAction(int action) {
}
void Scene7700::Object1::doAction(int action) {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
SceneItem::display2(7700, _lookLineNum);
} else if (action == CURSOR_USE) {
- if (_globals->getFlag(78)) {
- _globals->_player.disableControl();
+ if (g_globals->getFlag(78)) {
+ g_globals->_player.disableControl();
scene->setAction(&scene->_action1, this);
} else {
scene->_sceneMode = 7712;
@@ -1975,20 +1975,20 @@ void Scene7700::Object1::signal() {
} else {
_state = 0;
}
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
}
void Scene7700::Object3::doAction(int action) {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
SceneItem::display2(7700, 34);
} else if (action == CURSOR_USE) {
- if (_globals->getFlag(78)) {
+ if (g_globals->getFlag(78)) {
if (scene->_object3._frame == 1) {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 7707;
- scene->setAction(&scene->_sequenceManager, scene, 7707, &_globals->_player, this, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7707, &g_globals->_player, this, NULL);
} else {
SceneItem::display2(7700, 60);
}
@@ -2002,17 +2002,17 @@ void Scene7700::Object3::doAction(int action) {
}
void Scene7700::Object7::doAction(int action) {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
- if (_globals->getFlag(78))
+ if (g_globals->getFlag(78))
SceneItem::display2(7700, 45);
else
SceneItem::display2(7700, 44);
break;
case CURSOR_USE:
- if (_globals->getFlag(78)) {
+ if (g_globals->getFlag(78)) {
SceneItem::display2(7701, 41);
} else {
scene->_sceneMode = 7712;
@@ -2020,10 +2020,10 @@ void Scene7700::Object7::doAction(int action) {
}
break;
case CURSOR_TALK:
- if (_globals->getFlag(78)) {
+ if (g_globals->getFlag(78)) {
SceneItem::display2(7702, 1);
} else {
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
if (_state == 0) {
_state = 1;
scene->_sceneMode = 7703;
@@ -2035,13 +2035,13 @@ void Scene7700::Object7::doAction(int action) {
}
break;
case OBJECT_STUNNER:
- if (!_globals->getFlag(78)) {
- _globals->_soundHandler.stop();
- _globals->setFlag(78);
+ if (!g_globals->getFlag(78)) {
+ g_globals->_soundHandler.stop();
+ g_globals->setFlag(78);
setAction(NULL);
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 7704;
- scene->setAction(&scene->_sequenceManager, scene, 7704, &_globals->_player, this, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7704, &g_globals->_player, this, NULL);
}
break;
default:
@@ -2051,7 +2051,7 @@ void Scene7700::Object7::doAction(int action) {
}
void Scene7700::Object8::doAction(int action) {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
if ((action == CURSOR_LOOK) || (action == CURSOR_USE)) {
if (_strip == 3) {
@@ -2071,10 +2071,10 @@ void Scene7700::Object8::doAction(int action) {
scene->_gfxButton._bounds.center(140, 189);
scene->_gfxButton.draw();
- _globals->_sceneItems.push_front(&scene->_sceneItem10);
- _globals->_sceneItems.push_front(&scene->_object9);
- _globals->_player._canWalk = false;
- } else if (_globals->getFlag(78)) {
+ g_globals->_sceneItems.push_front(&scene->_sceneItem10);
+ g_globals->_sceneItems.push_front(&scene->_object9);
+ g_globals->_player._canWalk = false;
+ } else if (g_globals->getFlag(78)) {
scene->_object15.postInit();
scene->_object15.setVisage(7701);
scene->_object15.setPosition(Common::Point(140, 165));
@@ -2090,11 +2090,11 @@ void Scene7700::Object8::doAction(int action) {
scene->_object19.setStrip(6);
scene->_object19.setPosition(Common::Point(140, 192));
- _globals->_sceneItems.push_front(&scene->_sceneItem10);
- _globals->_sceneItems.push_front(&scene->_sceneHotspot8);
- _globals->_sceneItems.push_front(&scene->_sceneHotspot9);
- _globals->_events.setCursor(CURSOR_WALK);
- _globals->_player._canWalk = false;
+ g_globals->_sceneItems.push_front(&scene->_sceneItem10);
+ g_globals->_sceneItems.push_front(&scene->_sceneHotspot8);
+ g_globals->_sceneItems.push_front(&scene->_sceneHotspot9);
+ g_globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_player._canWalk = false;
} else {
scene->setAction(&scene->_sequenceManager, scene, 7715, NULL);
}
@@ -2104,7 +2104,7 @@ void Scene7700::Object8::doAction(int action) {
}
void Scene7700::Object9::doAction(int action) {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
switch (action) {
case CURSOR_LOOK:
@@ -2118,19 +2118,19 @@ void Scene7700::Object9::doAction(int action) {
break;
case OBJECT_KEY:
if (_frame == 1) {
- if (!_globals->getFlag(80)) {
+ if (!g_globals->getFlag(80)) {
scene->_object10.postInit();
scene->_object10.setVisage(7701);
scene->_object10.setStrip(4);
scene->_object10.setPosition(Common::Point(159, 136));
- _globals->_sceneItems.push_front(&scene->_object10);
+ g_globals->_sceneItems.push_front(&scene->_object10);
scene->_object10.fixPriority(240);
}
scene->_soundHandler.play(262);
scene->_object14.animate(ANIM_MODE_5, NULL);
}
- _globals->_events.setCursor(CURSOR_WALK);
+ g_globals->_events.setCursor(CURSOR_WALK);
break;
default:
SceneHotspot::doAction(action);
@@ -2138,14 +2138,14 @@ void Scene7700::Object9::doAction(int action) {
}
void Scene7700::Object10::doAction(int action) {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
SceneItem::display2(7700, 50);
} else if (action == CURSOR_USE) {
- _globals->_player._canWalk = true;
+ g_globals->_player._canWalk = true;
RING_INVENTORY._translator._sceneNumber = 1;
- _globals->setFlag(80);
+ g_globals->setFlag(80);
scene->_sceneItem10.remove();
scene->_gfxButton._bounds.expandPanes();
scene->_object14.remove();
@@ -2157,7 +2157,7 @@ void Scene7700::Object10::doAction(int action) {
}
void Scene7700::Object11::doAction(int action) {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
switch (action) {
case OBJECT_SCANNER:
@@ -2176,18 +2176,18 @@ void Scene7700::Object11::doAction(int action) {
if (_frame != 1) {
SceneItem::display2(7701, 8);
} else {
- _globals->setFlag(49);
- _globals->_player.disableControl();
+ g_globals->setFlag(49);
+ g_globals->_player.disableControl();
scene->_sceneMode = 7706;
- scene->setAction(&scene->_sequenceManager, scene, 7706, &_globals->_player, this, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7706, &g_globals->_player, this, NULL);
}
break;
case OBJECT_EMPTY_JAR:
RING_INVENTORY._emptyJar._sceneNumber = 0;
RING_INVENTORY._jar._sceneNumber = 1;
- _globals->_player.disableControl();
+ g_globals->_player.disableControl();
scene->_sceneMode = 7710;
- scene->setAction(&scene->_sequenceManager, scene, 7710, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7710, &g_globals->_player, NULL);
break;
default:
SceneHotspot::doAction(action);
@@ -2195,14 +2195,14 @@ void Scene7700::Object11::doAction(int action) {
}
void Scene7700::Object12::doAction(int action) {
- Scene7700 *scene = (Scene7700 *)_globals->_sceneManager._scene;
+ Scene7700 *scene = (Scene7700 *)g_globals->_sceneManager._scene;
if (action == CURSOR_LOOK) {
SceneItem::display2(7700, 15);
} else if (action == CURSOR_USE) {
- if (_globals->getFlag(78)) {
+ if (g_globals->getFlag(78)) {
scene->_sceneMode = 7713;
- scene->setAction(&scene->_sequenceManager, scene, 7713, &_globals->_player, NULL);
+ scene->setAction(&scene->_sequenceManager, scene, 7713, &g_globals->_player, NULL);
} else {
scene->_sceneMode = 7712;
scene->setAction(&scene->_sequenceManager, scene, 7715, NULL);
@@ -2215,46 +2215,46 @@ void Scene7700::Object12::doAction(int action) {
void Scene7700::signal() {
switch (_sceneMode) {
case 7701:
- _globals->_player.fixPriority(-1);
- _globals->_player.setStrip2(-1);
- if (_globals->getFlag(78)) {
- _globals->_player.enableControl();
+ g_globals->_player.fixPriority(-1);
+ g_globals->_player.setStrip2(-1);
+ if (g_globals->getFlag(78)) {
+ g_globals->_player.enableControl();
} else {
_sceneMode = 7711;
setAction(&_sequenceManager, this, 7711, NULL);
}
break;
case 7702:
- _globals->_soundHandler.fadeOut(NULL);
- _globals->_sceneManager.changeScene(7600);
+ g_globals->_soundHandler.fadeOut(NULL);
+ g_globals->_sceneManager.changeScene(7600);
break;
case 7703:
case 7706:
case 7707:
case 7711:
case 7712:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 7704:
- _globals->_soundHandler.play(256);
+ g_globals->_soundHandler.play(256);
_prof.setStrip2(4);
_prof.setFrame2(1);
_prof.setPosition(Common::Point(159, 87));
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 7705:
RING_INVENTORY._key._sceneNumber = 1;
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 7708:
RING_INVENTORY._paper._sceneNumber = 1;
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
break;
case 7709:
- _globals->_events.setCursor(CURSOR_USE);
+ g_globals->_events.setCursor(CURSOR_USE);
break;
case 7710:
- _globals->_player.enableControl();
+ g_globals->_player.enableControl();
SceneItem::display2(7700, 62);
break;
case 7713:
@@ -2269,23 +2269,23 @@ void Scene7700::signal() {
void Scene7700::process(Event &event) {
Scene::process(event);
- if (contains<SceneItem *>(_globals->_sceneItems, &_sceneItem10)) {
+ if (contains<SceneItem *>(g_globals->_sceneItems, &_sceneItem10)) {
if (_gfxButton.process(event)) {
_sceneItem10.remove();
_object15.remove();
_object9.remove();
- if (_globals->_sceneObjects->contains(&_object10))
+ if (g_globals->_sceneObjects->contains(&_object10))
_object10.remove();
- if (_globals->_sceneObjects->contains(&_object14))
+ if (g_globals->_sceneObjects->contains(&_object14))
_object14.remove();
_object19.remove();
_gfxButton._bounds.expandPanes();
- _globals->_player._canWalk = true;
+ g_globals->_player._canWalk = true;
}
}
if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_p)) {
event.handled = true;
- if (!_globals->_sceneObjects->contains(&_easterEgg1)) {
+ if (!g_globals->_sceneObjects->contains(&_easterEgg1)) {
_easterEgg1.postInit();
_easterEgg1.setVisage(7708);
_easterEgg1.setPosition(Common::Point(163, 50));
@@ -2297,15 +2297,15 @@ void Scene7700::process(Event &event) {
}
void Scene7700::dispatch() {
- if ((_globals->_sceneRegions.indexOf(_globals->_player._position) == 6) || (_globals->_player._position.x < 10))
- _globals->_player.changeZoom(100 - ((_globals->_player._position.y - 68) / 2));
+ if ((g_globals->_sceneRegions.indexOf(g_globals->_player._position) == 6) || (g_globals->_player._position.x < 10))
+ g_globals->_player.changeZoom(100 - ((g_globals->_player._position.y - 68) / 2));
else
- _globals->_player.changeZoom(-1);
+ g_globals->_player.changeZoom(-1);
- if ((_action == 0) && (_globals->_sceneRegions.indexOf(_globals->_player._position) == 30)) {
- _globals->_player.disableControl();
+ if ((_action == 0) && (g_globals->_sceneRegions.indexOf(g_globals->_player._position) == 30)) {
+ g_globals->_player.disableControl();
_sceneMode = 7702;
- setAction(&_sequenceManager, this, 7702, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 7702, &g_globals->_player, NULL);
}
Scene::dispatch();
}
@@ -2314,33 +2314,33 @@ void Scene7700::postInit(SceneObjectList *OwnerList) {
loadScene(7700);
Scene::postInit();
setZoomPercents(100, 80, 200, 100);
- _globals->setFlag(53);
+ g_globals->setFlag(53);
_field97B = 0;
_field979 = 0;
_field977 = 0;
_stripManager.addSpeaker(&_speakerEText);
_stripManager.addSpeaker(&_speakerQText);
- _speakerQText._npc = &_globals->_player;
+ _speakerQText._npc = &g_globals->_player;
_speakerEText._npc = &_prof;
- _globals->_player.postInit();
- _globals->_player.setVisage(4201);
- _globals->_player.animate(ANIM_MODE_1, NULL);
+ g_globals->_player.postInit();
+ g_globals->_player.setVisage(4201);
+ g_globals->_player.animate(ANIM_MODE_1, NULL);
SceneObjectWrapper *wrapper = new SceneObjectWrapper();
- _globals->_player.setObjectWrapper(wrapper);
- _globals->_player.setPosition(Common::Point(-19, 68));
- _globals->_player.setStrip2(7);
- _globals->_player.fixPriority(95);
- _globals->_player.changeZoom(80);
- _globals->_player._moveDiff.x = 6;
- _globals->_player._moveDiff.y = 3;
- _globals->_player.disableControl();
+ g_globals->_player.setObjectWrapper(wrapper);
+ g_globals->_player.setPosition(Common::Point(-19, 68));
+ g_globals->_player.setStrip2(7);
+ g_globals->_player.fixPriority(95);
+ g_globals->_player.changeZoom(80);
+ g_globals->_player._moveDiff.x = 6;
+ g_globals->_player._moveDiff.y = 3;
+ g_globals->_player.disableControl();
_prof.postInit();
_prof.setVisage(7706);
- if (_globals->getFlag(78)) {
+ if (g_globals->getFlag(78)) {
_prof.setStrip2(4);
_prof.fixPriority(80);
_prof.setPosition(Common::Point(159, 87));
@@ -2414,7 +2414,7 @@ void Scene7700::postInit(SceneObjectList *OwnerList) {
_cork.setVisage(7703);
_cork.setPosition(Common::Point(32, 128));
- if (_globals->getFlag(49))
+ if (g_globals->getFlag(49))
_cork.setFrame(_cork.getFrameCount());
if (RING_INVENTORY._emptyJar._sceneNumber == 7700) {
@@ -2422,7 +2422,7 @@ void Scene7700::postInit(SceneObjectList *OwnerList) {
_emptyJar.setVisage(7700);
_emptyJar.setStrip(8);
_emptyJar.setPosition(Common::Point(189, 48));
- _globals->_sceneItems.addItems(&_emptyJar, NULL);
+ g_globals->_sceneItems.addItems(&_emptyJar, NULL);
}
_sceneHotspot1._sceneRegionId = 28;
_sceneHotspot2._sceneRegionId = 6;
@@ -2513,16 +2513,16 @@ void Scene7700::postInit(SceneObjectList *OwnerList) {
_sceneHotspot36._useLineNum = 39;
_sceneHotspot36._lookLineNum = 42;
- _globals->_sceneItems.addItems(&_prof, &_sceneHotspot35, &_object8, &_sceneHotspot34, &_sceneHotspot33, &_sceneHotspot32, NULL);
- _globals->_sceneItems.addItems(&_sceneHotspot31, &_sceneHotspot30, &_sceneHotspot29, &_sceneHotspot5, &_sceneHotspot28, &_sceneHotspot27, NULL);
- _globals->_sceneItems.addItems(&_sceneHotspot26, &_sceneHotspot25, &_sceneHotspot24, &_sceneHotspot23, &_sceneHotspot22, &_sceneHotspot21, NULL);
- _globals->_sceneItems.addItems(&_sceneHotspot20, &_sceneHotspot19, &_sceneHotspot18, &_sceneHotspot17, &_sceneHotspot4, &_sceneHotspot3, NULL);
- _globals->_sceneItems.addItems(&_sceneHotspot16, &_sceneHotspot15, &_sceneHotspot2, &_sceneHotspot14, &_cork, &_sceneHotspot1, NULL);
- _globals->_sceneItems.addItems(&_sceneHotspot13, &_sceneHotspot12, &_sceneHotspot11, &_object2, &_object1, &_object3, NULL);
- _globals->_sceneItems.addItems(&_object6, &_object5, &_object4, &_sceneHotspot6, &_sceneHotspot36, &_sceneItem7, NULL);
+ g_globals->_sceneItems.addItems(&_prof, &_sceneHotspot35, &_object8, &_sceneHotspot34, &_sceneHotspot33, &_sceneHotspot32, NULL);
+ g_globals->_sceneItems.addItems(&_sceneHotspot31, &_sceneHotspot30, &_sceneHotspot29, &_sceneHotspot5, &_sceneHotspot28, &_sceneHotspot27, NULL);
+ g_globals->_sceneItems.addItems(&_sceneHotspot26, &_sceneHotspot25, &_sceneHotspot24, &_sceneHotspot23, &_sceneHotspot22, &_sceneHotspot21, NULL);
+ g_globals->_sceneItems.addItems(&_sceneHotspot20, &_sceneHotspot19, &_sceneHotspot18, &_sceneHotspot17, &_sceneHotspot4, &_sceneHotspot3, NULL);
+ g_globals->_sceneItems.addItems(&_sceneHotspot16, &_sceneHotspot15, &_sceneHotspot2, &_sceneHotspot14, &_cork, &_sceneHotspot1, NULL);
+ g_globals->_sceneItems.addItems(&_sceneHotspot13, &_sceneHotspot12, &_sceneHotspot11, &_object2, &_object1, &_object3, NULL);
+ g_globals->_sceneItems.addItems(&_object6, &_object5, &_object4, &_sceneHotspot6, &_sceneHotspot36, &_sceneItem7, NULL);
_sceneMode = 7701;
- setAction(&_sequenceManager, this, 7701, &_globals->_player, NULL);
+ setAction(&_sequenceManager, this, 7701, &g_globals->_player, NULL);
_soundHandler.play(256);
}
diff --git a/engines/tsage/ringworld/ringworld_scenes8.h b/engines/tsage/ringworld/ringworld_scenes8.h
index 4878db5cc8..84178c36f9 100644
--- a/engines/tsage/ringworld/ringworld_scenes8.h
+++ b/engines/tsage/ringworld/ringworld_scenes8.h
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
#include "tsage/ringworld/ringworld_logic.h"
+#include "tsage/ringworld/ringworld_speakers.h"
#include "tsage/events.h"
#include "tsage/core.h"
#include "tsage/scenes.h"
diff --git a/engines/tsage/ringworld/ringworld_speakers.cpp b/engines/tsage/ringworld/ringworld_speakers.cpp
new file mode 100644
index 0000000000..dc80df40a3
--- /dev/null
+++ b/engines/tsage/ringworld/ringworld_speakers.cpp
@@ -0,0 +1,905 @@
+/* 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 "tsage/ringworld/ringworld_speakers.h"
+#include "tsage/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/graphics.h"
+#include "tsage/staticres.h"
+
+namespace TsAGE {
+
+namespace Ringworld {
+
+SpeakerGText::SpeakerGText() {
+ _speakerName = "GTEXT";
+ _textWidth = 160;
+ _textPos = Common::Point(130, 10);
+ _color1 = 42;
+ _hideObjects = false;
+}
+
+void SpeakerGText::setText(const Common::String &msg) {
+ // Set the animation properties
+ _sceneObject.postInit();
+ _sceneObject.setVisage(9405);
+ _sceneObject.setStrip2(3);
+ _sceneObject.fixPriority(255);
+ _sceneObject.changeZoom(100);
+ _sceneObject._frame = 1;
+ _sceneObject.setPosition(Common::Point(183, 71));
+ _sceneObject.animate(ANIM_MODE_7, 0, NULL);
+
+ // Set the text
+ Rect textRect;
+ g_globals->gfxManager()._font.getStringBounds(msg.c_str(), textRect, _textWidth);
+ textRect.center(_sceneObject._position.x, _sceneObject._position.y);
+ _textPos.x = textRect.left;
+ Speaker::setText(msg);
+}
+
+void SpeakerGText::removeText() {
+ _sceneObject.remove();
+ Speaker::removeText();
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerPOR::SpeakerPOR() {
+ _speakerName = "POR";
+ _newSceneNumber = 7221;
+ _textPos = Common::Point(10, 30);
+ _color1 = 41;
+}
+
+void SpeakerPOR::SpeakerAction1::signal(){
+ switch (_actionIndex++) {
+ case 0:
+ setDelay(g_globals->_randomSource.getRandomNumber(60) + 60);
+ break;
+ case 1:
+ static_cast<SceneObject *>(_owner)->animate(ANIM_MODE_5, this, NULL);
+ break;
+ case 2:
+ setDelay(g_globals->_randomSource.getRandomNumber(10));
+ _actionIndex = 0;
+ break;
+ default:
+ break;
+ }
+}
+
+void SpeakerPOR::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(7223);
+ _object1.setStrip2(2);
+ _object1.setPosition(Common::Point(191, 166));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(7223);
+ _object2.setPosition(Common::Point(159, 86));
+ _object2.setAction(&_speakerAction, NULL);
+
+ _object3.postInit(&_objectList);
+ _object3.setVisage(7223);
+ _object3.setStrip(3);
+ _object3.setPosition(Common::Point(119, 107));
+ _object3.fixPriority(199);
+ _object3.setAction(&_action2);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerOR::SpeakerOR() {
+ _speakerName = "OR";
+ _newSceneNumber = 9430;
+ _textPos = Common::Point(8, 36);
+ _color1 = 42;
+ _textWidth = 136;
+}
+
+void SpeakerOR::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(9431);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(202, 147));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(9431);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(199, 85));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerOText::SpeakerOText() : SpeakerGText() {
+ _speakerName = "OTEXT";
+ _textWidth = 240;
+ _textPos = Common::Point(130, 10);
+ _color1 = 42;
+ _hideObjects = false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerQText::SpeakerQText() : ScreenSpeaker() {
+ _speakerName = "QTEXT";
+ _textPos = Common::Point(160, 40);
+ _color1 = 35;
+ _textWidth = 240;
+ _textMode = ALIGN_CENTER;
+ _hideObjects = false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerSText::SpeakerSText() : ScreenSpeaker() {
+ _speakerName = "STEXT";
+ _color1 = 13;
+ _textWidth = 240;
+ _textMode = ALIGN_CENTER;
+ _hideObjects = false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerPOText::SpeakerPOText() : ScreenSpeaker() {
+ _speakerName = "POTEXT";
+ _textWidth = 240;
+ _textMode = ALIGN_CENTER;
+ _color1 = 41;
+ _hideObjects = false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerMText::SpeakerMText() {
+ _speakerName = "MTEXT";
+ _color1 = 22;
+ _textWidth = 230;
+ _textMode = ALIGN_CENTER;
+ _hideObjects = false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerCText::SpeakerCText() {
+ _speakerName = "CTEXT";
+ _color1 = 4;
+ _textWidth = 240;
+ _textMode = ALIGN_CENTER;
+ _hideObjects = false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerEText::SpeakerEText() {
+ _speakerName = "ETEXT";
+ _textPos = Common::Point(20, 20);
+ _color1 = 22;
+ _hideObjects = false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerGR::SpeakerGR() : AnimatedSpeaker() {
+ _speakerName = "GR";
+ _newSceneNumber = 9220;
+ _textWidth = 136;
+ _textPos = Common::Point(168, 36);
+ _color1 = 14;
+}
+
+void SpeakerGR::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(9221);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(101, 70));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerHText::SpeakerHText() {
+ _speakerName = "HTEXT";
+ _textPos = Common::Point(160, 40);
+ _color1 = 52;
+ _hideObjects = false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerSKText::SpeakerSKText() : ScreenSpeaker() {
+ _speakerName = "SKTEXT";
+ _textWidth = 240;
+ _textMode = ALIGN_CENTER;
+ _color1 = 9;
+ _hideObjects = false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerPText::SpeakerPText() {
+ _speakerName = "PTEXT";
+ _textWidth = 240;
+ _textMode = ALIGN_CENTER;
+ _color1 = 5;
+ _hideObjects = false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerCHFText::SpeakerCHFText() {
+ _speakerName = "CHFTEXT";
+ _textWidth = 240;
+ _textMode = ALIGN_CENTER;
+ _color1 = 56;
+ _hideObjects = false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerCDRText::SpeakerCDRText() {
+ _speakerName = "CDRTEXT";
+ _textWidth = 240;
+ _textMode = ALIGN_CENTER;
+ _color1 = 52;
+ _hideObjects = false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerFLText::SpeakerFLText() {
+ _speakerName = "FLTEXT";
+ _textPos = Common::Point(10, 40);
+ _color1 = 17;
+ _hideObjects = false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerBatText::SpeakerBatText() {
+ _speakerName = "BATTEXT";
+ _textWidth = 240;
+ _textMode = ALIGN_CENTER;
+ _color1 = 3;
+ _hideObjects = false;
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerSKL::SpeakerSKL() : AnimatedSpeaker() {
+ _speakerName = "SKL";
+ _newSceneNumber = 7011;
+ _textPos = Common::Point(10, 30);
+ _color1 = 9;
+}
+
+void SpeakerSKL::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(7013);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(203, 120));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(7013);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(197, 80));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerQL::SpeakerQL() : AnimatedSpeaker() {
+ _speakerName = "QL";
+ _newSceneNumber = 2610;
+ _textPos = Common::Point(160, 30);
+ _color1 = 35;
+ _textMode = ALIGN_CENTER;
+}
+
+void SpeakerQL::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(2612);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(128, 146));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(2612);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(122, 84));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerSR::SpeakerSR() {
+ _speakerName = "SR";
+ _newSceneNumber = 2811;
+ _textPos = Common::Point(10, 30);
+ _color1 = 13;
+ _textMode = ALIGN_CENTER;
+}
+
+void SpeakerSR::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(2813);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(224, 198));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(2813);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(203, 96));
+ _object2.setAction(&_speakerAction, NULL);
+
+ _object3.postInit(&_objectList);
+ _object3.setVisage(2813);
+ _object3.setStrip(3);
+ _object3.setPosition(Common::Point(204, 91));
+ _object3.fixPriority(199);
+ _object3._numFrames = 3;
+ _object3.animate(ANIM_MODE_7, 0, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerSL::SpeakerSL() {
+ _speakerName = "SL";
+ _newSceneNumber = 2810;
+ _textPos = Common::Point(140, 30);
+ _textWidth = 160;
+ _color1 = 13;
+ _textMode = ALIGN_CENTER;
+}
+
+void SpeakerSL::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(2812);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(95, 198));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(2812);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(116, 96));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerQR::SpeakerQR() {
+ _speakerName = "QR";
+ _newSceneNumber = 2611;
+ _textPos = Common::Point(10, 30);
+ _color1 = 35;
+ _textMode = ALIGN_CENTER;
+}
+
+void SpeakerQR::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(2613);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(191, 146));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(2613);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(197, 84));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerQU::SpeakerQU() {
+ _speakerName = "QU";
+ _newSceneNumber = 7020;
+ _textPos = Common::Point(160, 30);
+ _color1 = 35;
+ _textMode = ALIGN_CENTER;
+}
+
+void SpeakerQU::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(7021);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(116, 120));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(7021);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(111, 84));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerCR::SpeakerCR() {
+ _speakerName = "CR";
+ _newSceneNumber = 9010;
+ _textPos = Common::Point(20, 40);
+ _color1 = 4;
+}
+
+void SpeakerCR::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(9011);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.setPosition(Common::Point(219, 168));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(9011);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.setPosition(Common::Point(232, 81));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerMR::SpeakerMR() {
+ _speakerName = "MR";
+ _newSceneNumber = 2711;
+ _textPos = Common::Point(10, 40);
+ _color1 = 22;
+}
+
+void SpeakerMR::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(2713);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(220, 143));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(2713);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(215, 99));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerSAL::SpeakerSAL() {
+ _speakerName = "SAL";
+ _newSceneNumber = 2851;
+ _textPos = Common::Point(10, 30);
+ _color1 = 13;
+ _textMode = ALIGN_CENTER;
+}
+
+void SpeakerSAL::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(2853);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(185, 200));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(2853);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(170, 92));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerML::SpeakerML() {
+ _speakerName = "ML";
+ _newSceneNumber = 2710;
+ _textPos = Common::Point(160, 40);
+ _color1 = 22;
+}
+
+void SpeakerML::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(2712);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(99, 143));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(2712);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(105, 99));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerCHFL::SpeakerCHFL() {
+ _speakerName = "CHFL";
+ _newSceneNumber = 4111;
+ _textPos = Common::Point(10, 40);
+ _color1 = 56;
+}
+
+void SpeakerCHFL::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(4113);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(205, 116));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(4113);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(202, 71));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerCHFR::SpeakerCHFR() {
+ _speakerName = "CHFR";
+ _newSceneNumber = 4110;
+ _textPos = Common::Point(160, 40);
+ _color1 = 56;
+}
+
+void SpeakerCHFR::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(4112);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(103, 116));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(4112);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(106, 71));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerPL::SpeakerPL() {
+ _speakerName = "PL";
+ _newSceneNumber = 4060;
+ _textPos = Common::Point(160, 40);
+ _color1 = 5;
+}
+
+void SpeakerPL::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(4062);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(107, 117));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(4062);
+ _object2.setStrip2(1);
+ _object2.fixPriority(200);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(105, 62));
+ _object2.setAction(&_speakerAction, NULL);
+
+ _object3.postInit(&_objectList);
+ _object3.setVisage(4062);
+ _object3.setStrip2(3);
+ _object3.fixPriority(255);
+ _object3.changeZoom(100);
+ _object3._frame = 1;
+ _object3.setPosition(Common::Point(105, 59));
+ _object3.setAction(&_speakerAction2, NULL);
+
+ Speaker::setText(msg);
+}
+
+void SpeakerPL::removeText() {
+ _object3.remove();
+ AnimatedSpeaker::removeText();
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerPR::SpeakerPR() {
+ _speakerName = "PR";
+ _newSceneNumber = 4061;
+ _textPos = Common::Point(10, 40);
+ _color1 = 5;
+}
+
+void SpeakerPR::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(4063);
+ _object1.setStrip2(1);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(212, 117));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(4063);
+ _object2.setStrip2(2);
+ _object2.fixPriority(200);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(214, 62));
+ _object2.setAction(&_speakerAction, NULL);
+
+ _object3.postInit(&_objectList);
+ _object3.setVisage(4063);
+ _object3.setStrip2(3);
+ _object3.fixPriority(255);
+ _object3.changeZoom(100);
+ _object3._frame = 1;
+ _object3.setPosition(Common::Point(214, 59));
+ _object3.setAction(&_speakerAction2, NULL);
+
+ Speaker::setText(msg);
+}
+
+void SpeakerPR::removeText() {
+ _object3.remove();
+ AnimatedSpeaker::removeText();
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerCDR::SpeakerCDR() {
+ _speakerName = "CDR";
+ _newSceneNumber = 4161;
+ _textPos = Common::Point(10, 40);
+ _color1 = 52;
+}
+
+void SpeakerCDR::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(4163);
+ _object1.setStrip2(1);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(208, 97));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(4163);
+ _object2.setStrip2(2);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(200, 57));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerCDL::SpeakerCDL() {
+ _speakerName = "CDL";
+ _newSceneNumber = 4160;
+ _textPos = Common::Point(160, 40);
+ _color1 = 52;
+}
+
+void SpeakerCDL::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(4162);
+ _object1.setStrip2(1);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(112, 97));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(4162);
+ _object2.setStrip2(2);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(115, 57));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerFLL::SpeakerFLL() {
+ _speakerName = "FLL";
+ _newSceneNumber = 5221;
+ _textPos = Common::Point(10, 40);
+ _color1 = 17;
+}
+
+void SpeakerFLL::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(5223);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(216, 129));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(5223);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(210, 67));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+/*--------------------------------------------------------------------------*/
+
+SpeakerBatR::SpeakerBatR() {
+ _speakerName = "BATR";
+ _newSceneNumber = 5360;
+ _textPos = Common::Point(140, 40);
+ _color1 = 3;
+}
+
+void SpeakerBatR::setText(const Common::String &msg) {
+ _object1.postInit(&_objectList);
+ _object1.setVisage(5361);
+ _object1.setStrip2(2);
+ _object1.fixPriority(255);
+ _object1.changeZoom(100);
+ _object1._frame = 1;
+ _object1.setPosition(Common::Point(137, 122));
+ _object1.animate(ANIM_MODE_7, 0, NULL);
+
+ _object2.postInit(&_objectList);
+ _object2.setVisage(5361);
+ _object2.setStrip2(1);
+ _object2.fixPriority(255);
+ _object2.changeZoom(100);
+ _object2._frame = 1;
+ _object2.setPosition(Common::Point(137, 104));
+ _object2.setAction(&_speakerAction, NULL);
+
+ Speaker::setText(msg);
+}
+
+} // End of namespace Ringworld
+
+} // End of namespace TsAGE
diff --git a/engines/tsage/ringworld/ringworld_speakers.h b/engines/tsage/ringworld/ringworld_speakers.h
new file mode 100644
index 0000000000..305984a184
--- /dev/null
+++ b/engines/tsage/ringworld/ringworld_speakers.h
@@ -0,0 +1,337 @@
+/* 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.
+ *
+ */
+
+#ifndef TSAGE_RINGWORLD_SPEAKERS_H
+#define TSAGE_RINGWORLD_SPEAKERS_H
+
+#include "common/scummsys.h"
+#include "tsage/converse.h"
+#include "tsage/events.h"
+#include "tsage/core.h"
+#include "tsage/scenes.h"
+#include "tsage/globals.h"
+#include "tsage/ringworld/ringworld_logic.h"
+
+namespace TsAGE {
+
+namespace Ringworld {
+
+using namespace TsAGE;
+
+class SpeakerGText : public Speaker {
+public:
+ SceneObject _sceneObject;
+public:
+ SpeakerGText();
+
+ virtual Common::String getClassName() { return "SpeakerGText"; }
+ virtual void setText(const Common::String &msg);
+ virtual void removeText();
+};
+
+class SpeakerPOR : public AnimatedSpeaker {
+ class SpeakerAction1 : public SpeakerAction {
+ public:
+ virtual void signal();
+ };
+
+public:
+ SceneObject _object3;
+ SpeakerAction1 _action2;
+public:
+ SpeakerPOR();
+ virtual Common::String getClassName() { return "SpeakerPOR"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerOR : public AnimatedSpeaker {
+public:
+ SpeakerOR();
+ virtual Common::String getClassName() { return "SpeakerOR"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerOText : public SpeakerGText {
+public:
+ SpeakerOText();
+
+ virtual Common::String getClassName() { return "SpeakerOText"; }
+};
+
+class SpeakerPOText : public ScreenSpeaker {
+public:
+ SpeakerPOText();
+
+ virtual Common::String getClassName() { return "SpeakerPOText"; }
+};
+
+class SpeakerSText : public ScreenSpeaker {
+public:
+ SpeakerSText();
+
+ virtual Common::String getClassName() { return "SpeakerSText"; }
+};
+
+class SpeakerQText : public ScreenSpeaker {
+public:
+ SpeakerQText();
+
+ virtual Common::String getClassName() { return "SpeakerQText"; }
+};
+
+class SpeakerMText : public ScreenSpeaker {
+public:
+ SpeakerMText();
+
+ virtual Common::String getClassName() { return "SpeakerMText"; }
+};
+
+class SpeakerCText : public ScreenSpeaker {
+public:
+ SpeakerCText();
+
+ virtual Common::String getClassName() { return "SpeakerCText"; }
+};
+
+class SpeakerEText : public ScreenSpeaker {
+public:
+ SpeakerEText();
+
+ virtual Common::String getClassName() { return "SpeakerEText"; }
+};
+
+class SpeakerGR : public AnimatedSpeaker {
+public:
+ SpeakerGR();
+
+ virtual Common::String getClassName() { return "SpeakerGR"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerHText : public ScreenSpeaker {
+public:
+ SpeakerHText();
+
+ virtual Common::String getClassName() { return "SpeakerHText"; }
+};
+
+class SpeakerPText : public ScreenSpeaker {
+public:
+ SpeakerPText();
+
+ virtual Common::String getClassName() { return "SpeakerPText"; }
+};
+
+class SpeakerCHFText : public ScreenSpeaker {
+public:
+ SpeakerCHFText();
+
+ virtual Common::String getClassName() { return "SpeakerCHFText"; }
+};
+
+class SpeakerSKText : public ScreenSpeaker {
+public:
+ SpeakerSKText();
+
+ virtual Common::String getClassName() { return "SpeakerSKText"; }
+};
+
+class SpeakerCDRText : public ScreenSpeaker {
+public:
+ SpeakerCDRText();
+
+ virtual Common::String getClassName() { return "SpeakerCDRText"; }
+};
+
+class SpeakerFLText : public ScreenSpeaker {
+public:
+ SpeakerFLText();
+
+ virtual Common::String getClassName() { return "SpeakerFLText"; }
+};
+
+class SpeakerBatText : public ScreenSpeaker {
+public:
+ SpeakerBatText();
+
+ virtual Common::String getClassName() { return "SpeakerFLText"; }
+};
+
+class SpeakerQR : public AnimatedSpeaker {
+public:
+ SpeakerQR();
+
+ virtual Common::String getClassName() { return "SpeakerQR"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerQU : public AnimatedSpeaker {
+public:
+ SpeakerQU();
+
+ virtual Common::String getClassName() { return "SpeakerQU"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerSKL : public AnimatedSpeaker {
+public:
+ SpeakerSKL();
+
+ virtual Common::String getClassName() { return "SpeakerQL"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerQL : public AnimatedSpeaker {
+public:
+ SpeakerQL();
+
+ virtual Common::String getClassName() { return "SpeakerQL"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerSR : public AnimatedSpeaker {
+public:
+ SceneObject _object3;
+public:
+ SpeakerSR();
+
+ virtual Common::String getClassName() { return "SpeakerSR"; }
+ void setText(const Common::String &msg);
+};
+
+class SpeakerSL : public AnimatedSpeaker {
+public:
+ SpeakerSL();
+
+ virtual Common::String getClassName() { return "SpeakerSL"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerCR : public AnimatedSpeaker {
+public:
+ SpeakerCR();
+
+ virtual Common::String getClassName() { return "SpeakerCR"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerMR : public AnimatedSpeaker {
+public:
+ SpeakerMR();
+
+ virtual Common::String getClassName() { return "SpeakerMR"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerSAL : public AnimatedSpeaker {
+public:
+ SpeakerSAL();
+
+ virtual Common::String getClassName() { return "SpeakerSAL"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerML : public AnimatedSpeaker {
+public:
+ SpeakerML();
+
+ virtual Common::String getClassName() { return "SpeakerML"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerCHFL : public AnimatedSpeaker {
+public:
+ SpeakerCHFL();
+
+ virtual Common::String getClassName() { return "SpeakerCHFL"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerCHFR : public AnimatedSpeaker {
+public:
+ SpeakerCHFR();
+
+ virtual Common::String getClassName() { return "SpeakerCHFR"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerPL : public AnimatedSpeaker {
+public:
+ SceneObject _object3;
+ SpeakerAction _speakerAction2;
+
+ SpeakerPL();
+
+ virtual Common::String getClassName() { return "SpeakerPL"; }
+ virtual void setText(const Common::String &msg);
+ virtual void removeText();
+};
+
+class SpeakerPR : public AnimatedSpeaker {
+public:
+ SceneObject _object3;
+ SpeakerAction _speakerAction2;
+
+ SpeakerPR();
+
+ virtual Common::String getClassName() { return "SpeakerPR"; }
+ virtual void setText(const Common::String &msg);
+ virtual void removeText();
+};
+
+class SpeakerCDR : public AnimatedSpeaker {
+public:
+ SpeakerCDR();
+
+ virtual Common::String getClassName() { return "SpeakerCDR"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerCDL : public AnimatedSpeaker {
+public:
+ SpeakerCDL();
+
+ virtual Common::String getClassName() { return "SpeakerCDL"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerFLL : public AnimatedSpeaker {
+public:
+ SpeakerFLL();
+
+ virtual Common::String getClassName() { return "SpeakerFLL"; }
+ virtual void setText(const Common::String &msg);
+};
+
+class SpeakerBatR : public AnimatedSpeaker {
+public:
+ SpeakerBatR();
+
+ virtual Common::String getClassName() { return "SpeakerBatR"; }
+ virtual void setText(const Common::String &msg);
+};
+
+} // End of namespace Ringworld
+
+} // End of namespace TsAGE
+
+#endif
diff --git a/engines/tsage/saveload.cpp b/engines/tsage/saveload.cpp
index 45e655037d..c261d091dd 100644
--- a/engines/tsage/saveload.cpp
+++ b/engines/tsage/saveload.cpp
@@ -32,14 +32,14 @@
namespace TsAGE {
-Saver *_saver;
+Saver *g_saver;
SavedObject::SavedObject() {
- _saver->addObject(this);
+ g_saver->addObject(this);
}
SavedObject::~SavedObject() {
- _saver->removeObject(this);
+ g_saver->removeObject(this);
}
/*--------------------------------------------------------------------------*/
@@ -52,7 +52,7 @@ Saver::Saver() {
Saver::~Saver() {
// Internal validation that no saved object is still present
int totalLost = 0;
- for (SynchronizedList<SavedObject *>::iterator i = _saver->_objList.begin(); i != _saver->_objList.end(); ++i) {
+ for (SynchronizedList<SavedObject *>::iterator i = g_saver->_objList.begin(); i != g_saver->_objList.end(); ++i) {
SavedObject *so = *i;
if (so)
++totalLost;
@@ -72,7 +72,7 @@ void Serializer::syncPointer(SavedObject **ptr, Common::Serializer::Version minV
if (isSaving()) {
// Get the object index for the given pointer and write it out
if (*ptr) {
- idx = _saver->blockIndexOf(*ptr);
+ idx = g_saver->blockIndexOf(*ptr);
assert(idx > 0);
}
syncAsUint32LE(idx);
@@ -82,7 +82,7 @@ void Serializer::syncPointer(SavedObject **ptr, Common::Serializer::Version minV
*ptr = NULL;
if (idx > 0)
// For non-zero (null) pointers, create a record for later resolving it to an address
- _saver->addSavedObjectPtr(ptr, idx);
+ g_saver->addSavedObjectPtr(ptr, idx);
}
}
@@ -120,7 +120,7 @@ void Serializer::syncAsDouble(double &v) {
Common::Error Saver::save(int slot, const Common::String &saveName) {
assert(!getMacroRestoreFlag());
- Common::StackLock slock1(_globals->_soundManager._serverDisabledMutex);
+ Common::StackLock slock1(g_globals->_soundManager._serverDisabledMutex);
// Signal any objects registered for notification
_saveNotifiers.notify(false);
@@ -130,7 +130,7 @@ Common::Error Saver::save(int slot, const Common::String &saveName) {
_saveSlot = slot;
// Set up the serializer
- Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(_vm->generateSaveName(slot));
+ Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(g_vm->generateSaveName(slot));
Serializer serializer(NULL, saveFile);
serializer.setSaveVersion(TSAGE_SAVEGAME_VERSION);
@@ -165,7 +165,7 @@ Common::Error Saver::save(int slot, const Common::String &saveName) {
Common::Error Saver::restore(int slot) {
assert(!getMacroRestoreFlag());
- Common::StackLock slock1(_globals->_soundManager._serverDisabledMutex);
+ Common::StackLock slock1(g_globals->_soundManager._serverDisabledMutex);
// Signal any objects registered for notification
_loadNotifiers.notify(false);
@@ -176,7 +176,7 @@ Common::Error Saver::restore(int slot) {
_unresolvedPtrs.clear();
// Set up the serializer
- Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(_vm->generateSaveName(slot));
+ Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(g_vm->generateSaveName(slot));
Serializer serializer(saveFile, NULL);
// Read in the savegame header
@@ -279,10 +279,10 @@ void Saver::writeSavegameHeader(Common::OutSaveFile *out, tSageSavegameHeader &h
// Create a thumbnail and save it
Graphics::Surface *thumb = new Graphics::Surface();
- Graphics::Surface s = _globals->_screenSurface.lockSurface();
+ Graphics::Surface s = g_globals->_screenSurface.lockSurface();
::createThumbnail(thumb, (const byte *)s.pixels, SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette);
Graphics::saveThumbnail(*out, *thumb);
- _globals->_screenSurface.unlockSurface();
+ g_globals->_screenSurface.unlockSurface();
delete thumb;
// Write out the save date/time
@@ -293,7 +293,7 @@ void Saver::writeSavegameHeader(Common::OutSaveFile *out, tSageSavegameHeader &h
out->writeSint16LE(td.tm_mday);
out->writeSint16LE(td.tm_hour);
out->writeSint16LE(td.tm_min);
- out->writeUint32LE(_globals->_events.getFrameNumber());
+ out->writeUint32LE(g_globals->_events.getFrameNumber());
}
/**
@@ -335,7 +335,7 @@ void Saver::removeObject(SavedObject *obj) {
* Returns true if any savegames exist
*/
bool Saver::savegamesExist() const {
- Common::String slot1Name = _vm->generateSaveName(1);
+ Common::String slot1Name = g_vm->generateSaveName(1);
Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(slot1Name);
bool result = saveFile != NULL;
diff --git a/engines/tsage/saveload.h b/engines/tsage/saveload.h
index f81454d5e9..52b23413d4 100644
--- a/engines/tsage/saveload.h
+++ b/engines/tsage/saveload.h
@@ -33,7 +33,7 @@ namespace TsAGE {
typedef void (*SaveNotifierFn)(bool postFlag);
-#define TSAGE_SAVEGAME_VERSION 6
+#define TSAGE_SAVEGAME_VERSION 7
class SavedObject;
@@ -232,7 +232,7 @@ public:
void listObjects();
};
-extern Saver *_saver;
+extern Saver *g_saver;
} // End of namespace TsAGE
diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp
index 5aeacda6fe..baa114218e 100644
--- a/engines/tsage/scenes.cpp
+++ b/engines/tsage/scenes.cpp
@@ -20,11 +20,15 @@
*
*/
+#include "common/config-manager.h"
+#include "common/translation.h"
+#include "gui/saveload.h"
#include "tsage/scenes.h"
#include "tsage/globals.h"
#include "tsage/ringworld/ringworld_logic.h"
#include "tsage/tsage.h"
#include "tsage/saveload.h"
+#include "tsage/staticres.h"
namespace TsAGE {
@@ -36,7 +40,7 @@ SceneManager::SceneManager() {
_previousScene = 0;
_fadeMode = FADEMODE_GRADUAL;
_scrollerRect = Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
- _saver->addListener(this);
+ g_saver->addListener(this);
_objectCount = 0;
_loadMode = 0;
}
@@ -56,7 +60,7 @@ void SceneManager::checkScene() {
_nextSceneNumber = -1;
}
- _globals->dispatchSounds();
+ g_globals->dispatchSounds();
}
void SceneManager::sceneChange() {
@@ -69,24 +73,16 @@ void SceneManager::sceneChange() {
}
// Clear the scene objects
- SynchronizedList<SceneObject *>::iterator io = _globals->_sceneObjects->begin();
- while (io != _globals->_sceneObjects->end()) {
- SceneObject *sceneObj = *io;
- ++io;
- sceneObj->removeObject();
- }
-
- // Clear the secondary scene object list
- io = _globals->_sceneManager._altSceneObjects.begin();
- while (io != _globals->_sceneManager._altSceneObjects.end()) {
+ SynchronizedList<SceneObject *>::iterator io = g_globals->_sceneObjects->begin();
+ while (io != g_globals->_sceneObjects->end()) {
SceneObject *sceneObj = *io;
++io;
sceneObj->removeObject();
}
// Clear the hotspot list
- SynchronizedList<SceneItem *>::iterator ii = _globals->_sceneItems.begin();
- while (ii != _globals->_sceneItems.end()) {
+ SynchronizedList<SceneItem *>::iterator ii = g_globals->_sceneItems.begin();
+ while (ii != g_globals->_sceneItems.end()) {
SceneItem *sceneItem = *ii;
++ii;
sceneItem->remove();
@@ -111,37 +107,37 @@ void SceneManager::sceneChange() {
// Ensure that the same number of objects are registered now as when the scene started
if (_objectCount > 0) {
- assert(_objectCount == _saver->getObjectCount());
+ assert(_objectCount == g_saver->getObjectCount());
}
- _objectCount = _saver->getObjectCount();
- _globals->_sceneHandler->_delayTicks = 2;
+ _objectCount = g_saver->getObjectCount();
+ g_globals->_sceneHandler->_delayTicks = 2;
// Instantiate and set the new scene
_scene = getNewScene();
- if (!_saver->getMacroRestoreFlag())
+ if (!g_saver->getMacroRestoreFlag())
_scene->postInit();
else
_scene->loadScene(activeScreenNumber);
}
Scene *SceneManager::getNewScene() {
- return _globals->_game->createScene(_nextSceneNumber);
+ return g_globals->_game->createScene(_nextSceneNumber);
}
void SceneManager::fadeInIfNecessary() {
if (_hasPalette) {
uint32 adjustData = 0;
for (int percent = 0; percent < 100; percent += 5) {
- if (_globals->_sceneManager._fadeMode == FADEMODE_IMMEDIATE)
+ if (g_globals->_sceneManager._fadeMode == FADEMODE_IMMEDIATE)
percent = 100;
- _globals->_scenePalette.fade((const byte *)&adjustData, false, percent);
+ g_globals->_scenePalette.fade((const byte *)&adjustData, false, percent);
g_system->updateScreen();
g_system->delayMillis(10);
}
- _globals->_scenePalette.refresh();
+ g_globals->_scenePalette.refresh();
_hasPalette = false;
}
}
@@ -151,7 +147,7 @@ void SceneManager::changeScene(int newSceneNumber) {
// Fade out the scene
ScenePalette scenePalette;
uint32 adjustData = 0;
- _globals->_scenePalette.clearListeners();
+ g_globals->_scenePalette.clearListeners();
scenePalette.getPalette();
for (int percent = 100; percent >= 0; percent -= 5) {
@@ -161,7 +157,7 @@ void SceneManager::changeScene(int newSceneNumber) {
// Stop any objects that were animating
SynchronizedList<SceneObject *>::iterator i;
- for (i = _globals->_sceneObjects->begin(); i != _globals->_sceneObjects->end(); ++i) {
+ for (i = g_globals->_sceneObjects->begin(); i != g_globals->_sceneObjects->end(); ++i) {
SceneObject *sceneObj = *i;
Common::Point pt(0, 0);
sceneObj->addMover(NULL, &pt);
@@ -172,10 +168,10 @@ void SceneManager::changeScene(int newSceneNumber) {
}
// Blank out the screen
- _globals->_screenSurface.fillRect(_globals->_screenSurface.getBounds(), 0);
+ g_globals->_screenSurface.fillRect(g_globals->_screenSurface.getBounds(), 0);
// If there are any fading sounds, wait until fading is complete
- while (_globals->_soundManager.isFading()) {
+ while (g_globals->_soundManager.isFading()) {
g_system->delayMillis(10);
}
@@ -184,30 +180,30 @@ void SceneManager::changeScene(int newSceneNumber) {
}
void SceneManager::setup() {
- _saver->addLoadNotifier(SceneManager::loadNotifier);
+ g_saver->addLoadNotifier(SceneManager::loadNotifier);
setBackSurface();
}
void SceneManager::setBackSurface() {
- int size = _globals->_sceneManager._scene->_backgroundBounds.width() *
- _globals->_sceneManager._scene->_backgroundBounds.height();
+ int size = g_globals->_sceneManager._scene->_backgroundBounds.width() *
+ g_globals->_sceneManager._scene->_backgroundBounds.height();
if (size > 96000) {
- if (_globals->_sceneManager._scene->_backgroundBounds.width() <= SCREEN_WIDTH) {
+ if (g_globals->_sceneManager._scene->_backgroundBounds.width() <= SCREEN_WIDTH) {
// Standard size creation
- _globals->_sceneManager._scene->_backSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT * 3 / 2);
- _globals->_sceneManager._scrollerRect = Rect(0, 30, SCREEN_WIDTH, SCREEN_HEIGHT - 30);
+ g_globals->_sceneManager._scene->_backSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT * 3 / 2);
+ g_globals->_sceneManager._scrollerRect = Rect(0, 30, SCREEN_WIDTH, SCREEN_HEIGHT - 30);
} else {
// Wide screen needs extra space to allow for scrolling
- _globals->_sceneManager._scene->_backSurface.create(SCREEN_WIDTH * 3 / 2, SCREEN_HEIGHT);
- _globals->_sceneManager._scrollerRect = Rect(80, 0, SCREEN_WIDTH - 80, SCREEN_HEIGHT);
+ g_globals->_sceneManager._scene->_backSurface.create(SCREEN_WIDTH * 3 / 2, SCREEN_HEIGHT);
+ g_globals->_sceneManager._scrollerRect = Rect(80, 0, SCREEN_WIDTH - 80, SCREEN_HEIGHT);
}
} else {
- _globals->_sceneManager._scene->_backSurface.create(
- _globals->_sceneManager._scene->_backgroundBounds.width(),
- _globals->_sceneManager._scene->_backgroundBounds.height()
+ g_globals->_sceneManager._scene->_backSurface.create(
+ g_globals->_sceneManager._scene->_backgroundBounds.width(),
+ g_globals->_sceneManager._scene->_backgroundBounds.height()
);
- _globals->_sceneManager._scrollerRect = Rect(80, 20, SCREEN_WIDTH - 80, SCREEN_HEIGHT - 20);
+ g_globals->_sceneManager._scrollerRect = Rect(80, 20, SCREEN_WIDTH - 80, SCREEN_HEIGHT - 20);
}
}
@@ -216,9 +212,9 @@ void SceneManager::saveListener(int saveMode) {
void SceneManager::loadNotifier(bool postFlag) {
if (postFlag) {
- if (_globals->_sceneManager._scene->_activeScreenNumber != -1)
- _globals->_sceneManager._scene->loadSceneData(_globals->_sceneManager._scene->_activeScreenNumber);
- _globals->_sceneManager._hasPalette = true;
+ if (g_globals->_sceneManager._scene->_activeScreenNumber != -1)
+ g_globals->_sceneManager._scene->loadSceneData(g_globals->_sceneManager._scene->_activeScreenNumber);
+ g_globals->_sceneManager._hasPalette = true;
}
}
@@ -230,14 +226,17 @@ void SceneManager::setBgOffset(const Common::Point &pt, int loadCount) {
void SceneManager::listenerSynchronize(Serializer &s) {
s.validate("SceneManager");
- if (s.isLoading() && !_globals->_sceneManager._scene)
+ if (s.isLoading() && !g_globals->_sceneManager._scene)
// Loading a savegame straight from the launcher, so instantiate a blank placeholder scene
// in order for the savegame loading to work correctly
- _globals->_sceneManager._scene = new Scene();
+ g_globals->_sceneManager._scene = new Scene();
+
+ // Depreciated: the background scene objects used to be located here
+ uint32 unused = 0;
+ s.syncAsUint32LE(unused);
- _altSceneObjects.synchronize(s);
s.syncAsSint32LE(_sceneNumber);
- s.syncAsUint16LE(_globals->_sceneManager._scene->_activeScreenNumber);
+ s.syncAsUint16LE(g_globals->_sceneManager._scene->_activeScreenNumber);
if (s.isLoading()) {
changeScene(_sceneNumber);
@@ -248,8 +247,8 @@ void SceneManager::listenerSynchronize(Serializer &s) {
}
}
- _globals->_sceneManager._scrollerRect.synchronize(s);
- SYNC_POINTER(_globals->_scrollFollower);
+ g_globals->_sceneManager._scrollerRect.synchronize(s);
+ SYNC_POINTER(g_globals->_scrollFollower);
s.syncAsSint16LE(_loadMode);
}
@@ -284,6 +283,9 @@ void Scene::synchronize(Serializer &s) {
s.syncAsUint16LE(_enabledSections[i]);
for (int i = 0; i < 256; ++i)
s.syncAsSint16LE(_zoomPercents[i]);
+
+ if (s.getVersion() >= 7)
+ _bgSceneObjects.synchronize(s);
}
void Scene::postInit(SceneObjectList *OwnerList) {
@@ -305,8 +307,8 @@ void Scene::dispatch() {
void Scene::loadScene(int sceneNum) {
debug(1, "loadScene(%d)", sceneNum);
_screenNumber = sceneNum;
- if (_globals->_scenePalette.loadPalette(sceneNum))
- _globals->_sceneManager._hasPalette = true;
+ if (g_globals->_scenePalette.loadPalette(sceneNum))
+ g_globals->_sceneManager._hasPalette = true;
loadSceneData(sceneNum);
}
@@ -315,19 +317,19 @@ void Scene::loadSceneData(int sceneNum) {
_activeScreenNumber = sceneNum;
// Get the basic scene size
- byte *data = _resourceManager->getResource(RES_BITMAP, sceneNum, 9999);
+ byte *data = g_resourceManager->getResource(RES_BITMAP, sceneNum, 9999);
_backgroundBounds = Rect(0, 0, READ_LE_UINT16(data), READ_LE_UINT16(data + 2));
- _globals->_sceneManager._scene->_sceneBounds.contain(_backgroundBounds);
+ g_globals->_sceneManager._scene->_sceneBounds.contain(_backgroundBounds);
DEALLOCATE(data);
// Set up a surface for storing the scene background
SceneManager::setBackSurface();
// Load the data lists for the scene
- _globals->_walkRegions.load(sceneNum);
+ g_globals->_walkRegions.load(sceneNum);
// Load the item regions of the scene
- _globals->_sceneRegions.load(sceneNum);
+ g_globals->_sceneRegions.load(sceneNum);
// Load the priority regions
_priorities.load(sceneNum);
@@ -335,13 +337,13 @@ void Scene::loadSceneData(int sceneNum) {
// Initialize the section enabled list
Common::set_to(&_enabledSections[0], &_enabledSections[16 * 16], 0xffff);
- _globals->_sceneOffset.x = (_sceneBounds.left / 160) * 160;
- _globals->_sceneOffset.y = (_sceneBounds.top / 100) * 100;
- _globals->_paneRefreshFlag[0] = 1;
- _globals->_paneRefreshFlag[1] = 1;
- _globals->_sceneManager._loadMode = 1;
- _globals->_sceneManager._sceneLoadCount = 0;
- _globals->_sceneManager._sceneBgOffset = Common::Point(0, 0);
+ g_globals->_sceneOffset.x = (_sceneBounds.left / 160) * 160;
+ g_globals->_sceneOffset.y = (_sceneBounds.top / 100) * 100;
+ g_globals->_paneRefreshFlag[0] = 1;
+ g_globals->_paneRefreshFlag[1] = 1;
+ g_globals->_sceneManager._loadMode = 1;
+ g_globals->_sceneManager._sceneLoadCount = 0;
+ g_globals->_sceneManager._sceneBgOffset = Common::Point(0, 0);
// Load the background for the scene
loadBackground(0, 0);
@@ -353,35 +355,35 @@ void Scene::loadBackground(int xAmount, int yAmount) {
_sceneBounds.contain(_backgroundBounds);
_sceneBounds.left &= ~3;
_sceneBounds.right &= ~3;
- _globals->_sceneOffset.x &= ~3;
+ g_globals->_sceneOffset.x &= ~3;
if ((_sceneBounds.top != _oldSceneBounds.top) || (_sceneBounds.left != _oldSceneBounds.left)) {
- if (_globals->_sceneManager._loadMode == 0) {
- _globals->_paneRefreshFlag[0] = 2;
- _globals->_paneRefreshFlag[1] = 2;
- _globals->_sceneManager._loadMode = 2;
+ if (g_globals->_sceneManager._loadMode == 0) {
+ g_globals->_paneRefreshFlag[0] = 2;
+ g_globals->_paneRefreshFlag[1] = 2;
+ g_globals->_sceneManager._loadMode = 2;
}
_oldSceneBounds = _sceneBounds;
}
- _globals->_sceneOffset.x = (_sceneBounds.left / 160) * 160;
- _globals->_sceneOffset.y = (_sceneBounds.top / 100) * 100;
+ g_globals->_sceneOffset.x = (_sceneBounds.left / 160) * 160;
+ g_globals->_sceneOffset.y = (_sceneBounds.top / 100) * 100;
if ((_backgroundBounds.width() / 160) == 3)
- _globals->_sceneOffset.x = 0;
+ g_globals->_sceneOffset.x = 0;
if ((_backgroundBounds.height() / 100) == 3)
- _globals->_sceneOffset.y = 0;
+ g_globals->_sceneOffset.y = 0;
- if ((_globals->_sceneOffset.x != _globals->_prevSceneOffset.x) ||
- (_globals->_sceneOffset.y != _globals->_prevSceneOffset.y)) {
+ if ((g_globals->_sceneOffset.x != g_globals->_prevSceneOffset.x) ||
+ (g_globals->_sceneOffset.y != g_globals->_prevSceneOffset.y)) {
// Change has happend, so refresh background
- _globals->_prevSceneOffset = _globals->_sceneOffset;
+ g_globals->_prevSceneOffset = g_globals->_sceneOffset;
refreshBackground(xAmount, yAmount);
}
}
void Scene::refreshBackground(int xAmount, int yAmount) {
- if (_globals->_sceneManager._scene->_activeScreenNumber == -1)
+ if (g_globals->_sceneManager._scene->_activeScreenNumber == -1)
return;
// Set the quadrant ranges
@@ -426,7 +428,7 @@ void Scene::refreshBackground(int xAmount, int yAmount) {
(xSectionSrc + 1) * 160, (ySectionSrc + 1) * 100);
Rect destBounds(xSectionDest * 160, ySectionDest * 100,
(xSectionDest + 1) * 160, (ySectionDest + 1) * 100);
- if (_vm->getGameID() == GType_BlueForce) {
+ if (g_vm->getGameID() == GType_BlueForce) {
// For Blue Force, if the scene has an interface area, exclude it from the copy
srcBounds.bottom = MIN<int16>(srcBounds.bottom, BF_GLOBALS._interfaceY);
destBounds.bottom = MIN<int16>(destBounds.bottom, BF_GLOBALS._interfaceY);
@@ -443,28 +445,27 @@ void Scene::refreshBackground(int xAmount, int yAmount) {
}
if (changedFlag) {
- drawAltObjects();
+ drawBackgroundObjects();
}
}
-void Scene::drawAltObjects() {
+void Scene::drawBackgroundObjects() {
Common::Array<SceneObject *> objList;
// Initial loop to set the priority for entries in the list
- for (SynchronizedList<SceneObject *>::iterator i = _globals->_sceneManager._altSceneObjects.begin();
- i != _globals->_sceneManager._altSceneObjects.end(); ++i) {
+ for (SynchronizedList<SceneObject *>::iterator i = _bgSceneObjects.begin(); i != _bgSceneObjects.end(); ++i) {
SceneObject *obj = *i;
objList.push_back(obj);
// Handle updating object priority
if (!(obj->_flags & OBJFLAG_FIXED_PRIORITY)) {
obj->_priority = MIN((int)obj->_position.y - 1,
- (int)_globals->_sceneManager._scene->_backgroundBounds.bottom);
+ (int)g_globals->_sceneManager._scene->_backgroundBounds.bottom);
}
}
// Sort the list by priority
- _globals->_sceneManager._altSceneObjects.sortList(objList);
+ _bgSceneObjects.sortList(objList);
// Drawing loop
for (uint objIndex = 0; objIndex < objList.size(); ++objIndex) {
@@ -510,6 +511,51 @@ void Scene::setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent
/*--------------------------------------------------------------------------*/
+void Game::restartGame() {
+ if (MessageDialog::show(RESTART_MSG, CANCEL_BTN_STRING, RESTART_BTN_STRING) == 1)
+ g_globals->_game->restart();
+}
+
+void Game::saveGame() {
+ if (!g_vm->canSaveGameStateCurrently())
+ MessageDialog::show(SAVING_NOT_ALLOWED_MSG, OK_BTN_STRING);
+ else {
+ // Show the save dialog
+ handleSaveLoad(true, g_globals->_sceneHandler->_saveGameSlot, g_globals->_sceneHandler->_saveName);
+ }
+}
+
+void Game::restoreGame() {
+ if (!g_vm->canLoadGameStateCurrently())
+ MessageDialog::show(RESTORING_NOT_ALLOWED_MSG, OK_BTN_STRING);
+ else {
+ // Show the load dialog
+ handleSaveLoad(false, g_globals->_sceneHandler->_loadGameSlot, g_globals->_sceneHandler->_saveName);
+ }
+}
+
+void Game::quitGame() {
+ if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1)
+ g_vm->quitGame();
+}
+
+void Game::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {
+ const EnginePlugin *plugin = 0;
+ EngineMan.findGame(g_vm->getGameId(), &plugin);
+ GUI::SaveLoadChooser *dialog;
+ if (saveFlag)
+ dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
+ else
+ dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"));
+
+ dialog->setSaveMode(saveFlag);
+
+ saveSlot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ saveName = dialog->getResultString();
+
+ delete dialog;
+}
+
void Game::execute() {
// Main game loop
bool activeFlag = false;
@@ -523,7 +569,7 @@ void Game::execute() {
activeFlag = true;
}
}
- } while (activeFlag && !_vm->shouldQuit());
+ } while (activeFlag && !g_vm->shouldQuit());
}
} // End of namespace TsAGE
diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h
index 7e8c26f912..da813f019a 100644
--- a/engines/tsage/scenes.h
+++ b/engines/tsage/scenes.h
@@ -33,7 +33,7 @@ namespace TsAGE {
class Scene : public StripCallback {
private:
- void drawAltObjects();
+ void drawBackgroundObjects();
public:
int _field12;
int _screenNumber;
@@ -48,6 +48,7 @@ public:
int _enabledSections[256];
int _zoomPercents[256];
ScenePriorities _priorities;
+ SceneObjectList _bgSceneObjects;
int _fieldA;
int _fieldE;
@@ -71,8 +72,8 @@ public:
class SceneManager : public GameHandler, public SaveListener {
private:
- void disposeRegions() {
- // No need to do anything, since regions will be freed automatically when the scene is
+ void disposeRegions() {
+ // No need to do anything, since regions will be freed automatically when the scene is
}
Scene *getNewScene();
public:
@@ -86,7 +87,6 @@ public:
Common::Point _sceneBgOffset;
int _sceneLoadCount;
Rect _scrollerRect;
- SceneObjectList _altSceneObjects;
int _objectCount;
public:
SceneManager();
@@ -115,7 +115,7 @@ protected:
SynchronizedList<GameHandler *> _handlers;
static bool notLockedFn(GameHandler *g);
- virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {}
+ virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName);
public:
virtual ~Game() {}
@@ -125,13 +125,14 @@ public:
void execute();
virtual void start() = 0;
virtual void restart() {}
- virtual void restartGame() {}
- virtual void saveGame() {}
- virtual void restoreGame() {}
- virtual void quitGame() {}
+ virtual void restartGame();
+ virtual void saveGame();
+ virtual void restoreGame();
+ virtual void quitGame();
virtual void endGame(int resNum, int lineNum) {}
virtual Scene *createScene(int sceneNumber) = 0;
virtual void processEvent(Event &event) {}
+ virtual void rightClick() {}
};
} // End of namespace TsAGE
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index 2139056770..71e69283e7 100644
--- a/engines/tsage/sound.cpp
+++ b/engines/tsage/sound.cpp
@@ -54,7 +54,7 @@ SoundManager::SoundManager() {
SoundManager::~SoundManager() {
if (__sndmgrReady) {
Common::StackLock slock(_serverDisabledMutex);
- _vm->_mixer->stopAll();
+ g_vm->_mixer->stopAll();
for (Common::List<Sound *>::iterator i = _soundList.begin(); i != _soundList.end(); ) {
Sound *s = *i;
@@ -84,14 +84,14 @@ SoundManager::~SoundManager() {
void SoundManager::postInit() {
if (!__sndmgrReady) {
- _saver->addSaveNotifier(&SoundManager::saveNotifier);
- _saver->addLoadNotifier(&SoundManager::loadNotifier);
- _saver->addListener(this);
+ g_saver->addSaveNotifier(&SoundManager::saveNotifier);
+ g_saver->addLoadNotifier(&SoundManager::loadNotifier);
+ g_saver->addListener(this);
// I originally separated the sound manager update method into a separate thread, since
// it handles updates for both music and Fx. However, since Adlib updates also get done in a
-// thread, and doesn't get too far ahead, I've left it to the AdlibSoundDriver class to
+// thread, and doesn't get too far ahead, I've left it to the AdlibSoundDriver class to
// call the update method, rather than having it be called separately
// g_system->getTimerManager()->installTimerProc(_sfUpdateCallback, 1000000 / SOUND_FREQUENCY, NULL, "tsageSoundUpdate");
__sndmgrReady = true;
@@ -139,7 +139,7 @@ Common::List<SoundDriverEntry> &SoundManager::buildDriverList(bool detectFlag) {
assert(__sndmgrReady);
_availableDrivers.clear();
- // Build up a list of available drivers. Currently we only implement an Adlib music
+ // Build up a list of available drivers. Currently we only implement an Adlib music
// and SoundBlaster FX driver
// Adlib driver
@@ -211,7 +211,7 @@ void SoundManager::installDriver(int driverNum) {
case ROLAND_DRIVER_NUM:
case ADLIB_DRIVER_NUM: {
// Handle loading bank infomation
- byte *bankData = _resourceManager->getResource(RES_BANK, driverNum, 0, true);
+ byte *bankData = g_resourceManager->getResource(RES_BANK, driverNum, 0, true);
if (bankData) {
// Install the patch bank data
_sfInstallPatchBank(driver, bankData);
@@ -1362,7 +1362,7 @@ void SoundManager::_sfExtractGroupMask() {
bool SoundManager::_sfInstallDriver(SoundDriver *driver) {
if (!driver->open())
return false;
-
+
sfManager()._installedDrivers.push_back(driver);
driver->_groupOffset = driver->getGroupData();
driver->_groupMask = driver->_groupOffset->groupMask;
@@ -1383,7 +1383,7 @@ void SoundManager::_sfUnInstallDriver(SoundDriver *driver) {
}
void SoundManager::_sfInstallPatchBank(SoundDriver *driver, const byte *bankData) {
- driver->installPatch(bankData, _vm->_memoryManager.getSize(bankData));
+ driver->installPatch(bankData, g_vm->_memoryManager.getSize(bankData));
}
/**
@@ -1536,7 +1536,7 @@ void Sound::play(int soundNum) {
}
void Sound::stop() {
- _globals->_soundManager.removeFromPlayList(this);
+ g_globals->_soundManager.removeFromPlayList(this);
_unPrime();
}
@@ -1560,7 +1560,7 @@ void Sound::_prime(int soundResID, bool dontQueue) {
// Sound number specified
_isEmpty = false;
_remoteReceiver = NULL;
- byte *soundData = _resourceManager->getResource(RES_SOUND, soundResID, 0);
+ byte *soundData = g_resourceManager->getResource(RES_SOUND, soundResID, 0);
_soundManager->checkResVersion(soundData);
_group = _soundManager->determineGroup(soundData);
_sndResPriority = _soundManager->extractPriority(soundData);
@@ -1568,7 +1568,7 @@ void Sound::_prime(int soundResID, bool dontQueue) {
_soundManager->extractTrackInfo(&_trackInfo, soundData, _group);
for (int idx = 0; idx < _trackInfo._numTracks; ++idx) {
- _channelData[idx] = _resourceManager->getResource(RES_SOUND, soundResID, _trackInfo._chunks[idx]);
+ _channelData[idx] = g_resourceManager->getResource(RES_SOUND, soundResID, _trackInfo._chunks[idx]);
}
DEALLOCATE(soundData);
@@ -1667,7 +1667,7 @@ bool Sound::isMuted() const {
}
void Sound::pause(bool flag) {
- Common::StackLock slock(_globals->_soundManager._serverSuspendedMutex);
+ Common::StackLock slock(g_globals->_soundManager._serverSuspendedMutex);
if (flag)
++_pausedCount;
@@ -1678,7 +1678,7 @@ void Sound::pause(bool flag) {
}
void Sound::mute(bool flag) {
- Common::StackLock slock(_globals->_soundManager._serverSuspendedMutex);
+ Common::StackLock slock(g_globals->_soundManager._serverSuspendedMutex);
if (flag)
++_mutedCount;
@@ -1689,7 +1689,7 @@ void Sound::mute(bool flag) {
}
void Sound::fade(int fadeDest, int fadeSteps, int fadeTicks, bool stopAfterFadeFlag) {
- Common::StackLock slock(_globals->_soundManager._serverSuspendedMutex);
+ Common::StackLock slock(g_globals->_soundManager._serverSuspendedMutex);
if (fadeDest > 127)
fadeDest = 127;
@@ -1789,7 +1789,7 @@ void Sound::_soPrimeSound(bool dontQueue) {
}
void Sound::_soSetTimeIndex(uint timeIndex) {
- Common::StackLock slock(_globals->_soundManager._serverSuspendedMutex);
+ Common::StackLock slock(g_globals->_soundManager._serverSuspendedMutex);
if (timeIndex != _timer) {
_soundManager->_soTimeIndexFlag = true;
@@ -2392,13 +2392,13 @@ int Sound::_soFindSound(VoiceTypeStruct *vtStruct, int channelNum) {
ASound::ASound(): EventHandler() {
_action = NULL;
_cueValue = -1;
- if (_globals)
- _globals->_sounds.push_back(this);
+ if (g_globals)
+ g_globals->_sounds.push_back(this);
}
ASound::~ASound() {
- if (_globals)
- _globals->_sounds.remove(this);
+ if (g_globals)
+ g_globals->_sounds.remove(this);
}
void ASound::synchronize(Serializer &s) {
@@ -2544,7 +2544,7 @@ AdlibSoundDriver::AdlibSoundDriver(): SoundDriver() {
_groupData.v2 = 0;
_groupData.pData = &adlib_group_data[0];
- _mixer = _vm->_mixer;
+ _mixer = g_vm->_mixer;
_sampleRate = _mixer->getOutputRate();
_opl = OPL::Config::create();
assert(_opl);
@@ -2858,7 +2858,7 @@ SoundBlasterDriver::SoundBlasterDriver(): SoundDriver() {
static byte const group_data[] = { 3, 1, 1, 0, 0xff };
_groupData.pData = group_data;
- _mixer = _vm->_mixer;
+ _mixer = g_vm->_mixer;
_sampleRate = _mixer->getOutputRate();
_audioStream = NULL;
_channelData = NULL;
@@ -2904,7 +2904,7 @@ void SoundBlasterDriver::playSound(const byte *channelData, int dataOffset, int
_channelData = channelData + dataOffset;
// Make a copy of the buffer
- int dataSize = _vm->_memoryManager.getSize(channelData);
+ int dataSize = g_vm->_memoryManager.getSize(channelData);
byte *soundData = (byte *)malloc(dataSize - dataOffset);
Common::copy(_channelData, _channelData + (dataSize - dataOffset), soundData);
diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h
index a8ff348bc6..010394a42e 100644
--- a/engines/tsage/sound.h
+++ b/engines/tsage/sound.h
@@ -72,7 +72,7 @@ struct RegisterValue {
uint8 _regNum;
uint8 _value;
- RegisterValue(int regNum, int value) {
+ RegisterValue(int regNum, int value) {
_regNum = regNum; _value = value;
}
};
diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp
index 819cf56f31..626e2a7cd1 100644
--- a/engines/tsage/staticres.cpp
+++ b/engines/tsage/staticres.cpp
@@ -72,12 +72,8 @@ const char *DEFAULT_SCENE_HOTSPOT = "That accomplishes nothing.";
const char *SAVE_ERROR_MSG = "Error occurred saving game. Please do not try to restore this game!";
const char *SAVING_NOT_ALLOWED_MSG = "Saving is not allowed at this time.";
const char *RESTORING_NOT_ALLOWED_MSG = "Restoring is not allowed at this time.";
-const char *RESTART_CONFIRM_MSG = "Do you want to restart your game?";
const char *INV_EMPTY_MSG = "You have nothing in your possesion.";
-const char *HELP_MSG = "Ringworld\rRevenge of the Patriarch\x14\rScummVM Version\r\r\
-\x01 Keyboard shortcuts...\rF2 - Sound options\rF3 - Quit\r\
-F4 - Restart\rF5 - Save game\rF7 - Restore Game\rF10 - Pause game";
const char *QUIT_CONFIRM_MSG = "Do you want to quit playing this game?";
const char *RESTART_MSG = "Do you want to restart this game?";
const char *GAME_PAUSED_MSG = "Game is paused.";
@@ -97,6 +93,9 @@ const char *PICK_BTN_STRING = "Pick";
namespace Ringworld {
// Dialog resources
+const char *HELP_MSG = "Ringworld\rRevenge of the Patriarch\x14\rScummVM Version\r\r\
+\x01 Keyboard shortcuts...\rF2 - Sound options\rF3 - Quit\r\
+F4 - Restart\rF5 - Save game\rF7 - Restore Game\rF10 - Pause game";
const char *WATCH_INTRO_MSG = "Do you wish to watch the introduction?";
const char *START_PLAY_BTN_STRING = " Start Play ";
const char *INTRODUCTION_BTN_STRING = "Introduction";
@@ -129,6 +128,9 @@ const char *DEMO_RESUME_BTN_STRING = "Resume";
namespace BlueForce {
// Dialog resources
+const char *HELP_MSG = "Blue Force\x14\rScummVM Version\r\r\
+Keyboard shortcuts...\rF2 - Sound options\rF3 - Quit\r\
+F4 - Restart\rF5 - Save game\rF7 - Restore Game\rF10 - Pause game";
const char *WATCH_INTRO_MSG = "Do you wish to watch the introduction?";
const char *START_PLAY_BTN_STRING = " Play ";
const char *INTRODUCTION_BTN_STRING = " Watch ";
@@ -155,6 +157,24 @@ const char *CITY_HALL_JAIL = "City Hall & Jail";
const char *JAMISON_RYAN = "Jamison & Ryan";
const char *BIKINI_HUT = "Bikini Hut";
+// Scene 60 radio messages
+const char *RADIO_BTN_LIST[8] = { "10-2 ", "10-4 ", "10-13", "10-15", "10-27", "10-35", "10-97", "10-98" };
+
+// Scene 570 computer messageS
+const char *SCENE570_PASSWORD = "PASSWORD -> ";
+const char *SCENE570_C_DRIVE = "C:\\";
+const char *SCENE570_RING = "RING";
+const char *SCENE570_PROTO = "PROTO";
+const char *SCENE570_WACKY = "WACKY";
+const char *SCENE570_COBB = "COBB";
+const char *SCENE570_LETTER = "LETTER";
+const char *SCENE570_RINGEXE = "RINGEXE";
+const char *SCENE570_RINGDATA = "RINGDATA";
+const char *SCENE570_PROTOEXE = "PROTOEXE";
+const char *SCENE570_PROTODATA = "PROTODATA";
+const char *SCENE570_WACKYEXE = "WACKYEXE";
+const char *SCENE570_WACKYDATA = "WACKYDATA";
+
} // End of namespace BlueForce
} // End of namespace TsAGE
diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h
index b08e92def2..6829ff2568 100644
--- a/engines/tsage/staticres.h
+++ b/engines/tsage/staticres.h
@@ -39,10 +39,8 @@ extern const char *DEFAULT_SCENE_HOTSPOT;
extern const char *SAVE_ERROR_MSG;
extern const char *SAVING_NOT_ALLOWED_MSG;
extern const char *RESTORING_NOT_ALLOWED_MSG;
-extern const char *RESTART_CONFIRM_MSG;
// Dialogs
-extern const char *HELP_MSG;
extern const char *QUIT_CONFIRM_MSG;
extern const char *RESTART_MSG;
extern const char *GAME_PAUSED_MSG;
@@ -62,6 +60,7 @@ extern const char *INV_EMPTY_MSG;
namespace Ringworld {
// Dialog resources
+extern const char *HELP_MSG;
extern const char *WATCH_INTRO_MSG;
extern const char *START_PLAY_BTN_STRING;
extern const char *INTRODUCTION_BTN_STRING;
@@ -95,6 +94,7 @@ extern const char *DEMO_RESUME_BTN_STRING;
namespace BlueForce {
// Dialog resources
+extern const char *HELP_MSG;
extern const char *WATCH_INTRO_MSG;
extern const char *START_PLAY_BTN_STRING;
extern const char *INTRODUCTION_BTN_STRING;
@@ -121,6 +121,23 @@ extern const char *CITY_HALL_JAIL;
extern const char *JAMISON_RYAN;
extern const char *BIKINI_HUT;
+extern const char *SCENE570_PASSWORD;
+extern const char *SCENE570_C_DRIVE;
+extern const char *SCENE570_RING;
+extern const char *SCENE570_PROTO;
+extern const char *SCENE570_WACKY;
+extern const char *SCENE570_COBB;
+extern const char *SCENE570_LETTER;
+extern const char *SCENE570_RINGEXE;
+extern const char *SCENE570_RINGDATA;
+extern const char *SCENE570_PROTOEXE;
+extern const char *SCENE570_PROTODATA;
+extern const char *SCENE570_WACKYEXE;
+extern const char *SCENE570_WACKYDATA;
+
+// Scene 60 radio dispatch buttons
+extern const char *RADIO_BTN_LIST[8];
+
} // End of namespace BlueForce
} // End of namespace TsAGE
diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp
index 2fcabff16c..90fdecc90b 100644
--- a/engines/tsage/tsage.cpp
+++ b/engines/tsage/tsage.cpp
@@ -32,11 +32,11 @@
namespace TsAGE {
-TSageEngine *_vm = NULL;
+TSageEngine *g_vm = NULL;
TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc) : Engine(system),
_gameDescription(gameDesc) {
- _vm = this;
+ g_vm = this;
DebugMan.addDebugChannel(kRingDebugScripts, "scripts", "Scripts debugging");
_debugger = new Debugger();
}
@@ -61,49 +61,55 @@ bool TSageEngine::hasFeature(EngineFeature f) const {
}
void TSageEngine::initialize() {
- _saver = new Saver();
+ g_saver = new Saver();
// Set up the resource manager
- _resourceManager = new ResourceManager();
- if (_vm->getFeatures() & GF_DEMO) {
+ g_resourceManager = new ResourceManager();
+ if (g_vm->getFeatures() & GF_DEMO) {
// Add the single library file associated with the demo
- _resourceManager->addLib(getPrimaryFilename());
- _globals = new Globals();
-
- } else if (_vm->getGameID() == GType_Ringworld) {
- _resourceManager->addLib("RING.RLB");
- _resourceManager->addLib("TSAGE.RLB");
- _globals = new Globals();
-
- } else if (_vm->getGameID() == GType_BlueForce) {
- _resourceManager->addLib("BLUE.RLB");
- if (_vm->getFeatures() & GF_FLOPPY) {
- _resourceManager->addLib("FILES.RLB");
- _resourceManager->addLib("TSAGE.RLB");
+ g_resourceManager->addLib(getPrimaryFilename());
+ g_globals = new Globals();
+
+ } else if (g_vm->getGameID() == GType_Ringworld) {
+ g_resourceManager->addLib("RING.RLB");
+ g_resourceManager->addLib("TSAGE.RLB");
+ g_globals = new Globals();
+
+ } else if (g_vm->getGameID() == GType_BlueForce) {
+ g_resourceManager->addLib("BLUE.RLB");
+ if (g_vm->getFeatures() & GF_FLOPPY) {
+ g_resourceManager->addLib("FILES.RLB");
+ g_resourceManager->addLib("TSAGE.RLB");
}
- _globals = new BlueForce::BlueForceGlobals();
+ g_globals = new BlueForce::BlueForceGlobals();
+
+ // Setup the user interface
+ BF_GLOBALS._uiElements.setup(Common::Point(0, BF_INTERFACE_Y - 2));
+
+ // Reset all global variables
+ BF_GLOBALS.reset();
}
- _globals->gfxManager().setDefaults();
+ g_globals->gfxManager().setDefaults();
// Setup sound settings
syncSoundSettings();
}
void TSageEngine::deinitialize() {
- delete _globals;
- delete _resourceManager;
- delete _saver;
- _resourceManager = NULL;
- _saver = NULL;
+ delete g_globals;
+ delete g_resourceManager;
+ delete g_saver;
+ g_resourceManager = NULL;
+ g_saver = NULL;
}
Common::Error TSageEngine::run() {
// Basic initialisation
initialize();
- _globals->_sceneHandler->registerHandler();
- _globals->_game->execute();
+ g_globals->_sceneHandler->registerHandler();
+ g_globals->_game->execute();
deinitialize();
return Common::kNoError;
@@ -113,28 +119,28 @@ Common::Error TSageEngine::run() {
* Returns true if it is currently okay to restore a game
*/
bool TSageEngine::canLoadGameStateCurrently() {
- return (_globals->getFlag(50) == 0);
+ return (g_globals->getFlag(50) == 0);
}
/**
* Returns true if it is currently okay to save the game
*/
bool TSageEngine::canSaveGameStateCurrently() {
- return (_globals->getFlag(50) == 0);
+ return (g_globals->getFlag(50) == 0);
}
/**
* Load the savegame at the specified slot index
*/
Common::Error TSageEngine::loadGameState(int slot) {
- return _saver->restore(slot);
+ return g_saver->restore(slot);
}
/**
* Save the game to the given slot index, and with the given name
*/
Common::Error TSageEngine::saveGameState(int slot, const Common::String &desc) {
- return _saver->save(slot, desc);
+ return g_saver->save(slot, desc);
}
/**
@@ -148,7 +154,7 @@ Common::String TSageEngine::generateSaveName(int slot) {
void TSageEngine::syncSoundSettings() {
Engine::syncSoundSettings();
- _globals->_soundManager.syncSounds();
+ g_globals->_soundManager.syncSounds();
}
bool TSageEngine::shouldQuit() {
diff --git a/engines/tsage/tsage.h b/engines/tsage/tsage.h
index 7bb3c7a989..a4e9240aee 100644
--- a/engines/tsage/tsage.h
+++ b/engines/tsage/tsage.h
@@ -94,11 +94,11 @@ public:
void deinitialize();
};
-extern TSageEngine *_vm;
+extern TSageEngine *g_vm;
-#define ALLOCATE_HANDLE(x) _vm->_memoryManager.allocate(x)
-#define ALLOCATE(x) _vm->_memoryManager.allocate2(x)
-#define DEALLOCATE(x) _vm->_memoryManager.deallocate(x)
+#define ALLOCATE_HANDLE(x) g_vm->_memoryManager.allocate(x)
+#define ALLOCATE(x) g_vm->_memoryManager.allocate2(x)
+#define DEALLOCATE(x) g_vm->_memoryManager.deallocate(x)
} // End of namespace TsAGE
diff --git a/engines/tucker/staticres.cpp b/engines/tucker/staticres.cpp
index ef778b6f54..388f5ba05c 100644
--- a/engines/tucker/staticres.cpp
+++ b/engines/tucker/staticres.cpp
@@ -340,7 +340,7 @@ const SoundSequenceDataList AnimationSequencePlayer::_soundSeqDataList[] = {
{ 0, 0, 4, 0, 7, _soundDataSeq19_20 }
};
-const char *AnimationSequencePlayer::_audioFileNamesTable[] = {
+const char *const AnimationSequencePlayer::_audioFileNamesTable[] = {
"demomenu.raw",
"demorolc.raw",
"fx101.wav",
diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h
index e676369427..3daf75d44a 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -989,7 +989,7 @@ private:
Audio::SoundHandle _musicHandle;
static const SoundSequenceDataList _soundSeqDataList[];
- static const char *_audioFileNamesTable[];
+ static const char *const _audioFileNamesTable[];
};
} // namespace Tucker